Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CSV file format

Former Member
0 Likes
1,162

Hi,

I have a issue like this.

download the some materials from SAP to file which has in application server.

so the output format file should be of CSV file format.

how can format the output file can any one tell me this.

7 REPLIES 7
Read only

Former Member
0 Likes
871

use transactioN <b>CG3Y</b>

Read only

0 Likes
871

hi kishan,

in that CG3Y transaction only ASC & BIN formats are there.CSV is not there.

CSV format is I heared that comma seperator value.

can any body tell me about this.

Read only

0 Likes
871

How do I download data in my internal table in a CSV file?

1ST capture file from application server to internal table using open dataset and close data set.

Use the Function Module SAP_CONVERT_TO_CSV_FORMAT to convert the internal table into Comma separated format then download this internal table using the Function Module GUI_DOWNLOAD.

EX-

Coding -
TYPE-POOLS: truxs.
TYPES:
  BEGIN OF ty_Line,
    vbeln LIKE vbap-vbeln,
    posnr LIKE vbap-posnr,
  END OF ty_Line.
TYPES: ty_Lines TYPE STANDARD TABLE of ty_Line WITH DEFAULT KEY.
DATA: itab   TYPE ty_Lines.
DATA: itab1  TYPE truxs_t_text_data.

SELECT
  vbeln
  posnr
  UP TO 10 ROWS
  FROM vbap
  INTO TABLE itab.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
  EXPORTING
    i_field_seperator    = ';'
  TABLES
    i_tab_sap_data       = itab
  CHANGING
    i_tab_converted_data = itab1
  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.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename = 'C:TEMPtest.txt'
  TABLES
    data_tab = itab1
  EXCEPTIONS
    OTHERS   = 1.  
  

Read only

0 Likes
871

I want this file data in application server not in a presentation server.

Read only

0 Likes
871

Hi Kishan,

in the FM you specified itab1.

after this FM i need to transfer this itab1 data to application server file.but it is not moving.can you tell me about this.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

i_field_seperator = ';'

TABLES

i_tab_sap_data = itab

CHANGING

i_tab_converted_data = itab1

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc <> 0.

Read only

Former Member
0 Likes
871

Hi Kanath,

Can you use ws_download FM when ever you are trying download data into file.

In that FM filetype parameters you should specify 'CVS'.

I think it will work.

Subbu.

Read only

Former Member
0 Likes
871

Hi ....

you will mention file name with CSV.

open dataset....

TRANSFER rec TO '/usr/test.csv'.

close dataset.

Is it work.....

Pls give me replay....

Subbu.S