Skip to Content
0
Former Member
Nov 23, 2005 at 09:55 AM

code reduction

24 Views

Hi,

I have two fields which contains JPY currency.

I want to convert into USD using function module.I have coded two times for two fields.Is there any way to write one time to get currencies for two fields?

if t_bill-WAERK ne 'USD'.

  • for JPY

if t_bill-WAERK eq 'JPY'.

t_bill-NETWR = t_bill-NETWR * 100.

endif.

*for netwr

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

CLIENT = SY-MANDT

DATE = t_bill-FKDAT

FOREIGN_AMOUNT = t_bill-NETWR

FOREIGN_CURRENCY = t_bill-WAERK

LOCAL_CURRENCY = 'USD'

IMPORTING

LOCAL_AMOUNT = v_bilamt.

*for netpr

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

CLIENT = SY-MANDT

DATE = t_bill-FKDAT

FOREIGN_AMOUNT = t_bill-NETPR

FOREIGN_CURRENCY = t_bill-WAERK

LOCAL_CURRENCY = 'USD'

IMPORTING

LOCAL_AMOUNT = v_tp.

else.

v_bilamt = t_bill-netwr.

v_tp = t_bill-netpr.

endif.

points guaranteed

cheers

kaki