2013 Sep 27 9:00 AM
Hi,
I have requirement to create csv file which has two headers, one body and one trailer. First header has 5 fields. Second header has 58 fields. Body has 58 fields. Trailer has 2 fields. If i'll create 4 internal tables then can you please tell me how I can be able to append all these internal tables one by one to the csv file?. Also csv file should be separated by ^, how to do this ? Sample code would be helpful.
thanks.
2013 Sep 27 10:16 AM
Hi Abap Guy,
Create one final output table gi_output type c length 1500 (or according to urs).
gw_hearder1 - 5 fields
gw_header2 - 58 fields
gi_body - 58 fields
gw_trailer - 2 fields
first append first header
concatenate gw_headr-field1
gw_header-field2
.......
gw_header-field5
into gw_output-data seperated by <your delimiter>.
append gw_output to gi_output.
now append second header similar as above.
now loop over your main body table
loop at gi_body into gw_body.
concatenate gw_body-field1
.......
gw_body-fieldn
into gw_output-data seperated by <delimiter>
append gw_output to gi_output.
i hope this wil solve your issue.
thanks
A. trivedi
Hi,
I have requirement to create csv file which has two headers, one body and one trailer. First header has 5 fields. Second header has 58 fields. Body has 58 fields. Trailer has 2 fields. If i'll create 4 internal tables then can you please tell me how I can be able to append all these internal tables one by one to the csv file?. Also csv file should be separated by ^, how to do this ? Sample code would be helpful.
thanks.
2013 Sep 27 9:57 AM
Hi,
Have a look here:
http://scn.sap.com/servlet/JiveServlet/download/14388283-193968/y_r_eitan_test_71_01.txt.zip
http://scn.sap.com/message/14388283#14388283
Specially to FORM wrt_data_1 .
You can change cl_abap_char_utilities=>horizontal_tab to your delimeterif you want.
Regards.
2013 Sep 27 10:16 AM
Hi Abap Guy,
Create one final output table gi_output type c length 1500 (or according to urs).
gw_hearder1 - 5 fields
gw_header2 - 58 fields
gi_body - 58 fields
gw_trailer - 2 fields
first append first header
concatenate gw_headr-field1
gw_header-field2
.......
gw_header-field5
into gw_output-data seperated by <your delimiter>.
append gw_output to gi_output.
now append second header similar as above.
now loop over your main body table
loop at gi_body into gw_body.
concatenate gw_body-field1
.......
gw_body-fieldn
into gw_output-data seperated by <delimiter>
append gw_output to gi_output.
i hope this wil solve your issue.
thanks
A. trivedi
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |