Skip to Content
avatar image
Former Member

CSV file

Hi,

iam uploding data from flatfile to internaltable.my flatfile is csv file and amount field also contains comma how can i handle? please provide solution.

Regards,

Suresh

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Sep 09, 2008 at 05:43 AM

    Here you change the amount filed value as it dont contain any commas. below code will work. if you still having probs then so like this. move the amount filed value to any character value and then remove those commas and then upload.

    try like this...

    TYPE-POOLS: truxs.

    TYPES:

    BEGIN OF ty_Line,

    vbeln LIKE vbap-vbeln,

    posnr LIKE vbap-posnr,

    END OF ty_Line.

    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:\TEMP\test.txt'

    TABLES

    data_tab = itab1

    EXCEPTIONS

    OTHERS = 1.

     

    Add comment
    10|10000 characters needed characters exceeded