<?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: Getting Error While using WRITE TO STATEMENT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737484#M1949279</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ranjan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE TO always expects a character-like target. What you can see on screen or printed list and what you can type using the keyboard are characters. The WRITE (TO) statement implicitly uses the conversion exit of the written data converting any interbal format to character output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JPY is defined in the currency table as a value with zero decimals, so the 2 decimals you can see in the BSEG currency field are ignored when writing this value to a (char-like) output using the &lt;SPAN style="font-size: 13.3333px;"&gt;currency addition.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Only use WRITE when you want to create a readable character output, otherwise use MOVE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best you can do is describe your task in more detail, what is the expected output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Jun 2016 14:21:51 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2016-06-11T14:21:51Z</dc:date>
    <item>
      <title>Getting Error While using WRITE TO STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737483#M1949278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing an issue when ever i am writing a WRITE TO statement. my requirement is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4563 JPY will be stored in the database table BSEG as 45.63. But when this values is displayed on the screen (like FB03), system will internally convert back and display 4,563 JPY.&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;in one of my subroutine of the program while populating the output amount value(WRBTR) is being fetched from BSEG table and moved to output internal table based on currency(PSWSL).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WRITE wa_bseg-wrbtr TO wa_output-amount CURRENCY wa_bseg=pswsl.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the WRITE TO statement with CURRENCY is being written so that the system will internally convert back and shown in proper format in FB03.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after PPV reclassification, the amount 324 JPY is posted as 3 under one GL account. I need to implement the same WRITE TO CURRENCY to display in proper format. i tried to write in as follow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WRITE wa_bseg-wrbtr TO wa_currentamount-amt_doccur CURRENCY &lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;wa_bseg-pswsl.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it is throwing an error saying amt_doccur should be of type I,C,N&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;details of field &lt;STRONG&gt;amt_doccur&lt;/STRONG&gt;(data type : DEC, no of char: 23, decimal:4, total length: 30) where as details of field &lt;STRONG&gt;wa_bseg-wrbtr&lt;/STRONG&gt; is (data type: CURR, no of char:13, decimal : 2 total length : 16). how to avoid this error. or is there any function module which can convert the data type from CURR to DEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly suggest some solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;PRN&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jun 2016 10:58:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737483#M1949278</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-06-11T10:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error While using WRITE TO STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737484#M1949279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ranjan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE TO always expects a character-like target. What you can see on screen or printed list and what you can type using the keyboard are characters. The WRITE (TO) statement implicitly uses the conversion exit of the written data converting any interbal format to character output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JPY is defined in the currency table as a value with zero decimals, so the 2 decimals you can see in the BSEG currency field are ignored when writing this value to a (char-like) output using the &lt;SPAN style="font-size: 13.3333px;"&gt;currency addition.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Only use WRITE when you want to create a readable character output, otherwise use MOVE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best you can do is describe your task in more detail, what is the expected output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jun 2016 14:21:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737484#M1949279</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2016-06-11T14:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error While using WRITE TO STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737485#M1949280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ranjan,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;What is the data type of field wa_output-amount which is used in first statement ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also check this FM CURRENCY_AMOUNT_SAP_TO_DISPLAY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jun 2016 14:28:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737485#M1949280</guid>
      <dc:creator>jitendra_it</dc:creator>
      <dc:date>2016-06-11T14:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error While using WRITE TO STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737486#M1949281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;&lt;STRONG&gt;WRITE wa_bseg-wrbtr TO wa_currentamount-amt_doccur CURRENCY &lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;wa_bseg-pswsl.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;but it is throwing an error saying amt_doccur should be of type I,C,N&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Just a remark, no, it may only be a character-like data object (I (Integer) is impossible)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;details of field &lt;STRONG&gt;amt_doccur&lt;/STRONG&gt;(data type : DEC, no of char: 23, decimal:4, total length: 30) where as details of field &lt;STRONG&gt;wa_bseg-wrbtr&lt;/STRONG&gt; is (data type: CURR, no of char:13, decimal : 2 total length : 16). how to avoid this error. or is there any function module which can convert the data type from CURR to DEC.&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Your question also applies to conversion from CURR to CURR when the number of decimals of the two data objects is different. Probably (maybe I'm wrong please verify it) amt_doccur should have its value amount right aligned as for any currency amount, exactly as with BSEG-WRBTR. To make this possible, you may use the ASSIGN statement for ignoring the decimals:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS lcl_app DEFINITION.
