<?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: File handling in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936185#M387188</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  Malineedi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this one is easy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fields Amt1 and Amt2 are no text fields. If you open in text mode, only charcter fields can be transferred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amount fields in ABAP ara binary coded decimals. Starting with unicode compliance of ABAP, the system determines how many bytes are used for a character. The system does not know how to handle amount fields as text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution for you depends on the use of the output file: No problem if you use BINARY mode but this might be a problem to read the amounts because BCD (binary coded decimal) amounts pack 2 decimals into 1 byte.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise you have to convert the amounts to character fields using WRITE TO an target field of sufficient size. But then you have the problem of user-dependent settings for thousands and decimals separator. (i.e. 100,000.52 or 100.000,52).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Roll up the process from the end: What do you expect to be in the file. Then find out how to create it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 17 Feb 2007 11:44:21 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2007-02-17T11:44:21Z</dc:date>
    <item>
      <title>File handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936183#M387186</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 have a problem with writing the data into the file.&lt;/P&gt;&lt;P&gt;Please look at my code once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    p_file = '/sapuser/interface/inwork/cust_credit_exposure.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT li_output INTO wa_output.&lt;/P&gt;&lt;P&gt;    TRANSFER wa_output TO p_file.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CLOSE DATASET p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got short dump at the line 'TRANSFER wa_output TO p_file'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My output table has the following fields:&lt;/P&gt;&lt;P&gt;1)cust no&lt;/P&gt;&lt;P&gt;2)Amt1(CURR 19,2)&lt;/P&gt;&lt;P&gt;3)Amt2(CURR 19,2)&lt;/P&gt;&lt;P&gt;4)Currency&lt;/P&gt;&lt;P&gt;5) date/time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the error analysis i got this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system tried to access the file                                            &lt;/P&gt;&lt;P&gt; "/sapuser/interface/inwork/cust_credit_exposure.txt" but found that this file &lt;/P&gt;&lt;P&gt; was not opened. For this reason, it could not access the 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;Please help me in this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Feb 2007 09:21:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936183#M387186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-17T09:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: File handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936184#M387187</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;chk the ITAB is initial or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk this sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report zfile_write.
 
Parameters: d2 type localfile default '/usr/sap/TST/SYS/Data1.txt'.
 
data: itab type table of string.
data: wa type string.
 
 
start-of-selection.
 
* suppose itab has all the values.
 
if itab[] is not initial. "chk this
 
* Copy to file
  open dataset d2 for output in text mode.
  loop at itab into wa.
    transfer wa to d2.
  endloop.
  close dataset d2.

endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Feb 2007 09:28:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936184#M387187</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2007-02-17T09:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: File handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936185#M387188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  Malineedi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this one is easy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fields Amt1 and Amt2 are no text fields. If you open in text mode, only charcter fields can be transferred.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amount fields in ABAP ara binary coded decimals. Starting with unicode compliance of ABAP, the system determines how many bytes are used for a character. The system does not know how to handle amount fields as text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution for you depends on the use of the output file: No problem if you use BINARY mode but this might be a problem to read the amounts because BCD (binary coded decimal) amounts pack 2 decimals into 1 byte.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise you have to convert the amounts to character fields using WRITE TO an target field of sufficient size. But then you have the problem of user-dependent settings for thousands and decimals separator. (i.e. 100,000.52 or 100.000,52).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Roll up the process from the end: What do you expect to be in the file. Then find out how to create it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Feb 2007 11:44:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936185#M387188</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2007-02-17T11:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: File handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936186#M387189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clemens ,&lt;/P&gt;&lt;P&gt;                          Thanks for your reply. The issue is solved by taking the BINARY mode. But while writing the data to the file, the amount filed is written as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'#######' .  Please help me to solve this issue. Below is the output given for ur reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cust_no              Amt1               Amt2            Curr        Date /  Time&lt;/P&gt;&lt;P&gt;0010034544       ########`      ###########    USD       20070218/214646&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 06:03:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936186#M387189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T06:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: File handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936187#M387190</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;Change the below line and check if it works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET p_file FOR OUTPUT IN TEXT MODE&amp;lt;b&amp;gt;.    "ENCODING DEFAULT.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&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>Mon, 19 Feb 2007 06:12:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936187#M387190</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-19T06:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: File handling</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936188#M387191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;OPEN DATASET physical_file FOR OUTPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use this to open the data sets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Feb 2007 06:22:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/file-handling/m-p/1936188#M387191</guid>
      <dc:creator>sreeramkumar_madisetty</dc:creator>
      <dc:date>2007-02-19T06:22:36Z</dc:date>
    </item>
  </channel>
</rss>

