2023 Oct 06 3:07 PM
Hello. I need desperately your help because I have stuck. The requirement is the following:
They want to create a Rest WS that it will be called any time they want from an external application, they will pass some parameters, the WS will select the data from SAP depending on the importing parameters and it will return the ITAB in a CSV format with some other returning information data. Because the data in the majority will be more than 80000 records they want to split the results in more than 1 csv files.
Is there anyone who implement a REST WS like the above, to include in its response except some other data (message, date etc) and multiple files?
I will be much obliged if someone can help me.
Thanks
Elias
2023 Oct 06 3:20 PM
Well, the proposed solution is weird. You'd better do the same as OData i.e. the requestor requests the number of lines they want (e.g. top and skip "parameters"). Or they should be able to split themselves the 80000 records.
If you still want to continue with multiple files returned, you can use a multipart response with a boundary to separate the CSV files:
e.g. response body:
Content-Type: multipart/mixed;
boundary="----_=_NextPart_001_01CAAA37.2647E86A"
This is a multi-part message in MIME format.
------_=_NextPart_001_01CAAA37.2647E86A
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hello,
please find attached a document
Bye
------_=_NextPart_001_01CAAA37.2647E86A
Content-Type: text/csv; name="file1.csv"
Content-Transfer-Encoding: base64
Content-Description: file1.csv
e1xydGYxXGFkZWZ...
------_=_NextPart_001_01CAAA37.2647E86A
Content-Type: text/csv; name="file2.csv"
Content-Transfer-Encoding: base64
Content-Description: file2.csv
e1xydGYxXGFkZWZ...
2023 Oct 09 9:32 AM
One possible solution. But always check with the WS consumer (client) if they would be able to consume WS like this.
Another way would be using ?offset=8000 => you send lines 8000-16000.