2008 Jul 15 9:38 PM
Hi,
I have a requirement where I have to concatenate all the fields of an internal table with a comma separated and need to send the same to app server as a comma separated file.
Please let me know the function module to achieve the same with a small sample code with 3 fields.
All useful answers wud be rewarded. <= read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] here as well!
Regards,
Vishnu
Edited by: Julius Bussche on Jul 15, 2008 8:50 PM
2008 Jul 15 9:48 PM
Look at this example:
TYPE-POOLS: truxs.
DATA: BEGIN OF IT_TABLE1 OCCURS 0,
field1 LIKE table-field1,
field2 LIKE table-field2,
field3 LIKE table-field3,
END OF IT_TABLE1.
DATA: IT_TABLE2 TYPE truxs_t_text_data.
*After filling the table IT_TABLA1 with data
*Convert the table to CSV
CALL FUNCTION u2018SAP_CONVERT_TO_CSV_FORMATu2019
EXPORTING
i_field_seperator = u2018,u2019
TABLES
i_tab_sap_data = IT_TABLE1
CHANGING
i_tab_converted_data = IT_TABLE2
EXCEPTIONS
conversion_failed = 1
others = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Downloading the table
CALL FUNCTION u2018GUI_DOWNLOADu2019
EXPORTING
filename = u2018C:\table.txtu2019
TABLES
data_tab = IT_TABLE2
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6.
2008 Jul 15 9:49 PM
> Re: Comma separated file ..very urgent <= read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] here as well!
Please read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] before posting.
There are not many rules, but they are good ones and we enforce them.