‎2009 Mar 30 10:24 AM
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
‎2009 Mar 30 10:30 AM
hi try like this ,
loop at itab .
if itab-netpr > '100.00'.
PERFORM x.
else .
perform y.
ENDIF.
ENDLOOP.
thanks
chinnaiya
‎2009 Mar 30 10:34 AM
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
‎2009 Mar 30 10:35 AM
Just try as
if item-netpr> 100.00 .
Perform X.
else
Perform Y.
Regards
Shashi
‎2009 Mar 30 10:37 AM
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.
‎2009 Mar 30 10:37 AM
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