<?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: OPEN DATASET code for XLS file or csv file?? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset-code-for-xls-file-or-csv-file/m-p/5563486#M1269358</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vipin ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made some changes tour code , now please check this code - -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:BEGIN OF itab OCCURS 0,
matl_type(4) TYPE c,
matl_group(9) TYPE c,
matl_desc(40) TYPE c,
char_prof(18) TYPE c,
END OF itab.

DATA:wa LIKE itab.

DATA file TYPE string VALUE `/sap/inbound/master.xls`.



OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
BREAK-POINT.
IF sy-subrc = 0.
*  WRITE:'ok'.


DO.
  READ DATASET file INTO wa.
  IF sy-subrc = 0.
    itab = wa.
    WRITE: / wa-matl_type,
    wa-matl_group,
    wa-matl_desc,
    wa-char_prof.
    APPEND itab.
  ELSE.
    EXIT.
  ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET file.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pinaki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 May 2009 10:28:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-18T10:28:04Z</dc:date>
    <item>
      <title>OPEN DATASET code for XLS file or csv file??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset-code-for-xls-file-or-csv-file/m-p/5563484#M1269356</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;Please let me know the code to read a xls or csv file from the SAP application unix server.I had written the code,but in case of xls file the output is junk values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OUTPUT:###########3 OK &amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;is coming like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:BEGIN OF itab OCCURS 0,&lt;/P&gt;&lt;P&gt;     matl_type(4)  TYPE c,&lt;/P&gt;&lt;P&gt;     matl_group(9) TYPE c,&lt;/P&gt;&lt;P&gt;     matl_desc(40) TYPE c,&lt;/P&gt;&lt;P&gt;     char_prof(18) TYPE c,&lt;/P&gt;&lt;P&gt;     END OF itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:wa LIKE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA file TYPE string VALUE `/sap/inbound/master.xls`.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BREAK-POINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET file FOR INPUT IN binary MODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  WRITE:'ok'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;  READ DATASET file INTO wa.&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    itab = wa.&lt;/P&gt;&lt;P&gt;    WRITE: / wa-matl_type,&lt;/P&gt;&lt;P&gt;             wa-matl_group,&lt;/P&gt;&lt;P&gt;             wa-matl_desc,&lt;/P&gt;&lt;P&gt;             wa-char_prof.&lt;/P&gt;&lt;P&gt;    APPEND itab.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help me to correct this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in case of cvs file,when i comes to read dataset,my subrc = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vipin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2009 10:02:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset-code-for-xls-file-or-csv-file/m-p/5563484#M1269356</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-18T10:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN DATASET code for XLS file or csv file??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset-code-for-xls-file-or-csv-file/m-p/5563485#M1269357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after reading the dataset,you have to SPLIT the data that is got from the file so that the fields&lt;/P&gt;&lt;P&gt;are placed correctly into the corresponding fields..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2009 10:21:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset-code-for-xls-file-or-csv-file/m-p/5563485#M1269357</guid>
      <dc:creator>former_member242255</dc:creator>
      <dc:date>2009-05-18T10:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN DATASET code for XLS file or csv file??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset-code-for-xls-file-or-csv-file/m-p/5563486#M1269358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vipin ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made some changes tour code , now please check this code - -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:BEGIN OF itab OCCURS 0,
matl_type(4) TYPE c,
matl_group(9) TYPE c,
matl_desc(40) TYPE c,
char_prof(18) TYPE c,
END OF itab.

DATA:wa LIKE itab.

DATA file TYPE string VALUE `/sap/inbound/master.xls`.



OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
BREAK-POINT.
IF sy-subrc = 0.
*  WRITE:'ok'.


DO.
  READ DATASET file INTO wa.
  IF sy-subrc = 0.
    itab = wa.
    WRITE: / wa-matl_type,
    wa-matl_group,
    wa-matl_desc,
    wa-char_prof.
    APPEND itab.
  ELSE.
    EXIT.
  ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET file.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pinaki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2009 10:28:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset-code-for-xls-file-or-csv-file/m-p/5563486#M1269358</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-18T10:28:04Z</dc:date>
    </item>
  </channel>
</rss>

