Application Development 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: 

Quantity field

Former Member
0 Kudos

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

2 REPLIES 2

narin_nandivada3
Active Contributor
0 Kudos

Hi Radha,

Please check this thread

Please check this thread even with different method implemented in it.

Hope this would help you.

Good luck

Narin

Former Member
0 Kudos

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.