Fields separated by comma using GUI_DOWNLOAD

Hi All,
  I want to download internal table data separated by comma.
I am using GUI_DOWNLOAD function module.
I am using separator as comma,but still the data is getting downloaded as Tab delimited.
Please let me know what needs to be done.
Thanks,
SP
<thread moved, has nothing to do with ABAP Objects. Please choose your forums more carefully in future>
Edited by: Mike Pokraka on Aug 18, 2008 3:09 PM

Hi,
Check this sample code,
TYPES:
  BEGIN OF type_itab1,
    string TYPE string,
  END OF type_itab1.
DATA:
  BEGIN OF itab OCCURS 0,
    vbeln  LIKE vbap-vbeln,
    posnr  LIKE vbap-posnr,
  END OF itab.
DATA:
   wa_itab TYPE type_itab1,
   itab1   TYPE STANDARD TABLE OF type_itab1.
SELECT vbeln
       posnr
    UP TO 5 ROWS
  FROM vbap
  INTO TABLE itab.
SORT itab.
DELETE ADJACENT DUPLICATES FROM itab COMPARING ALL FIELDS.
LOOP AT itab.
  CONCATENATE itab-vbeln
              itab-posnr
         INTO wa_itab-string
         SEPARATED BY ','.
  APPEND wa_itab TO itab1.
ENDLOOP.
CHECK sy-subrc EQ 0.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = 'D:\temp\test.txt'
WRITE_FIELD_SEPARATOR = ','
FILETYPE = 'ASC'
CHANGING
DATA_TAB = itab1.
Regards
Adil

