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

Comparing Amount values.....

Former Member
0 Likes
1,347

All,

I need to compare amount values say item-netpr with value say 100.00.So the condtion is:

if item-netpr> '100.00' .

Perform X.

else

Perform Y.

But while executing above lines of code ,i found-" if item-netpr> '100.00' is not executing i.e it is unable to compare the "item-netpr" value with '100.00' .The netpr is of char data type with 14 length.How to make IF statement compare the amout value?

Thanks

5 REPLIES 5
Read only

Former Member
0 Likes
987

hi try like this ,

loop at itab .
  if itab-netpr > '100.00'.
    PERFORM x.
    else .
    perform y.
    ENDIF.
  ENDLOOP.

thanks

chinnaiya

Read only

Former Member
0 Likes
987

Hi, Debabrata,

if the line item is not at the first item.you have to place hole module into loop.

otherwise,I think the amount 100.00 you are comparing is being processed as charecter type.thats why it is not working.

1.What you can do is declare a DATA of type NUMC and length 14.

2.Assign your value i.e. 100.00 to it .

3.Then in the if statement compare with this DATA item instead of direct "100.00".

Hope it will solve your problem.

With Best Regards,

Pulak.

Edited by: Pulak Mandal on Mar 30, 2009 3:06 PM

Read only

Former Member
0 Likes
987

Just try as

if item-netpr> 100.00 .

Perform X.

else

Perform Y.

Regards

Shashi

Read only

Former Member
0 Likes
987

Hi Debabrata,

Simply try by removing the quotes, for e.g;

if item-netpr > 100.00

perform X.

OR

if item-netpr > 100.

perform X.

Both should work.

Hope this helps u.

Regards

Arnab.

Read only

Former Member
0 Likes
987

Hi,

before comparing, move the value to a Quantity field type and then compare.

eg: data : v1(10) value '150',

v2 TYPE netpr.

v2 = v1.

now you check the if condition..

if v2 GT 100.

perform x.

else.

perform y.

endif.

Hope it helps!!

Regards,

Pavan