cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal (currency fields) comparisons in sap script

Former Member
0 Kudos

Hi,

I am doing a simple compare between a sap currency field and a dollar amount. My problem is it does not work the way I am doing it. Can someone suggest what I am doing wrong? Here is my code:

/: IF &T001-BUKRS& = '1500' AND &REGUD-WNETT& LT 50000.00

/:BITMAP 'SIGNATURE_TEST_1' OBJECT GRAPHICS ID BMAP TYPE BMON

/:ENDIF

My problem is that it is printing the graphic even when the amount is greater than 50000.00 (it should NOT as per the

code above). I tried putting single-quotes around 50000.00 (like '50000.00'); it still does not work.

Any suggestions would be great. Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

arul_murugan
Active Participant
0 Kudos

Hi,

The currency values will be right aligned and stored in the variables. So while comparing with hard coded values check the length and then compare with the variable. it will be of currency 13 so u need to give some 5 spaces inside the single quotes.

Thanks

Arul

Edited by: Arul on Aug 17, 2010 9:45 AM

Answers (2)

Answers (2)

Former Member
0 Kudos

In order to solve this problem, I created a separate custom program and placed a form in it. I passed the currency field to this custom program and brought back a flag field. Based on the flag, I did what I was supposed to do.

For some reason, within sapscript, I was not able to compare a currency field to a hard number value like 50000.

My way around the issue helped me solve the problem.

Thanks and I have credited those of you who have replied to this question.

Salil

Former Member
0 Kudos

Hi,

As arul said, you should be care of the blank spaces. Either add the same in the constant value or condense the field value - &REGUD-WNETT&.

Both will work.

Regards,

Selva K.