sapdev logo background
sapdev logo sapdev logo

CURRENCY_AMOUNT_DISPLAY_TO_SAP sap function module to Convert currency value from display to SAP

The following code shows how CURRENCY_AMOUNT_DISPLAY_TO_SAP can be used. You pass it a Currecny code(WAERS) and the displayed currency value. It will convert the value so that it can be stored in SAP. Without using this function module the value stored in SAP is not guaranteed to be correct.

I.e. 28000 JPY is stored within SAP as 280.

*Data declaration
* WMTO_S-AMOUNT =  Type DEC :: length 15 :: Deciamls 4
parameter: p_curr   like TCURC-WAERS,     "Display currency
           p_disval like WMTO_S-AMOUNT.  "Internal Amount

data:      gd_intval  like WMTO_S-AMOUNT. "Display Amount

          currency        = p_curr
          amount_display  = p_disval
          AMOUNT_INTERNAL = gd_intval
          INTERNAL_ERROR  = 1
          OTHERS          = 2
IF sy-subrc <> 0.

* You are now able to store the return value into an SAP table.


write:/(30)  'Value Displayed on screen in SAP:', p_disval,
      /(30)  'Currency:',  p_curr,
      /(30)  'Internal SAP value', gd_intval.

Check out sap documentation and pattern details for function module currency_amount_display_to_sap on website

comments powered by Disqus