FM HRCM_STRING_TO_AMOUNT_CONVERT
Hello,
I can´t find the FM HRCM_STRING_TO_AMOUNT_CONVERT anywhere..
Can somebody post the coding please.
Thanks.
cheers,
André
Hi,
the conversion is great but not that what I really want
My Problem:
I have a attribute type string and have to display it in a text(!) field with country specific thousand seperators.
The country specefic setting I get from the attribute dcpfm in table usr01.
But how can I insert dots (US) or commas (Europe) at every 3rd place from right in the string (depnding on the strings length)?
exampl. value of string: 99888777666
country specific display: 99.888.777.666
kind regards,
André
Similar Messages
-
Function module :amount _convert_string
hi to all
plz help me in this issue,
when iam using this fm for EUR it is woking fine but when taking other country currencies it is run time error t0 203. our standrads are for ISK no decimals and for other correncies 2 decimal places.plz help me in this issue r there any other fm which will solve my issue.
thanks & regards
zeenath
Message was edited by: Zeenath UnnisaTry fm HRCM_STRING_TO_AMOUNT_CONVERT
For more details, check
Converting Char type to currency -
Hello All, an urgent issue:- Currency Format
Hello All,
I created one program which download & printed the report after selecting the correspondence Radio button.
While I am downloading the file on local system it will download as .txt file format & while I select the radio button printed report it will do it for correspondence invoice number.
My issue is.
In output I have few currency values in diff field. Now User want those value should come in this format (1.000.000,00) every time.
So is there any function module which can convert the currency value format which user want? Or do I have to do some coding, if yes then what it should be.
Because here user want whatever system format should be but value come in that format only in both condition either downloading the file or printed one.Sonu,
Try with below example.
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'
Don't forget to reward if useful.... -
Character type to currency type conversion
hi all,
i need to transfer the character type data to the currency type data.
my requirement is when i am trying to transfer the data from excel i need to store it as a character. again i need to change the same as currency. any pointers will be highly appriciated.
thanks.Hi use the belwo function module and first move the currecy field to character..and inthe out put table decclare field as character 20 ..and download the field..
hope will works..
Amount to string:
CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'
EXPORTING
betrg = w_curerency "currency field
WAERS = 'DKK'
IMPORTING
STRING = slam . "Output table field type char20
String to amount:
CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
EXPORTING
string = slam2 "character field
DECIMAL_SEPARATOR = '.'
THOUSANDS_SEPARATOR =
WAERS = 'HUF'
IMPORTING
BETRG = b2 . "converting into currency field
Prabhudas -
Hello everyone,
Is there any generalised function module which would convert one unit values to others....i have tried UNIT_CONVERSION_SIMPLE...but wen testing it is showing invalid_input exception...
thanks,
kiran.Hai kiran,
There are Several Function Module...
Check out there functionality as per your requirement...
· CONVERSION_FACTOR_GET
With this function module, you determine the conversion factors for the conversion of a measurement unit into another using the measurement units table. This does not apply to measurement units within a dimension.
The module also returns the number of decimal places to which the values in the unit UNIT_OUT are to be rounded. This also applies to units with no dimension.
The following formula applies for the conversion:
(value in the unit UNIT_OUT) = (value in the unit UNIT_IN) * numerator/denominator + additive constant.
· ROUND
With this function module, you round a value to the specified number of decimal places. You can choose between three rounding types:
- Rounding up
- Rounding down
- Commercial rounding
The rounding is performed internally with the same field type as that of the field passed.
Rounding errors can thus occur when rounding a FLOAT value. If you want a high degree of accuracy, the passed field should have the type P.
· SI_UNIT_GET
You pass either a unit or a dimension to this function module to get the SI unit. If you pass both a unit and a dimension, the SI unit for the dimension is returned.
· UNIT_CONVERSION_WITH_FACTOR
With this function module, you convert a value according to the factor passed.
· UNIT_CORRESPONDENCE_CHECK
With this function module, you can check whether the two units passed belong to the same dimension.
· UNIT_GET
With this function module, you get the appropriate measurement unit for the specified dimension and conversion factor.
· UNIT_CONVERSION_SIMPLE
With this function module, you convert a value using the measurement unit table, and round it, if appropriate.
You can also perform the rounding without conversion.
Conversion with this function module requires that the measurement unit table is maintained for both units, and that both units belong to the same dimension, i.e. also that they have dimensions.
The rounding can, however, also be performed for units which have no dimension.
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
Do Reward Points to replies if found useful...
Regards,
Srikanth. -
Hi,
i have a doubt. the value of currency(1,649.20) in excel file. how can we convert in to number(1649.20) into internal table.how can we write the code for this in abap program. pls, anybody send me the reply ASAP..
Thanks & Regards,
sunil.,Hi this will work 4 u.
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'
with regards,
Hema Sundara.
pls give points if this helps u. -
How to convert CHAR14 to TYPE P ?
Dear Experts,
due to a dump "CONVERSION_ERROR" I look for a way how to convert CHAR14 values (e.g. 70,12345678) to a target field TYPE P (e.g. 70,123) whereas the value than sould be rounded to exact value 70,125.
Does anyone know a workaround ?
Best regards,
PeterHi ,
use the Fm...
String to amount:
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
Prabhudas -
Converting Normal field into amount field
Hello Gurus,
I need urgent help.
I want to conver the Normal field into Amount filed.
DATA : AMOUNT(13),
DATA : WRBTR LIKE BSEG-WRBTR.
So I want TO Convert Normal field into amount field.
This is urgent. please help me.
Thanks in advance.
Best Regards,
zuberaHi,
Use FM HRCM_STRING_TO_AMOUNT_CONVERT
pass the char(amount) and decimal separator, thousand separator.
you get the char converted to amount/currency
Regards,
Satish -
Convert Amount to different format
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
ChKHi 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
Maybe you are looking for
-
Unable to bind portlet parameter with page parameter in webcenter portal
Hi All, I am trying to bind portlet parameter with the page parameter so that I can ahieve some business requirements. Here is what I did, In my Portlet producer application: 1) Created standards based portlet (jsr 286) with view.jspx and edit.jspx w
-
MAC loses IP address on Reboot and when goes into sleep
We have a couple macs running on a corporate network with a Cisco infrastructure. Windows servers on the back end providing DHCP. Macs are connected to Cisco 3500 or 3700 series switches. When the macs go to sleep or stand by mode or even sometimes a
-
Firmed planned order creates a type of firmed horizon
Hi Gurus, we had following system behavior the other day (actually a few months ago) that we weren't able to explain. It was beginning of November and a colleague of mine was creating his production schedule for the week before x-mas (i.e. another 7
-
ISE delete command 80 character limitation
Hello Guys, one of our customers did a backup to local disk on the ISE. Later he tried to remove the file on the ISE node by running the delete command. Unfortunately the name of the file exceeded the 80 character limitation of the CLI delete command
-
Email is different on iphone than computer
hey all, i am new to the iphone 3g and i have a hotmail account, when i delete an email from my iphone it doesnt delete it on my computer and vice versa, can someone please in lamens terms tell me how to fix this?