09-01-2008 11:04 AM
Hi to all
i have quantity field, i want to get(display) decimals values if present other wise i need to get with out decimals(only numeric).
supposy my field is w_bstmg
if i have value in w_sub_bstmg 445.50
i have to display 445.50
if i have value in w_sub_bstmg 445.00
i have to display 445
i am able to display with the following code upto 1000.
DATA: l_bstmg TYPE i,
l_bstmg_1 TYPE rkwa-wrbtr.
DATA: w_sub_bstmg TYPE rkwa-bstmg,
w_bstmg_1 TYPE char17.
IF w_sub_bstmg < 0.
w_sub_bstmg = ABS( w_sub_bstmg ).
l_bstmg = w_sub_bstmg MOD 10000.
IF l_bstmg < w_sub_bstmg.
w_bstmg_1 = w_sub_bstmg.
ELSE.
w_bstmg_1 = l_bstmg.
ENDIF.
CONCATENATE w_bstmg_1 '-' INTO w_bstmg_1.
ELSE.
l_bstmg = w_sub_bstmg MOD 10000.
IF l_bstmg < w_sub_bstmg.
w_bstmg_1 = w_sub_bstmg.
ELSE.
w_bstmg_1 = l_bstmg.
ENDIF.
ENDIF.
if i have value more than 1000 in w_sub_bstmg then how to get it.
can any body help me
09-01-2008 11:10 AM
09-01-2008 3:16 PM
data : period type c value '.'.
Declare num as per your length.
SPLIT w_sub_bstmg AT period INTO num1 num2 .
num2 co ( Contains Only )'0'.
if sy-fdpos ne 0.
concat num1 period num2 into a variable .
else.
display num2 as it is .
Hope this helps.