huysentruitw / SapNwRfc

SAP NetWeaver RFC library for .NET 5, .NET Core and .NET Framework
MIT License
149 stars 45 forks source link

Support variable length bytes #54

Closed campersau closed 2 years ago

campersau commented 2 years ago

RfcGetXString can be used to read variable length bytes similar to RfcGetString.

According to the docs RfcGetXString supports these types:

     * - RFCTYPE_BYTE
     * - RFCTYPE_XSTRING
     * - RFCTYPE_CHAR
     * - RFCTYPE_NUM
     * - RFCTYPE_DATE
     * - RFCTYPE_TIME
     * - RFCTYPE_INTx
     * - RFCTYPE_FLOAT
     * - RFCTYPE_BCD
     * - RFCTYPE_DECFxx

Which are exactly the same as in RfcGetBytes:

     * - RFCTYPE_BYTE
     * - RFCTYPE_XSTRING
     * - RFCTYPE_CHAR
     * - RFCTYPE_NUM
     * - RFCTYPE_DATE
     * - RFCTYPE_TIME
     * - RFCTYPE_INTx
     * - RFCTYPE_FLOAT
     * - RFCTYPE_BCD
     * - RFCTYPE_DECFxx
huysentruitw commented 2 years ago

Question: do you still see the need for the SapBufferLengthAttribute after this change? I understand that it procudes one call less to RFC, but I wonder if people would bother to pass a size if it works without attribute too?

campersau commented 2 years ago

The SapBufferLengthAttribute is still used for CharField but I think we can change that to GetXString too since it also supports chars. Not sure about its encoding though... But after that the SapBufferLengthAttribute isn't needed. Only if you care about one less RFC call. (I don't 😄 )