3

I want to return binary data in ABAP, for example a PNG image file.

Which data type should I use? string, xstring, ...?

I use the PyRFC SDK: https://github.com/SAP/PyRFC

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
guettli
  • 25,042
  • 81
  • 346
  • 663
  • In ABAP, bytes are to be stored in variables of type X or XSTRING. But the answer may vary depending on the RFC SDK you use (with NCO, XSTRING variables are mapped to STRING C# variables with hexadecimal format, knowing that it's more interesting to pass bytes in base64 strings!) – Sandra Rossi May 03 '19 at 11:57
  • 1
    We are currently investigating GetByteArray in NCO, if it works then XSTRING are supported nicely even in NCO. If I understand well pyRFC, it's based on the API from NWRFCSDK, thus RfcGetBytes should do the job too. Answer: XSTRING. But that's simply a guess. – Sandra Rossi May 03 '19 at 14:31

1 Answers1

4

xstring

Sidenotes if you have large data:

  • max size of an xstring is 2GB (depending also on profile parameter ztta/max_memreq_MB)
  • If you use an internal table of xstrings (e.g. dictionary type XSTRINGS_TABLE), dynamic memory allocation is easier because it will not be requested in one go, as is the case for a flat xstring
Pilot
  • 441
  • 2
  • 9