<?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 problem with decimals in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848486#M359708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello all,&lt;/P&gt;&lt;P&gt;I am having a field that has type p decimals 1. now i need to format this field in a specific manner.&lt;/P&gt;&lt;P&gt;if the value is 4.0 then i want to output 4 and if output is 5.6 then i want to output 5.6.&lt;/P&gt;&lt;P&gt;i was wondering how to achieve the formal. I tried "shift right" but dint work; One of the possible solution is checking the last digit and if it is 0 and then is preceded by point i need to delete both of the digits. any other solutions??&lt;/P&gt;&lt;P&gt;will wait for your expert input.&lt;/P&gt;&lt;P&gt;thanks and regards,&lt;/P&gt;&lt;P&gt;Gaurav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jan 2007 14:49:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-29T14:49:30Z</dc:date>
    <item>
      <title>problem with decimals</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848486#M359708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello all,&lt;/P&gt;&lt;P&gt;I am having a field that has type p decimals 1. now i need to format this field in a specific manner.&lt;/P&gt;&lt;P&gt;if the value is 4.0 then i want to output 4 and if output is 5.6 then i want to output 5.6.&lt;/P&gt;&lt;P&gt;i was wondering how to achieve the formal. I tried "shift right" but dint work; One of the possible solution is checking the last digit and if it is 0 and then is preceded by point i need to delete both of the digits. any other solutions??&lt;/P&gt;&lt;P&gt;will wait for your expert input.&lt;/P&gt;&lt;P&gt;thanks and regards,&lt;/P&gt;&lt;P&gt;Gaurav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 14:49:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848486#M359708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T14:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: problem with decimals</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848487#M359709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i´d do following:&lt;/P&gt;&lt;P&gt;data lv_swap type i.&lt;/P&gt;&lt;P&gt;data lv_out  type c length 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_check = your_value mod 1.&lt;/P&gt;&lt;P&gt;if lv_check = 0.&lt;/P&gt;&lt;P&gt;  lv_swap = your_value.&lt;/P&gt;&lt;P&gt;  lv_out = lv_swap.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;  lv_out = your_value.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 14:54:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848487#M359709</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T14:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: problem with decimals</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848488#M359710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;given the input as 4.0 it will give 4,
       

REPORT ychatest LINE-COUNT 50.


DATA : dec TYPE p DECIMALS 1,
       dec1 TYPE p DECIMALS 1,
       dec3 TYPE i.

dec = '4.0'.

dec1 = frac( dec ).

IF dec1 EQ '0.0'.
  dec3 = dec.
ENDIF.

WRITE : dec3.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 15:05:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848488#M359710</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T15:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: problem with decimals</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848489#M359711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looked at various formatting options in the WRITE statement, but couldnt come up with any clean solution. Of course, there is a solution, it's just not clean!&lt;/P&gt;&lt;P&gt;data: v_num type p decimals 1.&lt;/P&gt;&lt;P&gt;data: v_chr(5) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_num = 4.&lt;/P&gt;&lt;P&gt;write v_num to v_chr.&lt;/P&gt;&lt;P&gt;write:/ v_chr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shift v_chr right deleting trailing space.&lt;/P&gt;&lt;P&gt;shift v_chr right deleting trailing '.0'.&lt;/P&gt;&lt;P&gt;write:/ v_chr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_num = '5.6'.&lt;/P&gt;&lt;P&gt;write v_num to v_chr.&lt;/P&gt;&lt;P&gt;write:/ v_chr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shift v_chr right deleting trailing space.&lt;/P&gt;&lt;P&gt;shift v_chr right deleting trailing '.0'.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; v_chr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OUTPUT:&lt;/P&gt;&lt;P&gt; 4.0&lt;/P&gt;&lt;P&gt;    4&lt;/P&gt;&lt;P&gt; 5.6&lt;/P&gt;&lt;P&gt;  5.6&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 15:11:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848489#M359711</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T15:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: problem with decimals</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848490#M359712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gaurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Run the below code to get u r expected result.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Report zex33.
parameter : p_d TYPE p DECIMALS 1.
DATA :
       v_d1(20) ,
       v_d2 TYPE i.

v_d1 = p_d.

search v_d1 for '.0'.
if sy-subrc eq 0.
   v_d2 = p_d.
   write : / v_d2.
else.
   v_d1 = p_d.
   write : / v_d1.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 15:25:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848490#M359712</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T15:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: problem with decimals</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848491#M359713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello all, thanks for ur kind replies.&lt;/P&gt;&lt;P&gt;florian your method works , i tried but it was tedious for me to encompass it in my program.&lt;/P&gt;&lt;P&gt;deepak : i mentioned in program that shift right is not working however thgh thanks for ur reply.&lt;/P&gt;&lt;P&gt;chandrasekhar and sreekant, ur technique works. although i used chandrakant's technique since it is based on standard function of SAP.&lt;/P&gt;&lt;P&gt;thanks once again to all of u, i have tried to give points in a fair manner, apologies if i disappoint you.&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 15:50:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-decimals/m-p/1848491#M359713</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T15:50:28Z</dc:date>
    </item>
  </channel>
</rss>