Similar Messages

  • Column contents separated by commas using a select

    Hi,
    My SQL query output looks like this
    Host Name IP Address List Primary Address
    IEGMEUDUB--01R     135.32.248.132          135.32.248.132
    IEGMEUDUB--01R     135.42.164.54          135.32.248.132
    IEGMEUDUB--01R     135.42.165.198     135.32.248.132
    IEGMEUDUB--01R     139.96.195.254     135.32.248.132
    But I want to have in below format.
    I want to see the output in single line.That is instead of repeating the same rows,I want to separate them with commas.When the host name is repeated ,I want to separate the IP Address List column by commas.
    Output should look like below.
    Host Name IP Address List Primary Adderss
    IEGMEUDUB--01R     135.32.248.132,135.42.164.54,135.42.165.198     135.32.248.132
    Is it possible? Please advise.
    Thanks in advance.
    Regards
    Jack

    Wrong forum; SQL Developer is a tool. You want SQL And PL/SQL...
    K.

  • How to get some character as a field separator while in GUI_DOWNLOAD ?

    Hi Friends,
    I have to download data from an internal table to a text file. The field separator
    between the fields should be comms (,). So, after getting the data into internal table i'm calling the Function Module GUI_DOWNLOAD. Now using this function module can i insert a comma spearator between the fields, if not what is the other way to do it?

    Hi,
    Its not possible to give the field separator as ',' directly with gui_download from you internal table.
    Below is the example through which you can achieve the following,
    this is a tested program and is working fine on the system....
    so you can use the logic to achieve the following result.... hope this logic helps you to achieve your functionality....
    DATA:
    BEGIN OF fs,
       col1(6) TYPE c,
       col2(4) TYPE c,
       col3 TYPE c,
       END OF fs.
    DATA :
    BEGIN OF line,
    line(255) TYPE c,
    END OF line.
    DATA: itab LIKE TABLE OF fs,
          itab2 LIKE TABLE OF line.
    DEFINE m_tab.
      clear fs.
      fs-col1 = &1.
      fs-col2 = &2.
      fs-col3 = &3.
      append fs to itab.
    END-OF-DEFINITION.
    m_tab '006000' '0010' 'J'.
    m_tab '006000' '0010' 'J'.
    m_tab '006000' '0010' 'M'.
    m_tab '006000' '0010' 'M'.
    m_tab '006000' '0010' 'O'.
    m_tab '006000' '0010' 'O'.
    m_tab '006000' '0010' 'T'.
    m_tab '006000' '0010' 'T'.
    LOOP AT itab INTO fs.
      CONCATENATE fs-col1
                  fs-col2
                  fs-col3
             INTO line
    SEPARATED BY ','.
      APPEND line TO itab2.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                    =
        filename                        = 'C:\filename.txt'
    *   FILETYPE                        = 'ASC'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    *   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *   SHOW_TRANSFER_STATUS            = ABAP_TRUE
    * IMPORTING
    *   FILELENGTH                      =
      TABLES
        data_tab                        = itab2
    *   FIELDNAMES                      =
    EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       OTHERS                          = 22
    IF sy-subrc <> 0.
      WRITE sy-subrc.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Siddarth

  • How to get field separator in flat file using GUI_DOWNLOAD function

    hi,
    how to get field separator in flat file using GUI_DOWNLOAD function.
                                    thanking you.

    Hi,
      Use WRITE_FIELD_SEPARATOR = 'X'.
      Check this sample code
    REPORT  z_file_download.
    DATA: w_name(90) TYPE c.
    DATA:
      BEGIN OF fs_flight,
        carrid   LIKE sflight-carrid,
        connid   LIKE sflight-connid,
        fldate   LIKE sflight-fldate,
        price    LIKE sflight-price,
        currency LIKE sflight-currency,
      END OF fs_flight.
    DATA:
      BEGIN OF fs_head,
        carrid(10) TYPE c,
        connid(10) TYPE c,
        fldate(10) TYPE c,
        price(10) TYPE c,
        curr(10) TYPE c,
      END OF fs_head.
    DATA:
      t_head LIKE
       TABLE OF
             fs_head.
    DATA:
      t_flight LIKE
         TABLE OF
               fs_flight.
    fs_head-carrid = 'CARRID'.
    fs_head-connid = 'CONNID'.
    fs_head-fldate = 'FLDATE'.
    fs_head-price  = 'PRICE'.
    fs_head-curr   = 'CURRENCY'.
    APPEND fs_head TO t_head.
    SELECT-OPTIONS:
      s_carrid FOR fs_flight-carrid.
    START-OF-SELECTION.
      SELECT carrid
             connid
             fldate
             price
             currency
        FROM sflight
        INTO TABLE t_flight
       WHERE carrid IN s_carrid.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        filename                      = 'D:\flight.xls'
       FILETYPE                      = 'ASC'
    *   APPEND                        = ' '
        WRITE_FIELD_SEPARATOR         = 'X'
    *   HEADER                        = '00'
    *   TRUNC_TRAILING_BLANKS         = ' '
    *   WRITE_LF                      = 'X'
    *   COL_SELECT                    = ' '
    *   COL_SELECT_MASK               = ' '
    *   DAT_MODE                      = ' '
    *   CONFIRM_OVERWRITE             = ' '
    *   NO_AUTH_CHECK                 = ' '
    *   CODEPAGE                      = ' '
    *   IGNORE_CERR                   = ABAP_TRUE
    *   REPLACEMENT                   = '#'
    *   WRITE_BOM                     = ' '
    * IMPORTING
    *   FILELENGTH                    =
      tables
        data_tab                      = t_head
    EXCEPTIONS
       FILE_WRITE_ERROR              = 1
       NO_BATCH                      = 2
       GUI_REFUSE_FILETRANSFER       = 3
       INVALID_TYPE                  = 4
       NO_AUTHORITY                  = 5
       UNKNOWN_ERROR                 = 6
       HEADER_NOT_ALLOWED            = 7
       SEPARATOR_NOT_ALLOWED         = 8
       FILESIZE_NOT_ALLOWED          = 9
       HEADER_TOO_LONG               = 10
       DP_ERROR_CREATE               = 11
       DP_ERROR_SEND                 = 12
       DP_ERROR_WRITE                = 13
       UNKNOWN_DP_ERROR              = 14
       ACCESS_DENIED                 = 15
       DP_OUT_OF_MEMORY              = 16
       DISK_FULL                     = 17
       DP_TIMEOUT                    = 18
       FILE_NOT_FOUND                = 19
       DATAPROVIDER_EXCEPTION        = 20
       CONTROL_FLUSH_ERROR           = 21
       OTHERS                        = 22
    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                = 'D:\flight.xls'
          filetype                = 'ASC'
          append                  = 'X'
          write_field_separator   = 'X'
        TABLES
          data_tab                = t_flight
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc EQ 0.
        MESSAGE 'Download successful' TYPE 'I'.
      ENDIF.
      IF sy-subrc <> 0.
    *  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • GUI_DOWNLOAD field separator

    I am trying to use GUI_DOWNLOAD. Is there a way to separate the columns by comma (,) instead of TAB?
    Thanks.

    I think you shouldn't use dynamic table to transfer data to GUI_DOWNLOAD, but you use a table which has only string field ( 2000 char long).
    Perhaps you can use a dynamic table to get data to transfer to file:
    DATA => DYNAMIC TABLE => FILE TABLE => FM GUI_DOWNLOAD.
    So your code could be like this:
    DATA: T_FILE(2000) OCCURS 10 WITH HEADER LINE.
    FIELD-SYMBOLS: <FS_TABLE> TYPE TABLE,
                   <FS_VALUE> TYPE ANY.
    DATA: LENGHT TYPE I.
    DATA WORK_AREA TYPE REF TO DATA.
    FIELD-SYMBOLS: <FS_WA> TYPE ANY.
    Before you should insert the records into your dynamic * table:
    ASSIGN MY_TABLE->* TO <FS_TABLE>.
    Create a work area
    CREATE DATA WORK_AREA LIKE LINE OF <FS_TABLE>.
    ASSIGN WORK_AREA->* TO <FS_WA>
    Append record:
    LOOP AT GT_FIELDCAT INTO LS_FIELDCAT.
      ASSIGN COMPONENT LS_FIELCAT-FIELDMANE
                         OF STRUCTURE <FS_WA> TO <FS_VALUE>.
      <FS_VALUE> = ........
    ENDLLOP.
    APPEND <FS_WA> TO <FS_TABLE>.
    after you can transfer records into file table:
    LOOP AT  <FS_TABLE> ASSIGNING <FS_WA>.
    LOOP AT GT_FIELDCAT INTO LS_FIELDCAT.
      ASSIGN COMPONENT LS_FIELCAT-FIELDMANE
                         OF STRUCTURE <FS_WA> TO <FS_VALUE>.
      WRITE <FS_VALUE>(LS_FIELCAT-outputlen)
                        TO T_FILE+LENGHT.
      LENGHT = LENGHT + LS_FIELCAT-outputlen.
      WRITE ','  TO T_FILE+LENGHT.
      LENGHT = LENGHT + 1.
    ENDLLOP.
    ENDLOOP. 
    APPEND T_FILE.
    But why don't you directly use T_FIEL without dynamic table?
    Other solution can be to build a dynamic table including separator field:
    *==================================[ create_table ]===
    FORM create_table.
    data: ls_fieldcat type lvc_s_fcat.
    v_repid = sy-repid.
    refresh gt_fieldcat.
    ===========static fields===
    ls_fieldcat-fieldname = 'P_OBJID'. "For Parent Object ID
    ls_fieldcat-ref_table = 'P0002'.
    ls_fieldcat-ref_field = 'PERID'.
    ls_fieldcat-coltext = 'P_OBJID'.
    ls_fieldcat-outputlen = 8.
    append ls_fieldcat to gt_fieldcat.
    ls_fieldcat-fieldname = 'OBJID'. "For Object ID
    ls_fieldcat-ref_table = 'P0002'.
    ls_fieldcat-ref_field = 'PERID'.
    ls_fieldcat-coltext = 'OBJID'.
    ls_fieldcat-outputlen = 8.
    append ls_fieldcat to gt_fieldcat.
    *=======================================[ dynamic fields ]===
    *compare with current_type -- the current object type
    write: /, 'add dynamic field types: '.
    loop at it_han into wa_han.
    loop at field_table.
    if field_table-my_field = wa_han-field.
    field_table_flag = 0.
    exit.
    endif.
    endloop.
    if field_table_flag = 0.
    field_table_flag = 1.
    else.
    append wa_han-field to field_table.
    ls_fieldcat-fieldname = wa_han-field.
    ls_fieldcat-ref_table = wa_han-table_name.
    ls_fieldcat-ref_field = wa_han-field.
    ls_fieldcat-coltext = wa_han-field.
    ls_fieldcat-outputlen = 50.
    append ls_fieldcat to gt_fieldcat.
    write:wa_han-field.
    endif.
    endloop.
    ls_fieldcat-fieldname = 'P_OTYPE'. "For Parent Object Type
    ls_fieldcat-ref_table = 'P0001'.
    ls_fieldcat-ref_field = 'OTYPE'.
    ls_fieldcat-coltext = 'P_OTYPE'.
    ls_fieldcat-outputlen = 1.
    append ls_fieldcat to gt_fieldcat.
    ls_fieldcat-fieldname = 'FILL1'. " Field for comma
    ls_fieldcat-DATATYPE  = 'C'.
    ls_fieldcat-outputlen = 1.
    append ls_fieldcat to gt_fieldcat.
    ls_fieldcat-fieldname = 'PLVAR'. "For Plan Version
    ls_fieldcat-ref_table = 'p1000'. " not in pa0000 - pa0020
    ls_fieldcat-ref_field = 'PLVAR'.
    ls_fieldcat-coltext = 'PLVAR'.
    ls_fieldcat-outputlen = 2.
    append ls_fieldcat to gt_fieldcat.
    ls_fieldcat-fieldname = 'FILL2'. " Field for comma
    ls_fieldcat-DATATYPE  = 'C'.
    ls_fieldcat-outputlen = 1.
    append ls_fieldcat to gt_fieldcat.
    ls_fieldcat-fieldname = 'OTYPE'. "For Object Type
    ls_fieldcat-ref_table = 'P0001'.
    ls_fieldcat-ref_field = 'OTYPE'.
    ls_fieldcat-coltext = 'OTYPE'.
    ls_fieldcat-outputlen = 1.
    append ls_fieldcat to gt_fieldcat.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING it_fieldcatalog = gt_fieldcat
    IMPORTING ep_table = gp_table
    exceptions
    generate_subpool_dir_full = 1
    others = 2.
    if sy-subrc <> 0.
    endif.
    ASSIGN gp_table->* to <gt_table>.
    ENDFORM. "create_table method
    FIELD-SYMBOLS: <FS_TABLE> TYPE TABLE,
                   <FS_VALUE> TYPE ANY.
    DATA: LENGHT TYPE I.
    DATA WORK_AREA TYPE REF TO DATA.
    FIELD-SYMBOLS: <FS_WA> TYPE ANY.
    Before you should insert the records into your dynamic * table:
    ASSIGN MY_TABLE->* TO <FS_TABLE>.
    Create a work area
    CREATE DATA WORK_AREA LIKE LINE OF <FS_TABLE>.
    ASSIGN WORK_AREA->* TO <FS_WA>
    Append record:
    LOOP AT GT_FIELDCAT INTO LS_FIELDCAT.
      ASSIGN COMPONENT LS_FIELCAT-FIELDMANE
                         OF STRUCTURE <FS_WA> TO <FS_VALUE>.
      if LS_FIELCAT-FIELDMANE(4) = 'FILL'.
       <FS_VALUE> = ','.
      ELSE.  
      <FS_VALUE> = ........
      ENDIF.
    ENDLLOP.
    APPEND <FS_WA> TO <FS_TABLE>.

  • How to use Space as field Separator?

    I have a flat file with space (multiple spaces between different fields) as a delimiter. Whenever I try to upload the file it doesn't allow me to perform. In the external tab when i chose CSV file and do not give any value in the file separator, it just pops up an information box '00H not allowed as a separator' and when I try to use ASCII /hex value '0040' still get the same message. The problem is, file is coming from 3rd party and they don't want to change the separator as comma or tab delimited CSV file.
    1) Is there any program which I can use in TR to convert space as coma or tab delimited and then feed the value to different fields? OR
    2) How to read the one line as one field and then feed to multiple fields?
    3) Any other solution/idea?
    please help me out.
    Thanks,

    Hi Mau,
         Goto you Flatfile Datasource -> Extraction Tab -> Data Format (CSV) -> Data Seperator -> ' ' ( ie. space ).
         It will consider the space as the seperator.
         Hope it helps you.
         Assign points if it helps you.
    Regards,
    Yokesh.

  • How to use two "field separator" in the same Comunication Channel

    Hi experts,
    I  upload flat files with XI, and my Comunication Channel is configured to use the field separator "~".
    FILA.fieldSeparator     ~
    Is posible to configure that Comunication Channel to accept two field separator. I want that upload flat files that has as separator "~" and flat files that has "|" .
    thanks
    regards

    IT IS not possible to have 2 fieldseparator to identify the fields of a record.

  • Issue in conversion of output file from alv to csv file using GUI_DOWNLOAD

    hi,
    I am using GUI_DOWNLOAD to convert the internal table that am getting as the output of an alv into a csv(comma separated file) file.I am using the following code but its not generating a csv file instead it is generating a normal space delimited file.
    The code is as follows:
    data : lv_fname type string.
    lv_fname = 'C:\Users\pratyusha_tripathi\Desktop\status8.csv'. " Provide the file path & file name with CSV extention
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = lv_fname " File name including path, give CSV as extention of the file
    FILETYPE = 'DAT'
    WRITE_FIELD_SEPARATOR = '#' " Provide comma as separator
    tables
    data_tab = ITAB " Pass the Output internal table
    FIELDNAMES =
    EXCEPTIONS
    OTHERS = 22
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Kindly let me know what changes can be made to make my code work.Also can GUI_download be used for batch processing and storing the output in application server?
    Thanks ,
    Pratyusha

    Hi,
    the short text description for WRITE_FIELD_SEPARATOR is "Separate Columns by Tabs in Case of ASCII Download", so why do you expect a comma?
    Try SAP_CONVERT_TO_CSV_FORMAT and then download.
    And no, GUI_DOWNLOAD is only for download via SAP GUI to a users computer.
    Best regards,
    Oliver

  • Field Separator in GUI_UPLOAD

    Hi,
         I need to upload a tab delimited excel file . I am using FM GUI_DOWNLOAD.What are Filetype and Field Separator.
    Regards,
    Divyanshu

    Hi Divyanshu,
    It may be better to use the class method to future proof your development (which incidentally calls GUI_UPLOAD anyway). Consider the following code:
      data: i_file type standard table of t_file.
      call method cl_gui_frontend_services=>gui_upload
        exporting
          filename                = w_file
          has_field_separator     = 'X'      "Tab-delimited ASCII upload.
        changing
          data_tab                = i_file
        exceptions
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          not_supported_by_gui    = 17
          error_no_gui            = 18
          others                  = 19.
      if sy-subrc <> 0.
    *   Error handling
      endif.
    Hope this helps.
    JB

  • Download using GUI_download

    Hi all,
    i am trying to download the internal table which have 10 field, into the EXCEL file,
    at the same time i wanted into the downloaded file
    field name also appear....how can we do that,,
    while downloading its appearing in a one column,
    i want to shift the every field in different column,
    Any idea about that how i will acheive this
    Thanks for your help..
    Manish

    Hi manish,
    1. For the same purpose
       i have developed an INDEPENDENT SUBROUTINE/FORM
       in which we pass just two things :
        a) itab
        b) file name with full path
    2. It then downloads the file
       (ALONG WITH THE FIELD NAMES AT THE TOP)
      (We have to use GUI_DOWNLOAD two times,
       once for downloading data,
       and once for downloading the field names separated
        by tab)
    3. Just copy paste in new program.
    report abc.
    data : itab like table of t001 with header line.
    select * from t001 into table itab.
    perform mydownload tables itab using 'D:\t001.txt'.
    INDEPENDENT FORM
    form mydownload tables ptab using filename.
    DAta
      DATA : components     LIKE     rstrucinfo OCCURS 0 WITH HEADER LINE.
      DATA : allfields(300) TYPE c.
      DATA : fld(100) TYPE c.
      data : begin of htab occurs 0,
             allfields(300) type c,
             end of htab.
    Get component list
      CALL FUNCTION 'GET_COMPONENT_LIST'
        EXPORTING
          program    = sy-repid
          fieldname  = 'ITAB'
        TABLES
          components = components.
    construct
      LOOP AT components.
        CONCATENATE   components-compname
      CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO fld.
        CONCATENATE allfields fld INTO allfields .
      ENDLOOP.
      htab-allfields = allfields.
      append htab.
    download first field list
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          FILENAME                        = 'D:\t001.txt'
         WRITE_FIELD_SEPARATOR           = 'X'
        TABLES
          DATA_TAB                        = htab
    then download file data
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = filename
        APPEND                          = 'X'
       WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                        = ptab
      endform.
    regards,
    amit m.

  • How to use gui_download 's  filetype of 'bin'

    Hello,experts ,the detail of my problem as follows:
    I use gui_download to download the invoice data :filetype is ASC,the download file is .txt file with tab as the field 's separator.
    the internal table:i_khzl :DATA: BEGIN OF i_khzl OCCURS 0,        "ITAB OF HEAD INFO.
            fpdm(15),                      "invoice no
            tdh(15),
            khswdjh(15),                   "
            khmc type TEXT100,
           " khmc(100),                     "customer
            khdz(100),                     "
            khyh(100),                     
            bz(100),                       "
            qdhj(1),
            jmhj(1),
            fphm(18),                 
          END OF i_khzl.
    but there is not  a Chinese characters like"燊" in the codepage 8400, which result in the customer name display as wrong ,the last byte is '?', and the I download the data using filetype of BIN ,the ? of customer name is gone,but the local file  .txt the format is wrong, which the interface of the invocie system can not confirmed.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = g_fname
          filetype                = 'ASC'
          write_field_separator   = 'X'
          trunc_trailing_blanks   = 'X'
          "codepage                = '4102'
        TABLES
          data_tab                = i_khzl
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE e003 WITH g_fname.      "下载文件错误
      ENDIF.
    the bin download:
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = g_fname
          filetype                = 'BIN'
        TABLES
          data_tab                = i_khzl
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc <> 0.
        MESSAGE e003 WITH g_fname.      "下载文件错误
      ENDIF.
    THE CONTENT OF THE LOCAL TXT IS :
    ASC:
    0491052960          451281672481214     宜州市燊龙贸易有限责任公?                                         
    BIN:0491052960                    451281672481214宜州市燊龙贸易有限责任公司                                                                         
    the format of the two txt content is different, how to change the bin 's type to asc' type ?or how to use the gui_download function to solve the wrong display of the customer name?
    pls help me ,
    much appreciated.

    Dear Pradeep,
    Find the below link which explains a simple data download to excel from a table view.
    www.sapt echnical.com/Tutorials/BSP/Excel/Index.htm
    Try to avoid the way your using in the BSP application and it is abdicable to use the standard methods / class available like "cl_bsp_utility"
    Hope this will be helpful.
    Regards,
    Gokul.N
    Edited by: Gokul on Oct 8, 2009 9:57 AM

  • Sender File Adapter - Problem with field separator

    Hi,
    I want to upload a CSV file into XI.
    The file contains a text part which uses from time to time quotation marks like this:
    SD,575757,383838,N/A,XYZ,"This is a text part",7676
    But besides there are lines like this:
    SD,575757,777722,N/A,XDE,FREETEXT,7575
    Has anyone any idea how to configure the file adapter to get it recognize the quotation marks not as field separator?
    I've already tried the enclosureSign parameters but that leads to an total unconverted line.
    Is it maybe possible to customize two field separators like this:
    Structure.fieldSeparator - ,"
    Thanks for any answer,
    Christina

    No, it doesn't work.
    I've specified now:
    Structure.fieldSeparator        ,
    Structure.enclosureSign         "
    Structure.enclosureSignEscape   ""
    Every line without quotation marks is converted fine. Lines with quotation marks stay like in the original CSV file and the whole line is put into one XML tag (still comma separated).
    Also the parameter fieldContentFormatting - nothing doesn't make a difference.
    Other ideas?

  • Field Separator

    The Flat file(.txt) has 5 fields separated by vertical bars(|). this fils has to be uploaded using the FM 'UPLOAD'.
         Here the problem is, the internal table is not taking the individual field values, but it is taking the values of 2 or 3 fields into one field.
    Kindly guide me on this.
    I have also tried with 'ws_upload' and 'gui_upload'
    eg. of flat file, given below,
    500076|1003|01012005|31012005|8552000.00|8952000.00|22200|002|I
    500076|1004|01012005|31012005|2690000.00|2748000.00|88900|003|I

    Hi girish,
    1. Exactly for this purpose,
    i have developed an independent FORM
    where we give inputs
    a) file name (eg. abcd.txt)
    b) separator (eg | in your case)
    c) internal table (eg. t001)
    2. It will provide the data
    in proper format
    (no matter what the separator)
    (it can work with any kind of separator)
    3. just copy paste in new program.
    REPORT abc.
    change your table declaration and file name
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    PERFORM myupload TABLES t001 USING 'd:\t001.txt' '|'.
    BREAK-POINT.
    in debug see t001
    INDEPENDENT FORM
    FORM myupload TABLES orgtab
    USING filename separator.
    Data
    DATA : BEGIN OF itab OCCURS 0,
    myline(1000) TYPE c,
    END OF itab.
    DATA : extension(5) TYPE c.
    DATA : name(100) TYPE c.
    DATA : newfilename TYPE string.
    Step 1
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = filename
    TABLES
    data_tab = itab.
    Step 2
    LOOP AT itab.
    REPLACE ALL OCCURRENCES OF separator IN itab-myline WITH
    cl_abap_char_utilities=>horizontal_tab.
    MODIFY itab.
    ENDLOOP.
    Step 3
    DATA : path LIKE pcfile-path.
    path = filename.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    extension = extension
    name = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    invalid_drive = 1
    invalid_extension = 2
    invalid_name = 3
    invalid_path = 4
    OTHERS = 5
    Step 4
    newfilename = filename.
    REPLACE name IN newfilename WITH 'temp'.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = newfilename
    TABLES
    data_tab = itab
    FIELDNAMES =
    Step 5
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = newfilename
    has_field_separator = 'X'
    TABLES
    data_tab = orgtab.
    ENDFORM. "myupload
    3.
    regards,
    amit m.

  • Downloading in .txt format separated by comma

    Hello everyone,
    In order to download an internal table in .txt format separated by comma (,) , I am using :
    1.        SAP_CONVERT_TO_CSV_FORMAT
    2.       GUI_DOWNLOAD
    The problem is that the file downloaded is separated by ; and not comma.
    I am not passing any Filetype in GUI_DOWNLOAD and the extension is .TXT.
    I dont want to use REPLACE ALL OCCURANCES OF  before calling GUI_DOWNLOAD.
    Can someone plz suggest another way ?
    Thanks

    CONSTANTS :  c_delim TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    CONCATENATE   'Physical Inventory Document'
                    'Item '
                    'Material '
                    'Material Description'
                    'Material Group'
                    INTO wa_excel_dwnld-line
                                   SEPARATED BY c_delim.
                   APPEND wa_excel_dwnld TO it_excel_dwnld.
                   CLEAR: wa_excel_dwnld.
    LOOP AT it_output INTO wa_output.
    CONCATENATE   wa_output-iblnr
                      wa_output-zeili
                      wa_output-matnr
                      wa_output-maktx
                      wa_output-matkl  
                     INTO wa_excel_dwnld-line
                           SEPARATED BY c_delim.
        APPEND wa_excel_dwnld TO it_excel_dwnld.
    ENDLOOP.
    CLEAR wa_excel_dwnld.
    DATA: l_flname     TYPE string,
                          l_string     TYPE string.
    MOVE p_file TO l_flname.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_flname
          filetype                = 'ASC'
          write_field_separator   = '#'
        TABLES
          data_tab                = it_excel_dwnld
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
    Download in CSV if you want comma separated file.
    Revert if you need any more help.

  • Split statement separating by comma

    I am my data in tdines..........
    i am having two fields data in single line separated by comma.
    Now i moved tdlines data to V1.
    i have to use split statemnt  by using comma so that it should get in to V2 and V3
    EX:   1234a,65432a
    this is tdlines.
    i have moved that to V1.
    so V1 =  1234a,65432a
    I wanted to get
    V2 = 1234a
    V3 = 65432a
    Please tell the syntax

    split text1 at var into table it_text. " chops the string at value in "var"(put ',' in this var) and puts sequentially in table it_text(field shud b char)
    or
    split text1 at var into text1 text2 text2.   " into individual variables
    regards,
    Sumit
    Edited by: Sumit Nene on Mar 31, 2010 6:57 AM

