<?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 Problem in Uploading Data using a Tab Separated File? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data-using-a-tab-separated-file/m-p/4574308#M1079333</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to upload a file which tab separated containing customer and bank details and my file structure somewhat in the following manner.&lt;/P&gt;&lt;P&gt;10	21169	abcde	xyz	kdHDHLk	gdh	ghgah  (Customer Details)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20	21169	DE	20050000	01122334  (bank details for customer 21169)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20	21169	DE	23022200	1122334455&lt;/P&gt;&lt;P&gt;(bank details for customer 21169)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20	21169	DE	23984899	223344556    (bank details).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I am trying to intial upload the details to an internal table using GUI_upload FM and display to check if it is loading correctly or not it is not giving me any o/p. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am copying the code which I am trying to execute. Please tell me what way I need to modify the code so that it executes correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters: p_file type rlgrap-filename.


data: begin of wa_file,
      text(256) type c,
      end of wa_file.


data: it_file like table of wa_file.

types: begin of ty_kna1,
       kunnr type kunnr,
       name1 type name1,
       sortl type sortl,
       stras type stras,
       ort01 type ort01,
       land1 type land1,
       spras type spras,
       end of ty_kna1.

data: it_kna1 type standard table of ty_kna1,
      wa_kna1 type ty_kna1.


types: begin of ty_knbk,
       kunnr type kunnr,
       banks type knbk-banks,
       bankl type knbk-bankl,
       bankn type knbk-bankn,
       end of ty_knbk.

data: it_knbk type standard table of ty_knbk,
      wa_knbk type ty_knbk.

data: v_id(2).



At Selection-Screen on Value-Request for p_file.

CALL FUNCTION 'F4_FILENAME'
 EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
 IMPORTING
   FILE_NAME           = p_file
          .


Start-of-Selection.

data: p_file1 type string.

      p_file1 = p_file.


CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = p_file1
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  TABLES
    DATA_TAB                      = it_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
*   OTHERS                        = 17
          .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

constants: c_tab type X value '09'.

loop at it_file into wa_file.

if wa_file+0(2) = '10'.

split wa_file at 'c_tab'
          into v_id
               wa_kna1-kunnr
               wa_kna1-name1
               wa_kna1-sortl
               wa_kna1-stras
               wa_kna1-ort01
               wa_kna1-land1
               wa_kna1-spras.

append wa_kna1 to it_kna1.

elseif wa_file+0(2) = '20'.

split wa_file at 'c_tab'
       into v_id
            wa_knbk-kunnr
            wa_knbk-banks
             wa_knbk-bankl
             wa_knbk-bankn.
append wa_knbk to it_knbk.
endif.
endloop.

write:/ 'Customer Master General Data'.

uline.

loop at it_kna1 into wa_kna1.

write:/ wa_kna1-kunnr,
         wa_kna1-name1,
               wa_kna1-sortl,
               wa_kna1-stras,
               wa_kna1-ort01,
               wa_kna1-land1,
               wa_kna1-spras.

 endloop.

 clear wa_kna1.
 skip 2.

 write:/ 'Customer Master Bank Data'.

 uline.

 loop at it_knbk into wa_knbk.

 write:/ wa_knbk-kunnr,
         wa_knbk-banks,
         wa_knbk-bankl,
         wa_knbk-bankn.
 endloop.

 clear wa_knbk.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Sep 2008 06:27:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-26T06:27:37Z</dc:date>
    <item>
      <title>Problem in Uploading Data using a Tab Separated File?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data-using-a-tab-separated-file/m-p/4574308#M1079333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to upload a file which tab separated containing customer and bank details and my file structure somewhat in the following manner.&lt;/P&gt;&lt;P&gt;10	21169	abcde	xyz	kdHDHLk	gdh	ghgah  (Customer Details)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20	21169	DE	20050000	01122334  (bank details for customer 21169)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20	21169	DE	23022200	1122334455&lt;/P&gt;&lt;P&gt;(bank details for customer 21169)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20	21169	DE	23984899	223344556    (bank details).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I am trying to intial upload the details to an internal table using GUI_upload FM and display to check if it is loading correctly or not it is not giving me any o/p. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am copying the code which I am trying to execute. Please tell me what way I need to modify the code so that it executes correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters: p_file type rlgrap-filename.