&amp;nbsp; PUBLIC SECTION.
&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS-METHODS copy_curr_field 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IMPORTING source TYPE p 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXPORTING target TYPE p.
ENDCLASS."
CLASS lcl_app IMPLEMENTATION.
&amp;nbsp; METHOD copy_curr_field.
&amp;nbsp;&amp;nbsp;&amp;nbsp; FIELD-SYMBOLS &amp;lt;source&amp;gt; TYPE x.
&amp;nbsp;&amp;nbsp;&amp;nbsp; FIELD-SYMBOLS &amp;lt;target&amp;gt; TYPE x.
&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA soff TYPE i.
&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA toff TYPE i.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ASSIGN target TO &amp;lt;target&amp;gt; CASTING.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ASSIGN source TO &amp;lt;source&amp;gt; CASTING.
&amp;nbsp;&amp;nbsp;&amp;nbsp; IF xstrlen( &amp;lt;target&amp;gt; ) &amp;lt; xstrlen( &amp;lt;source&amp;gt; ).
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "SSSSS to TTT -&amp;gt; soff=2 and toff=0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; soff = xstrlen( &amp;lt;source&amp;gt; ) - xstrlen( &amp;lt;target&amp;gt; ).
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toff = 0.
&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "SSS to TTTTT -&amp;gt; soff=0 and toff=2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; soff = 0.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toff = xstrlen( &amp;lt;target&amp;gt; ) - xstrlen( &amp;lt;source&amp;gt; ).
&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;target&amp;gt;+toff = &amp;lt;source&amp;gt;+soff.
&amp;nbsp; ENDMETHOD."
ENDCLASS."
START-OF-SELECTION.
DATA target TYPE p DECIMALS 4.
DATA source TYPE p DECIMALS 2.
source = '45.63'.
lcl_app=&amp;gt;copy_curr_field( EXPORTING source = source IMPORTING target = target ). 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The amount of 4563 JPY is stored 45.63 in source field, and 0.4563 in target field.&lt;/P&gt;&lt;P&gt;Maybe the amount of 4563 JPY should be stored 45.6300 in your amt_doccur field, in that case you may simply use: &lt;STRONG&gt;wa_currentamount-amt_doccur = wa_bseg-wrbtr.&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;after PPV reclassification, the amount 324 JPY is posted as 3 under one GL account. I need to implement the same WRITE TO CURRENCY to display in proper format.&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I don't get what you exactly mean with "is posted as 3". Where do you see that? Is it the result of your code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Jun 2016 19:20:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737486#M1949281</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-06-11T19:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error While using WRITE TO STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737487#M1949282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's really very basic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;STRONG&gt;WRITE wa_bseg-wrbtr TO wa_currentamount-amt_doccur CURRENCY &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #333333; background: transparent; font-size: 13.3333px; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;wa_bseg-pswsl.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_currentamount-amt_doccurr is not of type C, N nor I. So to make your statement work, you must do a conversion. Exactly what the error says. So you could do:_&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;STRONG&gt;DATA doccurr type i.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;STRONG&gt;WRITE wa_bseg-wrbtr TO doccurr CURRENCY &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #333333; background: transparent; font-size: 13.3333px; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;wa_bseg-pswsl.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background: transparent; font-size: 13.3333px; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #333333; background: #ffffff; font-size: 12px;"&gt;&lt;STRONG&gt;wa_currentamount-amt_doccur = doccurr&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, possibly in 7.4+ (I've not tried it). &lt;SPAN style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;STRONG&gt;WRITE wa_bseg-wrbtr TO CONV #(wa_currentamount-amt_doccur ) CURRENCY &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #333333; background: transparent; font-size: 13.3333px; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;wa_bseg-pswsl.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, and &lt;STRONG&gt;MORE IMPORTANTLY&lt;/STRONG&gt;,&lt;STRONG&gt; &lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #ff0000; text-decoration: underline;"&gt;why&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt; are you wanting to store the converted value in your internal table. That's a very odd thing to do. Normally you only do the conversion at output. I think you're doing something wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Jun 2016 06:29:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737487#M1949282</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2016-06-12T06:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error While using WRITE TO STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737488#M1949283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clemens, Jitendra, Sandra, Matthew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your reply. Sorry for late reply as i was travelling. Issue resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Very much&lt;/P&gt;&lt;P&gt;Ranjan Nayak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2016 06:23:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-error-while-using-write-to-statement/m-p/11737488#M1949283</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-06-14T06:23:11Z</dc:date>
    </item>
  </channel>
</rss>

