Hi
I need to Convert amount 36.00 to 3600 for JPY
Using below FM to conversion.
CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
EXPORTING
CURRENCY = CNS_JPY
AMOUNT_INTERNAL = FLD_DRSEG-WRBTR
IMPORTING
AMOUNT_EXTERNAL = L_V_BAPICURR.
L_V_BAPICURR Displays value as 3600.0000
How to convert to 3600 without decimal places.
I searched thru forum. could not find any Function module to do this.
Can you please indicate the FM to convert like this.
my TCURX table has JPY as 0 value.
Regards
After conversion by the BAPI, try
DATA: L_V_BAPICURR_TEXT(20) TYPE c. WRITE L_V_BAPICURR DECIMALS 0 NO-GROUPING TO L_V_BAPICURR_TEXT.
Hi
Thanks for your reply.
Actually i want to display in Screen which has field WRBTR with P (13) decimal 2. not using Write statement.
Can you telll me how to do in case of Screen display.
Regards
Edited by: princeck on Nov 24, 2011 5:26 AM
Hi
Since my display field in Dynpro screen is WRBTR (P 13 Decimal 2).
It displays only decimal.
How usually people handle this scenario. Pls confirm.
Regards
Chandra
Hi,
try this way,
pass the vales of wrbtr into some temp field then use "replace all occurrences of '.' " in that temp field with empty space i.e
replace all occurrences of '.' in temp with ' '.
Hope it will be solved.
Thanks and Regards,
koolspy.
Hello Koolspy
Thanks for your reply.
Actually i am using like this
L_WRBTR TYPE I,
CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
EXPORTING
CURRENCY = CNS_JPY
AMOUNT_INTERNAL = FLD_DRSEG-WRBTR " here my value is 36.00
IMPORTING
AMOUNT_EXTERNAL = L_V_BAPICURR. " here my value is 3600.0000
L_WRBTR = L_V_BAPICURR. 'here L_WRBTR value is 3600
MOVE L_WRBTR TO FLD_TC_LIV-WRBTR.
But in Dynpro screen(WRBTR TYPE CURR P 13 Decimal 2), it displays as follows
3600.00
Does your answer will make changes from above? pls advice
Regards
chandra
Hi
I tried above too, Looks like what ever i send data to my addon dynpro screen(WRBTR field)
it converts to decimal and display.
Should i have to declare WRBTR display field as CHAR or INTEGER?
Pls advice
Please check this sample code one
data: test type wrbtr value 3 . data: one type string. one = test. replace all occurrences of '.00' in one with ' '. write:/ one.
Hope you understood.
Regards,
koolspy.
Hello koolspy
Thanks for your intense support.
Your way works for me to convert 3600.0000 to 3600, when i confirm in debug mode.
But after that, i am passing this value to Screen display field DRSEG_WRBTR CURR 13 Decimal 2
So its always displaying as 3,600.00 with decimal.
If i display the value with string as you said, its ok, but when i display it in DRSEG_WRBTR it changes to decimal value.
How to declare the amount in display format?
Pls advice
Hello koolspy
Thanks for your intense support.
Your way works for me to convert 3600.0000 to 3600, when i confirm in debug mode.
But after that, i am passing this value to Screen display field DRSEG_WRBTR CURR 13 Decimal 2
So its always displaying as 3,600.00 with decimal.
If i display the value with string as you said, its ok, but when i display it in DRSEG_WRBTR it changes to decimal value.
How to declare the amount in display format?
Pls advice
Hi,
you mentioned {DRSEG_WRBTR CURR 13 Decimal 2}
but, did you try using this
DRSEG_WRBTR CURR 13 Decimal 0.
Regards,
koolspy.
Hi koolspy
Thanks for your reply
DRSEG_WRBTR CURR 13 Decimal 0.
works for me if JPY currency.
But i am worried what happens if USD instead of JPY.
JPY has no decimals but USD has decimals.. how to handle here with respect to currency?
Regards
Edited by: princeck on Nov 24, 2011 9:47 AM
Hi
No it can't do it.
The table TCURX is to indicate if a currency needs a decimal part, then the system converts the amount from/to internal/external format in according to the hit of TCURX.
This logic is not only for display the amount in the right format, but also to save the amount in the SAP table where the amount field has two decimal.
So if a currency doesn't need the decimal part (like JPY), the decimals number of a field for amount would be never used:
so SAP divides the amount for 100 to avoid it.
That explains as 3600 JPY are saved as 36.00
But this rule is valid for currencies with several decimal number (more than 2), only the amount will be divided or multiplied for different numbers:
For example:
- If currency needs 1 decimal number, the amount is saved divided by 10;
- if currency needs 3 decimal number: the amount is saved multiplied by 10;
- and so....
Max
Hi Max
thanks for your reply.
So how generally Amount is displayed in Addon Dynpro program?
In addon program definitely Amount field will have decimal format if we assing WRBCTR as CURR type?
Pls advice how to handle this generally..
Regards
Hi guys
Problem solved by adding WAERS field along with WRBTR.
No need of any conversion..externally...
Regards
Chandra
thanks