<?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 with read dataset. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209528#M1522425</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did u mean u didnt understand sy-subrc value meaning here in the code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sy-subrc value meaning for open data set&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0   File was opened. &lt;/P&gt;&lt;P&gt;8   Operating system could not open file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sy-subrc value meaning for read data set&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0   Data was read without reaching end of file. &lt;/P&gt;&lt;P&gt;4   Data was read and the end of the file was reached or there was an attempt to read after the end of the file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Aug 2010 13:46:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-08-10T13:46:49Z</dc:date>
    <item>
      <title>problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209527#M1522424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: lv_file_str TYPE string VALUE 'Z:\ECD Direct Input\YCOMMPR01_IN\test.txt' .
TYPES:BEGIN OF gty_rel_001,
   matnr1(40),
   matnr2(40),
   matnr3(40),
   END OF gty_rel_001.
DATA: gt_rel_001 TYPE TABLE OF gty_rel_001 WITH HEADER LINE.

data: lv_data type string.
OPEN DATASET lv_file_str
             FOR INPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc = 0.
  
    READ dataset lv_file_str INTO gt_rel_001.

  CLOSE DATASET lv_file_str.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont understand why ,  at open dataset-- sy-subrc  = 0.&lt;/P&gt;&lt;P&gt;at read dataset --sy-subrc = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 13:38:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209527#M1522424</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T13:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209528#M1522425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did u mean u didnt understand sy-subrc value meaning here in the code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sy-subrc value meaning for open data set&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0   File was opened. &lt;/P&gt;&lt;P&gt;8   Operating system could not open file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sy-subrc value meaning for read data set&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0   Data was read without reaching end of file. &lt;/P&gt;&lt;P&gt;4   Data was read and the end of the file was reached or there was an attempt to read after the end of the file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 13:46:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209528#M1522425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T13:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209529#M1522426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there is no data in the file... sy-subrc = 4 after read dataset statement indicates it has reached end of file...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;a href=" &lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt; "&amp;gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/frameset.htm&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 13:49:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209529#M1522426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T13:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209530#M1522427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guyz ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand what is sy-subrc = 4 , but the thing is if it reached end of the file then I should  see data in my internal table but my internal table is empty? confused..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 13:51:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209530#M1522427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T13:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209531#M1522428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then I should see data in my internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code doesnt indicate and internal table operations.&lt;/P&gt;&lt;P&gt;Firts of all check whether the file has any contents, it might also contain blank lines.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 13:55:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209531#M1522428</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-08-10T13:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209532#M1522429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;shudnt I see the data in gt_rel_001 after read dataset ?&lt;/P&gt;&lt;P&gt;The file has contents but its not uploading , i dont know why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: BrightSide on Aug 10, 2010 2:57 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 13:56:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209532#M1522429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T13:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209533#M1522430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brightside,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You internal table work area &lt;STRONG&gt;gt_rel_001&lt;/STRONG&gt; in which you are reading the data is having three fieldds where as the &lt;STRONG&gt;lv_file_str&lt;/STRONG&gt; will be on single string so in ur case work area  should have a single field (a string) in which the read can insert the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just for your reference attaching a code snippet&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    OPEN DATASET lv_filename FOR INPUT IN TEXT MODE.
    IF sy-subrc NE c_zero.
      PERFORM delete_dataset USING  pv_filepath lwa_fnames-name.
      MESSAGE e000(zcf) WITH text-058 lv_filename.
    ELSE.
      DO.
        READ DATASET lv_filename INTO lwa_filedata-text.
        IF sy-subrc NE c_zero.
          EXIT.
        ENDIF.
        APPEND lwa_filedata TO li_filedata.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 14:12:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209533#M1522430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T14:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209534#M1522431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where is your file? If it's on your PC then you need to use function module GUI_UPLOAD instead. OPEN DATASET is for files sitting on the operating system level of your application servers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 14:14:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209534#M1522431</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T14:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209535#M1522432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Files are in application server .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: BrightSide on Aug 10, 2010 3:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 14:20:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209535#M1522432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T14:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209536#M1522433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your error goes here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ dataset lv_file_str INTO gt_rel_001.  "here gt_rel_001 is a internal table, you are just moving it the header line and not appending&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 14:24:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209536#M1522433</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-08-10T14:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209537#M1522434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried it using a string and then appending but I still getting sy-subrc = 4. &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 14:33:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209537#M1522434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-10T14:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: problem with read dataset.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209538#M1522435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Just go through this code, here the contents in the file are seperated by tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*Field Symbols
  FIELD-SYMBOLS:
    &amp;lt;fs_line&amp;gt; TYPE string,
    &amp;lt;fs_comp&amp;gt; TYPE ANY.

  DATA:i_tab TYPE TABLE OF string,
       la_mvke TYPE type_mvke_wa.


  DO.

    CLEAR:wf_string,
          wa_matnr,
          wa_vkorg,
          wa_vtweg.

    READ DATASET p_rep INTO wf_string.

    IF sy-subrc NE 0.
      IF sy-index EQ 1. "No data in the file
        IF sy-batch IS INITIAL.
          MESSAGE e904 WITH 'No records in file to reprocess'.
        ELSE.
          MESSAGE s904(zf) WITH text-006 DISPLAY LIKE 'E'.
          EXIT.
        ENDIF.
      ELSE. "End of File
        CLOSE DATASET p_rep.
        EXIT.
      ENDIF.
    ENDIF.

    CLEAR : la_mvke,
            i_tab[].

    SPLIT wf_string AT
          cl_abap_char_utilities=&amp;gt;horizontal_tab
          INTO TABLE i_tab.

    LOOP AT i_tab ASSIGNING &amp;lt;fs_line&amp;gt;.
      ASSIGN COMPONENT sy-tabix OF STRUCTURE la_mvke TO &amp;lt;fs_comp&amp;gt;.
      IF sy-subrc NE 0.
        EXIT.
      ELSE.
        &amp;lt;fs_comp&amp;gt; = &amp;lt;fs_line&amp;gt;.
      ENDIF.
    ENDLOOP.

 append la_mvke to i_mvke.
clear la_mvke.

enddo.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 14:35:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-read-dataset/m-p/7209538#M1522435</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-08-10T14:35:54Z</dc:date>
    </item>
  </channel>
</rss>