data: begin of wa_file,
      text(256) type c,
      end of wa_file.


data: it_file like table of wa_file.

types: begin of ty_kna1,
       kunnr type kunnr,
       name1 type name1,
       sortl type sortl,
       stras type stras,
       ort01 type ort01,
       land1 type land1,
       spras type spras,
       end of ty_kna1.

data: it_kna1 type standard table of ty_kna1,
      wa_kna1 type ty_kna1.


types: begin of ty_knbk,
       kunnr type kunnr,
       banks type knbk-banks,
       bankl type knbk-bankl,
       bankn type knbk-bankn,
       end of ty_knbk.

data: it_knbk type standard table of ty_knbk,
      wa_knbk type ty_knbk.

data: v_id(2).



At Selection-Screen on Value-Request for p_file.

CALL FUNCTION 'F4_FILENAME'
 EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
*   FIELD_NAME          = ' '
 IMPORTING
   FILE_NAME           = p_file
          .


Start-of-Selection.

data: p_file1 type string.

      p_file1 = p_file.


CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    FILENAME                      = p_file1
   FILETYPE                      = 'ASC'
   HAS_FIELD_SEPARATOR           = 'X'
*   HEADER_LENGTH                 = 0
*   READ_BY_LINE                  = 'X'
*   DAT_MODE                      = ' '
* IMPORTING
*   FILELENGTH                    =
*   HEADER                        =
  TABLES
    DATA_TAB                      = it_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
*   OTHERS                        = 17
          .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

constants: c_tab type X value '09'.

loop at it_file into wa_file.

if wa_file+0(2) = '10'.

split wa_file at 'c_tab'
          into v_id
               wa_kna1-kunnr
               wa_kna1-name1
               wa_kna1-sortl
               wa_kna1-stras
               wa_kna1-ort01
               wa_kna1-land1
               wa_kna1-spras.

append wa_kna1 to it_kna1.

elseif wa_file+0(2) = '20'.

split wa_file at 'c_tab'
       into v_id
            wa_knbk-kunnr
            wa_knbk-banks
             wa_knbk-bankl
             wa_knbk-bankn.
append wa_knbk to it_knbk.
endif.
endloop.

write:/ 'Customer Master General Data'.

uline.

loop at it_kna1 into wa_kna1.

write:/ wa_kna1-kunnr,
         wa_kna1-name1,
               wa_kna1-sortl,
               wa_kna1-stras,
               wa_kna1-ort01,
               wa_kna1-land1,
               wa_kna1-spras.

 endloop.

 clear wa_kna1.
 skip 2.

 write:/ 'Customer Master Bank Data'.

 uline.

 loop at it_knbk into wa_knbk.

 write:/ wa_knbk-kunnr,
         wa_knbk-banks,
         wa_knbk-bankl,
         wa_knbk-bankn.
 endloop.

 clear wa_knbk.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;MD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2008 06:27:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data-using-a-tab-separated-file/m-p/4574308#M1079333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-26T06:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Uploading Data using a Tab Separated File?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data-using-a-tab-separated-file/m-p/4574309#M1079334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Declare Class cl_abap_char_utilities&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use File type as 'DBF'&lt;/P&gt;&lt;P&gt;Has_field_seperator = w_tab in FM GUI_UPLOAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;STRONG&gt;w_tab&lt;/STRONG&gt; TYPE c VALUE cl_abap_char_utilities=&amp;gt;horizontal_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'GUI_DOWNLOAD'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    BIN_FILESIZE                    =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      filename                        = w_file&lt;/P&gt;&lt;P&gt;   filetype                        = 'DBF'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    append                          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   write_field_separator           = &lt;STRONG&gt;w_tab&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data_tab                        = it_extractchar&lt;/P&gt;&lt;P&gt;   fieldnames                      = it_header&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   file_write_error                = 1&lt;/P&gt;&lt;P&gt;   no_batch                        = 2&lt;/P&gt;&lt;P&gt;   gui_refuse_filetransfer         = 3&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;   OTHERS                          = 22&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2008 06:34:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data-using-a-tab-separated-file/m-p/4574309#M1079334</guid>
      <dc:creator>former_member585060</dc:creator>
      <dc:date>2008-09-26T06:34:34Z</dc:date>
    </item>
  </channel>
</rss>

