5 Replies Latest reply: Aug 25, 2004 5:53 AM by John Smith RSS

Creating tab delimited file

John Smith
Currently Being Moderated

Hi,

 

Can anybody tell me how to create tab delimited file using ABAP. I am using 4.6C ( so I cant use cl_gui_char_utilities ) and I want to download the file to application server ( GUI_DOWNLOAD cant be used ).

 

Thanks,

Sameej

  • Re: Creating tab delimited file
    Serdar Simsekler
    Currently Being Moderated

    Hi Sameej

     

    Look at SAPHelp about <b>"OPEN DATASET"</b> and <b>"CLOSE DATASET"</b> statements for downloading files to the application server. To download to presentation layer you can use <b>"WS_DOWNLOAD"</b> at 4.6C.

     

    The FM <b>"C13Z_FILE_UPLOAD_BINARY"</b> and <b>"C13Z_FILE_DOWNLOAD_BINARY"</b> can also be used if you have them.

     

    *--Serdar

  • Re: Creating tab delimited file
    Andreas Mann
    Currently Being Moderated

    Hi,

     

    -> here's an example to separate the fields by tab:

     

    DATA: BEGIN OF tabulator,

            x(1) TYPE x VALUE '09',

          END OF tabulator.

    data tabilator_c.

    ...

      CALL FUNCTION 'SYSTEM_CODEPAGE'

           IMPORTING

                codepage = c_to.

     

      tabulator_c = tabulator.

      TRANSLATE tabulator_c FROM CODE PAGE c_from TO CODE PAGE c_to.

    ...

    *for int. table

    loop at itab.

    ...

        clear string.

        do.

          assign component sy-index of structure itab to <f>.

          IF SY-SUBRC <> 0.

            EXIT.

          ENDIF.

          concatenate string <f> tabulator_c into string.

        enddo.

     

       append string to tab_download.

     

    ...

    endloop.

    ...

     

      CALL FUNCTION 'GUI_DOWNLOAD'

           EXPORTING

                FILETYPE = 'ASC'

                FILENAME = FILE

           TABLES

                DATA_TAB = tab_download.

     

    Grx Andreas

  • Re: Creating tab delimited file
    Nablan Umar
    Currently Being Moderated

    Hi Sameet,

     

    I think Andreas has given you some good info. In short basically you need to do this.

     

    data: lv_tabfield(1) type x value '09',

          lv_str(80).

     

    ....

     

    open dataset lv_filename for output in text mode.

     

    concatenate field1 field2 field2 into lv_str separated by

           lv_tabfield.

    transfer lv_str to lv_filename.

    close dataset lv_filename.

Actions