Skip to Content
0

2LIS_11_VAITM Currency Conversion CONVERT_TO_STAT_CURRENCY

Aug 01, 2017 at 11:08 AM

37

avatar image
Former Member

Hello Experts,

I am trying to convert value in Doc Currency to Stats Currency using below code in Field routine of transformation (0TAX_VALUE) using customized DS.

Same FM is used in Filed routine of Updated rule on 2LIS_11_VAITM (0NET_VALUE)

0TAX_VALUE in a DSO returns value with Doc Currency whereas

0NET_VALUE returns Value with Stats Currency.

I tried a formula on 0NET_PRICE as NETPR * KURSK it returns value in Doc Currency.

Value in all 3 methods is correct. But currency in 0TAX_VALUE and 0NET_PRICE after converting it to Stats Currency it is displaying it in Doc Currency. It is expected to display in Stats Currency.

How to achieve this?

DATA: value LIKE SOURCE_FIELDS-mwsbp.
DATA: us_rate_type LIKE SOURCE_FIELDS-kurst.

IF NOT SOURCE_FIELDS-mwsbp IS INITIAL AND
SOURCE_FIELDS-waerk NE SOURCE_FIELDS-stwae.
us_rate_type = SOURCE_FIELDS-kurst.
IF us_rate_type EQ space.
us_rate_type = 'M'.
ENDIF.
ENDIF.

IF SOURCE_FIELDS-waerk NE SOURCE_FIELDS-stwae.
CALL FUNCTION 'CONVERT_TO_STAT_CURRENCY'
EXPORTING
date = SOURCE_FIELDS-vdatu
document_amount = SOURCE_FIELDS-mwsbp
document_currency = SOURCE_FIELDS-waerk
local_currency = SOURCE_FIELDS-waerk
stat_currency = source_fields-stwae
local_rate = SOURCE_FIELDS-kursk
stat_rate = SOURCE_FIELDS-stcur
local_type_of_rate = us_rate_type
stat_type_of_rate = us_rate_type
IMPORTING
statistical_amount = value
EXCEPTIONS
local_rate_not_found = 1
stat_rate_not_found = 2.

IF sy-subrc = 0.
RESULT = value.
ELSE.
RESULT = SOURCE_FIELDS-mwsbp.
ENDIF.

ELSE.
RESULT = SOURCE_FIELDS-mwsbp.
ENDIF.

Thanks & Regards,

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers