<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: tab delimited text file in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149129#M116971</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GUI_UPLOAD works the same as WS_UPLOAD. Giev the HAS_FIELD separator option to upload DAT files&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shobana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jan 2006 09:41:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-01-09T09:41:04Z</dc:date>
    <item>
      <title>tab delimited text file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149126#M116968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can gui_upload be used to upload a tab delimited text file. if yes, then how the data that is uploaded can be split at the delimiter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 09:33:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149126#M116968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-09T09:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: tab delimited text file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149127#M116969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;Check the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope This Info Helps YOU.&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Reward Points If It Helps YOU.&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghav&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS: p_infile  LIKE rlgrap-filename
                        OBLIGATORY DEFAULT  '/usr/sap/'..

*DATA: ld_file LIKE rlgrap-filename.
DATA: gd_file type string.

*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
    name1 LIKE pa0002-vorna,
    name2 LIKE pa0002-name2,
    age   TYPE i,
    END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
      wa_record TYPE t_record.

*Internal table to upload data into
DATA: BEGIN OF it_datatab OCCURS 0,
  row(500) TYPE c,
 END OF it_datatab.

*Text version of data table
TYPES: BEGIN OF t_uploadtxt,
  name1(10) TYPE c,
  name2(15) TYPE c,
  age(5)  TYPE c,
 END OF t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.


*String value to data in initially.
DATA: wa_string(255) TYPE c.

CONSTANTS: con_tab TYPE x VALUE '09'.

*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:

*class cl_abap_char_utilities definition load.
*constants:
*    con_tab  type c value cl_abap_char_utilities=&amp;gt;HORIZONTAL_TAB.




************************************************************************
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
  CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
            def_filename     = p_infile
            mask             = ',*.txt.'
            mode             = 'O'
            title            = 'Upload File'(078)
       IMPORTING
            filename         = p_infile
       EXCEPTIONS
            inv_winsys       = 1
            no_batch         = 2
            selection_cancel = 3
            selection_error  = 4
            OTHERS           = 5.


************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.
  gd_file = p_infile.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = gd_file
      has_field_separator     = 'X'  "file is TAB delimited
    TABLES
      data_tab                = it_record
    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
      OTHERS                  = 17.
    IF sy-subrc NE 0.
      write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
      skip.
    endif.

* Alternative method, where by you split fields at each TAB after you 
* have returned the data. No point unless you dont have access to 
* GUI_UPLOAD but just included for information  
*
*  CALL FUNCTION 'GUI_UPLOAD'
*       EXPORTING
*            filename        = gd_file
*            filetype        = 'ASC'
*       TABLES
*            data_tab        = it_datatab  "ITBL_IN_RECORD[]
*       EXCEPTIONS
*            file_open_error = 1
*            OTHERS          = 2.
*  IF sy-subrc NE 0.
*  ELSE.
*    LOOP AT it_datatab.
*      CLEAR: wa_string, wa_uploadtxt.
*      wa_string = it_datatab.
*      SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
*                                      wa_uploadtxt-name2
*                                      wa_uploadtxt-age.
*      MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
*      APPEND wa_record TO it_record.
*    ENDLOOP.
*  ENDIF.
 

************************************************************************
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD

* Display report data for illustration purposes
LOOP AT it_record INTO wa_record.
  WRITE:/     sy-vline,
         (10) wa_record-name1, sy-vline,
         (10) wa_record-name2, sy-vline,
         (10) wa_record-age, sy-vline.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 09:39:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149127#M116969</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-09T09:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: tab delimited text file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149128#M116970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You just upload the entire line as a single variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say str is the variable containing your line item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can split it in 2 ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The easiest way is &lt;/P&gt;&lt;P&gt;SPLIT STR AT ' ' INTO ITAB.(an internal table or structure).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you know the length of each individual field you can split like say FIELD1 = STR+2(10) which would give the 10 characters starting from third character and so on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 09:40:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149128#M116970</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-09T09:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: tab delimited text file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149129#M116971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GUI_UPLOAD works the same as WS_UPLOAD. Giev the HAS_FIELD separator option to upload DAT files&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shobana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 09:41:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149129#M116971</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-09T09:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: tab delimited text file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149130#M116972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with out splitting the file you can upload using the below FM.&lt;/P&gt;&lt;P&gt;KCD_CSV_FILE_TO_INTERN_CONVERT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this pass the filepath, delimiter as '#'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will upload the data to internaltable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 09:43:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149130#M116972</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-09T09:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: tab delimited text file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149131#M116973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the sample code.Kindly reward points by clicking the star on the left of reply,if it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data  G_FILE1 TYPE STRING.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF T_INPUT OCCURS 0, " Flat file data&lt;/P&gt;&lt;P&gt;       ...&lt;/P&gt;&lt;P&gt;      END OF T_INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  G_FILE1  = P_FILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      FILENAME                = G_FILE1&lt;/P&gt;&lt;P&gt;      FILETYPE                = 'ASC'&lt;/P&gt;&lt;P&gt;      HAS_FIELD_SEPARATOR     = 'X'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      DATA_TAB                = T_INPUT&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      FILE_OPEN_ERROR         = 1&lt;/P&gt;&lt;P&gt;      FILE_READ_ERROR         = 2&lt;/P&gt;&lt;P&gt;      NO_BATCH                = 3&lt;/P&gt;&lt;P&gt;      GUI_REFUSE_FILETRANSFER = 4&lt;/P&gt;&lt;P&gt;      INVALID_TYPE            = 5&lt;/P&gt;&lt;P&gt;      NO_AUTHORITY            = 6&lt;/P&gt;&lt;P&gt;      UNKNOWN_ERROR           = 7&lt;/P&gt;&lt;P&gt;      BAD_DATA_FORMAT         = 8&lt;/P&gt;&lt;P&gt;      HEADER_NOT_ALLOWED      = 9&lt;/P&gt;&lt;P&gt;      SEPARATOR_NOT_ALLOWED   = 10&lt;/P&gt;&lt;P&gt;      HEADER_TOO_LONG         = 11&lt;/P&gt;&lt;P&gt;      UNKNOWN_DP_ERROR        = 12&lt;/P&gt;&lt;P&gt;      ACCESS_DENIED           = 13&lt;/P&gt;&lt;P&gt;      DP_OUT_OF_MEMORY        = 14&lt;/P&gt;&lt;P&gt;      DISK_FULL               = 15&lt;/P&gt;&lt;P&gt;      DP_TIMEOUT              = 16&lt;/P&gt;&lt;P&gt;      OTHERS                  = 17.&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE E000 WITH 'Error in Upload'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2006 09:46:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tab-delimited-text-file/m-p/1149131#M116973</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-01-09T09:46:11Z</dc:date>
    </item>
  </channel>
</rss>

