‎2009 Mar 19 1:19 PM
hi all,
I am using BAPI_AR_ACC_GETOPENITEMS to get open items. The amount length in the bapi is (23,4). I need to convert to normal format (13,2).
If I am directly assigning the values are gettting changed
Ex:If the amount from BAPI is 12.4500
when i am assigning the value is changed to 1245.00
Can some one please help.
‎2009 Mar 19 2:23 PM
Hi Aravind,
You can use the FM BKK_AMOUNT_CONV_TO_EXTERNAL.
Based on the currency it will give you the decimals.
It will also provide rounding functionality.
e.g. if the amount is 12345.12782 and currency is INR then it will provide you the value 12345.13
Regards,
Raju.
‎2009 Mar 19 1:22 PM
get it to charcter format.
shift left deleting trailing spaces
move to trarget varaible.
‎2009 Mar 19 1:23 PM
Hi,
create two variables with CHAR type and use the command SPLIT v_amt at ' . 'and store into separately.
Then Concatenate v_char1 v_char2(2) into v_char3.
Then assign to (13,2) variable.
Regards,
Sunil
‎2009 Mar 19 1:24 PM
HI Arvind,
This is because ur BAPI parameter has 4 decimals and ur variable has 2 decimals. Assignment happens from right to left. Try by using currency with WRITE TO statement. Not sure if it solves ur problem.
If doesn't work, then try to check for some FM which does this conversion.
Thanks,
Vinod.
‎2009 Mar 19 1:28 PM
Hello Aravind,
Can you share your code as to how you are "directly assigning the values" to a variable of type (13,2) ?
I think the most correct statment for this will be:
WRITE <source_amt> TO <target_amt> CURRENCY <target_curr>Hope this helps.
BR,
Suhas
‎2009 Mar 19 2:11 PM
I am assigning in this way...
l_dmbtr = t_openitems-lc_amount.
here t_openitems is the internal table which contains the extract from bapi.
lc_amount is amount field in BAPI.
‎2009 Mar 19 2:15 PM
l_dmbtr = t_openitems-lc_amount.
l_dmbtr = l_dmbtr * 10.... to move decimal to right
l_dmbtr = ( l_dmbtr / 10 ).... to move the decimal left
try dividing or multiplying the value l_dmbtr as per your requirement..
‎2009 Mar 19 2:19 PM
Hi,
Try this.
DATA: gw_numeric(14) TYPE n, "To store Numeric Value
data: v_var(14) type c value '3333'.
COnstants: c_amtmask14(14) TYPE c VALUE '___________.__',
WRITE V_var TO gw_numeric USING EDIT MASK c_amtmask14.
Regards,
Peranandam
‎2009 Mar 19 2:24 PM
Hello,
Instead of :
l_dmbtr = t_openitems-lc_amount.Can you try:
WRITE t_openitems-lc_amount TO l_dmbtr CURRENCY t_openitems-loc_currcyHope this helps.
BR,
Suhas
‎2009 Mar 19 2:19 PM
‎2009 Mar 19 2:23 PM
Hi Aravind,
You can use the FM BKK_AMOUNT_CONV_TO_EXTERNAL.
Based on the currency it will give you the decimals.
It will also provide rounding functionality.
e.g. if the amount is 12345.12782 and currency is INR then it will provide you the value 12345.13
Regards,
Raju.
‎2009 Mar 20 2:40 AM
hi all,
Thanks a lot for your replies.
The FM BKK_AMOUNT_CONV_TO_EXTERNAL solved my problem.
Aravind