<?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: Problem in uploading data... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261540#M147822</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dharmesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can code something like this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report zztest01.
 
Parameters: file1 type localfile default '/usr/sap/test/file1.txt'.
            
 
data: begin of i_input occurs 0,
      rec(100) type c,
      end of i_input.

data: wa_input(100) type c.
 

data: begin of i_smssale occurs 0,
      rec(100) type c,
      end of i_smssale.


data: begin of i_smsser occurs 0,
      rec(100) type c,
      end of i_smsser.

 
start-of-selection.
 
  open dataset file1 for input in text mode.
  
  if sy-subrc = 0.
    do.
      read dataset file1 into wa_input.
      if sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      endif.
      
      i_input-rec = wa_input.
      append i_input.

    enddo.
  endif.

  close dataset file1.

  loop at i_input.
    if i_input-rec(7) = 'SMSSALE'.
      i_smssale-rec = i_input-rec.
      append i_smssale.  
    endif.

    if i_input-rec(6) = 'SMSSER'.
      i_smsser-rec = i_input-rec.
      append i_smsser. 
    endif. 

    ...

  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Mar 2006 04:51:18 GMT</pubDate>
    <dc:creator>ferry_lianto</dc:creator>
    <dc:date>2006-03-28T04:51:18Z</dc:date>
    <item>
      <title>Problem in uploading data...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261537#M147819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to upload a file from one Server to SAP Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The text file data like under&amp;#133;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="18" type="ul"&gt;&lt;P&gt; Text file data.  ******************&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;SMS&amp;gt;&lt;/P&gt;&lt;P&gt;SMSSALE	10139	9890304217	4/12/2006	001US206&lt;/P&gt;&lt;P&gt;        aswedfrtghy	Anki	98786543213	&lt;/P&gt;&lt;P&gt;SMSSALE	10139	9890304217	4/12/2006	001GS102&lt;/P&gt;&lt;P&gt;        ghtyujikiuytrewer	cccc	98765432123	&lt;/P&gt;&lt;P&gt;SMSSER	10139	9890304217	4/12/2006	001MC616&lt;/P&gt;&lt;P&gt;        gtyh7890987	Accident Service	Anoop	9890500038	&lt;/P&gt;&lt;P&gt;SMSSER	10139	9890304217	4/12/2006	001US206&lt;/P&gt;&lt;P&gt;        dfrtghyujki	Paid Service	llll	97654321234	&lt;/P&gt;&lt;P&gt;&amp;lt;/SMS&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**********************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, when the SMSType is SMSSALE then I have to transfer (upload) into different table &amp;amp; if  SMSType is SMSSER then to different table&amp;#133; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how would I have to write procedure for it&amp;#133; or what process I have to do for this&amp;#133;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reply with coading&amp;#133;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dharmesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Mar 2006 04:33:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261537#M147819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-28T04:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in uploading data...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261538#M147820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dharmesh,&lt;/P&gt;&lt;P&gt;Do you mean to upload the file into different internal table depending on the contents of the file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better upload to an internal table and then seperate the details from that itab into your desired internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Wenceslaus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Mar 2006 04:36:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261538#M147820</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-28T04:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in uploading data...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261539#M147821</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;Upload the file using GUI_UPLOAd:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Move the contents into a final internal table say gt_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then based on gt_itab-&amp;lt;SMStype&amp;gt; split the contents into two internal tables gt_itab1 and gt_itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gayathri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Mar 2006 04:42:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261539#M147821</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-28T04:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in uploading data...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261540#M147822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dharmesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can code something like this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report zztest01.
 
Parameters: file1 type localfile default '/usr/sap/test/file1.txt'.
            
 
data: begin of i_input occurs 0,
      rec(100) type c,
      end of i_input.

data: wa_input(100) type c.
 

data: begin of i_smssale occurs 0,
      rec(100) type c,
      end of i_smssale.


data: begin of i_smsser occurs 0,
      rec(100) type c,
      end of i_smsser.

 
start-of-selection.
 
  open dataset file1 for input in text mode.
  
  if sy-subrc = 0.
    do.
      read dataset file1 into wa_input.
      if sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      endif.
      
      i_input-rec = wa_input.
      append i_input.

    enddo.
  endif.

  close dataset file1.

  loop at i_input.
    if i_input-rec(7) = 'SMSSALE'.
      i_smssale-rec = i_input-rec.
      append i_smssale.  
    endif.

    if i_input-rec(6) = 'SMSSER'.
      i_smsser-rec = i_input-rec.
      append i_smsser. 
    endif. 

    ...

  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Mar 2006 04:51:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261540#M147822</guid>
      <dc:creator>ferry_lianto</dc:creator>
      <dc:date>2006-03-28T04:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in uploading data...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261541#M147823</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;1.Declare the internal table .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS P_FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\test.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : G_FILE1 TYPE STRING,&lt;/P&gt;&lt;P&gt;       itab1 type standard table of db1,&lt;/P&gt;&lt;P&gt;       itab2 type standard table of db2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF T_INPUT OCCURS 0, " Flat file data&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declare the fields in character according to the data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       SMSType(10) type c,&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;  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;*Error message&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Loop the internal table and find out the SMStype.&lt;/P&gt;&lt;P&gt;   loop at t_input.&lt;/P&gt;&lt;P&gt;      if t_input-smstype = 'SMSSALE'.&lt;/P&gt;&lt;P&gt;         move-corresponding t_input to itab1.&lt;/P&gt;&lt;P&gt;         append t_input to itab1.&lt;/P&gt;&lt;P&gt;      else.&lt;/P&gt;&lt;P&gt;         move-corresponding t_input to itab2.&lt;/P&gt;&lt;P&gt;         append t_input to itab2.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;   endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.Insert the values in two database tables.&lt;/P&gt;&lt;P&gt;     insert db1 from table itab1.&lt;/P&gt;&lt;P&gt;     insert db2 from table itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS:Take care of data types conversion if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly reward points by clicking the star on the left of reply,if it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Mar 2006 05:20:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-uploading-data/m-p/1261541#M147823</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-03-28T05:20:09Z</dc:date>
    </item>
  </channel>
</rss>

