<?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: CHECK_CHANGED_DATA: update fields with decimal places in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615456#M1569791</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Resolved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Jan 2011 06:34:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-01-18T06:34:08Z</dc:date>
    <item>
      <title>CHECK_CHANGED_DATA: update fields with decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615453#M1569788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my ALV display there is a field which can be modified. &lt;/P&gt;&lt;P&gt;While doing that I'm using CHECK_CHANGED_DATA, but it is allowing me to update numbers before the decimal places, e.g., 123.00 can be modified as 555.00. &lt;/P&gt;&lt;P&gt;But it is not allowing me to update numbers after the decimal place, e.g., 123.99 is not being modified as 123.55. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest as slowly as possible. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code snippet:&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;Declarations &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF x_share_stock, 
         chk TYPE c , 
          share_price TYPE zstock-share_price, "DEC len 13, dec 2 
          color(4), 
         field_style TYPE lvc_t_styl, 
       END OF x_share_stock. 

wa_share_stock1 TYPE x_share_stock, 
it_share_stock1_prev TYPE TABLE OF x_share_stock.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field Catalog: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;form build_catalog . 
  wa_fieldcat-fieldname   = 'CHK'. 
  wa_fieldcat-scrtext_m   = 'Check'. 
  wa_fieldcat-col_pos     = 0. 
  wa_fieldcat-outputlen   = 10. 
  wa_fieldcat-emphasize   = 'X'. 
  wa_fieldcat-key         = 'X'. 
  wa_fieldcat-edit        = 'X'. 
  wa_fieldcat-checkbox    = 'X'. 
  append wa_fieldcat to it_fieldcat. 
  clear  wa_fieldcat. 

  wa_fieldcat-fieldname = 'SHARE_PRICE'. 
  wa_fieldcat-col_pos = 3. 
  wa_fieldcat-outputlen   = 10. 
  wa_fieldcat-scrtext_m = 'Price'. 
  append wa_fieldcat to it_fieldcat. 
  clear wa_fieldcat.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Update: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WHEN 'UPDATE'. 
IF ref_grid IS INITIAL. 
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' 
          IMPORTING 
            e_grid = ref_grid. 
      ENDIF. 
      CALL METHOD ref_grid-&amp;gt;check_changed_data . 
      CALL METHOD ref_grid-&amp;gt;refresh_table_display. 
      CLEAR: v_share_out, 
             v_zshare. 
*  Read the table it_share_stock1 with first checkbox checked. 
      READ TABLE it_share_stock1 INTO wa_share_stock1 WITH KEY chk = 'X'. 
      IF sy-subrc EQ 0. 
        v_tabix = sy-tabix. 
        v_share_out = wa_share_stock1-share_out. 
        v_zshare = wa_share_stock1-zshare. 
      ENDIF. 
* Read the table it_share_stock1_prev which gives the values before EDIT. 
      READ TABLE it_share_stock1_prev INTO wa_share_stock1_prev INDEX v_tabix. 
      IF sy-subrc EQ 0. 
        v_tabix = sy-tabix. 
        v_share_out1 = wa_share_stock1_prev-share_out. 
        v_zshare_prev = wa_share_stock1_prev-zshare. 
      ENDIF. 
* Get the difference between EDITED value and Previous value 
      v_diff = v_zshare - v_zshare_prev. 
* Modify it_share_stock1 with new values for the first check box checked row. 
      wa_share_stock1-share_out  = v_share_out + v_diff. 
      IF wa_share_stock1_prev-share_price NE wa_share_stock1-share_price. 
        wa_share_stock1-share_price = wa_share_stock1-share_price * 100. 
      ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance, &lt;/P&gt;&lt;P&gt;Anirban.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Jan 17, 2011 2:27 PM - priority reduced by moderator&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 13:25:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615453#M1569788</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-17T13:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: CHECK_CHANGED_DATA: update fields with decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615454#M1569789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anirban_Mallick ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;probably  zstock-share_price is a currency field. You need to set a reference field that has the currency key or you can define the currency key hard coded in field catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does CHECK_CHANGED_DATA code look like?&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>Mon, 17 Jan 2011 18:14:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615454#M1569789</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-01-17T18:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: CHECK_CHANGED_DATA: update fields with decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615455#M1569790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem resolved.&lt;/P&gt;&lt;P&gt;Needed to modify the field catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_fieldcat-fieldname = 'SHARE_PRICE'.
  wa_fieldcat-col_pos = 3.
  wa_fieldcat-outputlen   = 13.   "Modified this line
  wa_fieldcat-decimals  = 4.      "Added this line
  wa_fieldcat-scrtext_m = 'Price'.
  append wa_fieldcat to it_fieldcat.
  clear wa_fieldcat.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers..!!&lt;/P&gt;&lt;P&gt;Anirban.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Anirban_Mallick on Jan 18, 2011 7:32 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Anirban_Mallick on Jan 18, 2011 7:33 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jan 2011 06:32:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615455#M1569790</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-18T06:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: CHECK_CHANGED_DATA: update fields with decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615456#M1569791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Resolved.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jan 2011 06:34:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-changed-data-update-fields-with-decimal-places/m-p/7615456#M1569791</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-18T06:34:08Z</dc:date>
    </item>
  </channel>
</rss>

