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

Convert Amount to different format

Former Member
0 Likes
2,855

Hi,

Please help me know a the FM to convert data in the following way

i/p: 2510.15

o/p:+00000000251015

i/p: -12.45

o/p:+00000000124500

Thanks & Regards

ChK

7 REPLIES 7
Read only

Former Member
0 Likes
1,419

Hi Harsha,


CURRENCY_AMOUNT_SAP_TO_IDOC - Convert currency to IDOC format

CONVERT_TO_LOCAL_CURRENCY  - Conversion of currency

HRCM_AMOUNT_TO_STRING_CONVERT - Convert amount to string

HRCM_STRING_TO_AMOUNT_CONVERT - Convert amount from string

CLOI_PUT_SIGN_IN_FRONT Move the negative sign from the left hand side of a number, to the right hand side of the number. Note that The result will be left justified (like all 
character fields), not right justifed as numbers normally are. 
 
CONVERT_TO_FOREIGN_CURRENCY Convert local currency to foreign currency. 

CONVERT_TO_LOCAL_CURRENCY Convert from foreign currency to local currency 

Another as per your Requirement...


Language Dependent Formatting of Amount and Currency
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.

Example 1: 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

Regards,

Prabhudas

Read only

Former Member
0 Likes
1,419

dear use this funtion module

HR_NZ_ROUNDING_DECIMALS

rgds ankit

Read only

Former Member
0 Likes
1,419

Multiply the value by 100 and use FM CONVERSION_EXIT_ALPHA_INPUT

Read only

Former Member
0 Likes
1,419

Use the FM CONVERSION_EXIT_ALPHA_INPUT to get leading zeroes for the variable

Read only

Former Member
0 Likes
1,419

You requirement seems to be weird !

how do you distinguish between negative and positvie numbers.

Can you specify the requirement precisely

Regards,

Lalit Mohan Gupta.

Read only

Former Member
0 Likes
1,419

Hi,

Use this functionmodule to convert it into string

HRCM_AMOUNT_TO_STRING_CONVERT

and then use CONVERSION_EXIT_ALPHA_INPUT

to keep leading zeros

Regards

Krishna

Read only

Former Member
0 Likes
1,419

Acheived the result using various string operations.