<?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: regarding Open dataset in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882006#M51785</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ambichan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the answers to your questions - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. DIR_HOME is called a &amp;lt;i&amp;gt;logical filename&amp;lt;/i&amp;gt;. The OPEN DATASET expects a &amp;lt;i&amp;gt;physical finename&amp;lt;/i&amp;gt;. If you go to AL11, you will be able to see the physical filename that is associated with this logical filename. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP has provided the concept of a logical filename to make the filenames platform-independent. You should use the Function Module FILE_GET_NAME to get the physical filename. This FM has a detailed documentation. You can go through that. It also has an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If you want to write one line for each of the entries of an internal table, you would do something like this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;START-OF-SELECTION.

OPEN DATASET &amp;lt;fname&amp;gt;.

LOOP AT ITAB.
  PERFORM TRANSFER_ITAB_DATA_TO_FILE.
ENDLOOP.

CLOSE DATASET &amp;lt;fname&amp;gt;.

FORM TRANSFER_ITAB_DATA_TO_FILE.
  TRANSFER ITAB-FIELD1 TO FILE.
  TRANSFER ITAB-FIELD2 TO FILE.   
  .
  .
  .
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, whether you want to have a delimiter is something that you should decide, based on your requirement. But, in general, there would be a delimiter of some kind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Apr 2005 06:47:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-04-26T06:47:21Z</dc:date>
    <item>
      <title>regarding Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882001#M51780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two questionshere.&lt;/P&gt;&lt;P&gt;1-i want create text file in Application server.&lt;/P&gt;&lt;P&gt;  in below directory is it possible.&lt;/P&gt;&lt;P&gt;  E_FILE LIKE RLGRAP-FILENAME VALUE&lt;/P&gt;&lt;P&gt;             'DIR_HOME\payhome.txt'.&lt;/P&gt;&lt;P&gt;  (does my path will create file in this virtual direcotry) &lt;/P&gt;&lt;P&gt;2-for each loop i want to write one line&lt;/P&gt;&lt;P&gt;  in text file.&lt;/P&gt;&lt;P&gt;  should i have to include delimeter while transfer data to file or write to file.&lt;/P&gt;&lt;P&gt;  my below piece of code is correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA E_FILE LIKE RLGRAP-FILENAME VALUE&lt;/P&gt;&lt;P&gt;             'DIR_HOME\payhome.txt'.&lt;/P&gt;&lt;P&gt;OPEN DATASET E_FILE FOR OUTPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT ITAB_LIFNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; PERFORM LISTDATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;CLOSE DATASET E_FILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In PERFORM LISTDATA.&lt;/P&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;&lt;P&gt;  WRITE : / PAGENO,&lt;/P&gt;&lt;P&gt;           SUBNO,&lt;/P&gt;&lt;P&gt;           DATAKBN,&lt;/P&gt;&lt;P&gt;           ITAB_LIFNR-LIFNR,&lt;/P&gt;&lt;P&gt;           ITAB_LIFNR-NAME2(20),&lt;/P&gt;&lt;P&gt;           P_PAY_T,&lt;/P&gt;&lt;P&gt;           GLT0-TSL01,&lt;/P&gt;&lt;P&gt;           GLT0-TSL02,&lt;/P&gt;&lt;P&gt;           GLT0-TSL03,&lt;/P&gt;&lt;P&gt;           GLT0-TSL04,&lt;/P&gt;&lt;P&gt;           GLT0-TSL05 TO E_FILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;......................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;ambichan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2005 13:32:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882001#M51780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-25T13:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: regarding Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882002#M51781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please use Transfer dataset instead of Write...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer to SAP online help for more variants.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Murugesh AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2005 13:40:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882002#M51781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-25T13:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: regarding Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882003#M51782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey murugesh,&lt;/P&gt;&lt;P&gt;thanks for your reply.&lt;/P&gt;&lt;P&gt;should i have to include any delimiter while writing datas in text file?&lt;/P&gt;&lt;P&gt;if so whats that delimter(tab/,/space?)&lt;/P&gt;&lt;P&gt;how can i include one empty line in text file.&lt;/P&gt;&lt;P&gt;could you pls guide me.&lt;/P&gt;&lt;P&gt;ambichan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2005 14:02:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882003#M51782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-25T14:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: regarding Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882004#M51783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please read thro' the complete documentation,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You do have options for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; IN BINARY MODE [FOR ....].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; FOR .... IN TEXT MODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use these as per your reqmt. This is similar to the option 'DAT' and 'TXT in WS_UPLOAD / WS_DOWNLOAD. Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Murugesh AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2005 14:19:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882004#M51783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-25T14:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: regarding Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882005#M51784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use a tab delimiter:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CONSTANTS: LIT_TAB_CHAR TYPE X VALUE '09'.
...
...
DATA: BEGIN OF GSTR_MATERIAL,
        MATNR LIKE MARA-MATNR,
        TAB01 LIKE LIT_TAB_CHAR,
        MAKTG LIKE MAKT-MAKTG,
      END OF GSTR_MATERIAL.

...
...
* now transfer your internal table
OPEN DATASET PC_FILEPATH FOR OUTPUT IN TEXT MODE.

LOOP AT ITAB_MATERIAL.
  TRANSFER ITAB_MATERIAL TO PC_FILEPATH.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Apr 2005 14:37:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882005#M51784</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-25T14:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: regarding Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882006#M51785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ambichan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the answers to your questions - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. DIR_HOME is called a &amp;lt;i&amp;gt;logical filename&amp;lt;/i&amp;gt;. The OPEN DATASET expects a &amp;lt;i&amp;gt;physical finename&amp;lt;/i&amp;gt;. If you go to AL11, you will be able to see the physical filename that is associated with this logical filename. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP has provided the concept of a logical filename to make the filenames platform-independent. You should use the Function Module FILE_GET_NAME to get the physical filename. This FM has a detailed documentation. You can go through that. It also has an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If you want to write one line for each of the entries of an internal table, you would do something like this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;START-OF-SELECTION.

OPEN DATASET &amp;lt;fname&amp;gt;.

LOOP AT ITAB.
  PERFORM TRANSFER_ITAB_DATA_TO_FILE.
ENDLOOP.

CLOSE DATASET &amp;lt;fname&amp;gt;.

FORM TRANSFER_ITAB_DATA_TO_FILE.
  TRANSFER ITAB-FIELD1 TO FILE.
  TRANSFER ITAB-FIELD2 TO FILE.   
  .
  .
  .
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, whether you want to have a delimiter is something that you should decide, based on your requirement. But, in general, there would be a delimiter of some kind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand Mandalika.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Apr 2005 06:47:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-open-dataset/m-p/882006#M51785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-26T06:47:21Z</dc:date>
    </item>
  </channel>
</rss>

