Application Development and Automation 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: 
Read only

decimal values....

Former Member
0 Likes
1,369

Hi,

For the following code ekkn-vproz always gives 0.0 as it is decimal value...so i want to change to 100.0...in the below code...unfortunately it is not showing the 100.0 value why...

data : v_vproz(10) type c.

v_vproz = lt_ekkn-vproz.

IF v_vproz = '0.0'.

MOVE '100.0' TO v_vproz.

ELSE.

v_vproz = lt_ekkn-vproz.

ENDIF.

SHIFT v_vproz LEFT DELETING LEADING space.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,265

hi Vj,

declare v_vproz as type <b>P</b>/<b>F</b>.

i.e, data : v_vproz type P decimals 1.

or

data : v_vproz type F.

Reward if it helps,

Regards,

Santosh

9 REPLIES 9
Read only

Former Member
0 Likes
1,266

hi Vj,

declare v_vproz as type <b>P</b>/<b>F</b>.

i.e, data : v_vproz type P decimals 1.

or

data : v_vproz type F.

Reward if it helps,

Regards,

Santosh

Read only

0 Likes
1,265

no i want it to be only character(c) because i m using it in concatenate statement........

Read only

0 Likes
1,265

no i want it to be only character(c) because i m using it in concatenate statement........

Read only

0 Likes
1,265

try

IF lt_ekkn-vproz.

is initial.

MOVE '100.0' TO v_vproz.

ELSE.

v_vproz = lt_ekkn-vproz.

ENDIF.

Regards,

Suresh Datti

Read only

0 Likes
1,265

hi Vj

do this way it works now

<b>if lt_ekkn-vproz is initial.

move '100.0' to v_vproz.

else.

v_vproz = lt_ekkn-vproz.

endif.</b>

Reward if it helps

Regards,

Santosh

Read only

0 Likes
1,265

not working.....

Read only

0 Likes
1,265

hi,

Try Using FM <b>CONVERSION_EXIT_ALPHA_INPUT</b> before If Statement i.e,

i.e,

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = lt_ekkn-vproz

IMPORTING

OUTPUT = lt_ekkn-vproz

.

if lt_ekkn-vproz is initial.

move '100.0' to v_vproz.

else.

v_vproz = lt_ekkn-vproz.

endif.

Regards,

Santosh

Read only

0 Likes
1,265

Not sure I would do it this way, but this works because you are check the value of a character field, which means that you need to take the spaces into consideration.



report zrich_0001 .


data: lt_ekkn-vproz type ekkn-vproz.
data : v_vproz(10) type c.
v_vproz = lt_ekkn-vproz.
if v_vproz = '      0.0 '.
  move '100.0' to v_vproz.
else.
  v_vproz = lt_ekkn-vproz.
endif.


write:/ v_vproz.

Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,265

This is the better way to go.



report zrich_0001 .


data: lt_ekkn-vproz type ekkn-vproz.
data : v_vproz(10) type c.
v_vproz = lt_ekkn-vproz.
*if v_vproz = '      0.0 '.
<b>if lt_ekkn-vproz is initial.</b>
  move '100.0' to v_vproz.
else.
  v_vproz = lt_ekkn-vproz.
endif.


write:/ v_vproz.

Regards,

Rich Heilman