Showing results for 
Search instead for 
Did you mean: 

Retrieve a CSV file by API: only first row is retrieved

0 Kudos

Hi experts,

I'm trying to retrieve a csv file from a rest API, but when the body is retrieved I have only the first row of csv. Below how I do, where is the mistake? (with Postman is ok)

Many thanks in advance.

example of csv


0008000141,COMPANY 1 S.P.A.,IT0201124,IT,PD,Padova,35020,"VIA test, 2"


go_http_client->request->set_header_fields( fields = lt_header_fields ).

go_http_client->request->set_method( if_http_request=>co_request_method_get ).



gv_response = go_http_client->response->get_cdata( ).

here I have only the first row





Active Contributor
0 Kudos
If it "doesn't work" in ABAP, it's because the request is different. Take the full Postman request and do the same in ABAP. If you don't know, post the Postman request here.
View Entire Topic
Former Member
0 Kudos

8000 char is a too long string and if you try to break down to 132 chars each there will be around 60 columns for you to store data in.

If you are OK with having 60 columns then you can have a check in each column on length and use substring function to populate that.

Column 1 - ifthenelse(length(source_column) > 132, SUBSTR(source_column,1,132), SUBSTR(source_column, 1, length(source_column)) )

Column 2 - ifthenelse(length(source_column) > 132*2, SUBSTR(source_column,132+1,132*2), SUBSTR(source_column, 132+1, length(source_column)) )

Column 3 - ifthenelse(length(source_column) > 132*3, SUBSTR(source_column,132*2 + 1,132*3), SUBSTR(source_column, (132*2)+1, length(source_column)) )

....and so on.

Alternatively you might want to have a look at Pivot Transform for your task.

0 Kudos

Hey Shubham,

Thanks a lot for the solution. It did help me.

Request you to look into extension to this scenario in my reply to Dirk (above).

Please share your inputs whatever you can suggest. It'll be really appreciable.



Former Member
0 Kudos

Suggestions given by Dirk above are just perfect.