Maybe you are looking for

  • Export sticks at 1min!!!

    thought I would make up a quick, 5 min movie in IMovie HD in effort to save time from FCP. its a very simple movie with a header and leadout. I exported it several times, using different settings, eg, MPEG4 or the stock output settings for "Web" - (t

  • How can I get file from multiple instance using file adapter

    Hi. Our system(PI7.1) have three application instances running with each physical servers. We use sender file adapter. The file data is sent to one of the servers. Now, how can I get the file using three file adater? Should I put the file "sapmnt(\us

  • Storing .jsp files in the web-inf directory

    Has anyone ever heard about storing JSP files in the web-inf directory instead of the web app root directory. Apparently it improves security. If this is so, how is the user suppose to access the jsp file since I thought that users were not able to a

  • Autoconfig erroring out in DBTier. after Cloning Patch. 6718351

    Hi All, We are on 11.5.10.2 with 9.2.0.8 fresh implementation. ADI6 Developer suite 6i patchset19 ATG RUP6 While preparing for cloning using Note 230672.1 Applied 6718351, as post patch application steps create the appsutil.zip after running the auto

  • Display settings on start up

    mac os tiger detects my dell m992 display with no problem; however, i find myself having to re-detect the display each time i restart tiger....is there a setting or backend command i need to type in terminal so i don't have to keep re-detecting my mo