Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Currency

Former Member
0 Likes
475

what is currency factoring technique

2 REPLIES 2
Read only

Former Member
0 Likes
440

Hi,

The amount value(defined as currency) will be dependent on currency key. that's why currency field should have a reference field of type currency key.

Based on the currency key value the no of decimals values will be determined. Please refer TCURC table to get infomation about currency key.

To do currency translations, we are using many function modules.Some of the important function modules are:

BAPI_CURRENCY_CONV_TO_EXTERNAL : Conversion of Currency Amounts into External Data Format

BAPI_CURRENCY_CONV_TO_INTERNAL :Conversion of Currency Amounts into Internal Data Format

CURRENCY FACTORING TECHNIQUES

Check this one

http://help.sap.com/saphelp_46c/helpdata/en/eb/1373a343c411d1896f0000e8322d00/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/04/c3dc097a35d111950d0060b03c6b76/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/eb/13736a43c411d1896f0000e8322d00/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/12/08594d470311d1894a0000e8323352/frameset.htm

REGARDS

Read only

Former Member
0 Likes
440

Hi

Currency Conversion:

______________________

Use the function module

CONVERT_TO_LOCAL_CURRENCY

Writing currency amount to string without thousands seperator

This is usefull e.g. i connection with batch input/call transaction.

  • GI_OUTPUT-WRBTR: Field type Currency with amount

  • L_AMOUNT_STRING: Field type c with amount

PERFORM AMOUNT_TO_STRING USING GI_OUTPUT-WRBTR

CHANGING L_AMOUNT_STRING.

FORM AMOUNT_TO_STRING USING P_AMOUNT

CHANGING P_AMOUNT_STRING.

DATA L_SEP(1) TYPE C.

PERFORM GET_THOUSAND_SEPERATOR USING L_SEP.

WRITE P_AMOUNT TO P_AMOUNT_STRING.

REPLACE L_SEP WITH ' ' INTO P_AMOUNT_STRING.

CONDENSE P_AMOUNT_STRING NO-GAPS.

WRITE P_AMOUNT_STRING TO P_AMOUNT_STRING RIGHT-JUSTIFIED.

ENDFORM.

FORM GET_THOUSAND_SEPERATOR USING P_SEP.

DATA: L_AMOUNT LIKE BSEG-DMBTR,

L_AMOUNT_STRING(15) TYPE C.

  • Find 1000 seperator. If decimal seperator = . then

  • 1000 seperator = , else 1000 seperator = .

L_AMOUNT = '1.00'.

WRITE L_AMOUNT TO L_AMOUNT_STRING.

IF L_AMOUNT_STRING CS ','.

P_SEP = '.'.

ELSE.

P_SEP = ','.

ENDIF.

ENDFORM.

Convert amount to/from string

CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'

EXPORTING

betrg = 3000

WAERS = 'DKK'

  • NEW_DECIMAL_SEPARATOR =

  • NEW_THOUSANDS_SEPARATOR =

IMPORTING

STRING = slam

.

CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'

EXPORTING

string = slam2

DECIMAL_SEPARATOR = '.'

  • THOUSANDS_SEPARATOR =

WAERS = 'HUF'

IMPORTING

BETRG = b2

  • EXCEPTIONS

  • CONVERT_ERROR = 1

  • OTHERS = 2

Language depending formatting

To format a currency amount with decimals according to the currency use

WRITE and the CURRENCY option.

Currency keys an d numbers of decimals are defined in table TCURX Decimal

Places in Currencies.

E.G.

Formatting an amount in Kuwatian Dinars:

Dmbtr = 123456.

Write dmbtr currency 'KUD'

123.456

Write dmbtr currency 'USD'

1234.56

Note that the formatting does not depend on the number of decimals in the

number in the program.

Dmbtr = '12.3456'.

Write dmbtr currency 'USD'

1234.56

To format the decimal and thousand sepearators according to the settings for

a specific country,

use the statement SET COUNTRY <country key>

Settings for countries are defined in table T005 Countries.

The country key used in the statement is field LAND1

E.g.

set country 'US'

Regards

Anji