cancel
Showing results for 
Search instead for 
Did you mean: 

IF statement in SAPscript

Former Member
0 Kudos

I'm probably making a really simple mistake, but I've got the following code in a SAPscript window:


/: IF &REGUD-WRBTR& GT 0
* DR
/: ELSE
* CR
/: ENDIF

I've debugged through the print program and REGUD-WRBTR is 1175.00 but it still prints CR.

Any ideas?

Gill

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member196280
Active Contributor
0 Kudos

Hi GIll,

It is very strange why my previous code did not work anyhow? Try this,

I hope this time it will definitely works.

Call subroutine from your SAPSCRIPT changing FLAG.

In program, do the checking and if REGUD-WRBTR > 0. set flag to 'Y'

Come back to SAPscript, If FLAG = 'Y' print DR else CR.

Reward points to all useful answers.

Regards,

SaiRam

Former Member
0 Kudos

Hi!

SAPScript is tricky, you might try out out the following combinations:

/: IF &REGUD-WRBTR& GT '0'

/: IF &REGUD-WRBTR& GT 0.00

/: IF &REGUD-WRBTR& GT '0.00'

One of them has to work.

Regards

Tamá

Former Member
0 Kudos

Thanks Tamas,

But none of your suggestions worked.

Gill

former_member196280
Active Contributor
0 Kudos

Try this it will definitely work.

<b>

/: IF &REGUD-WRBTR& GT 0

  • DR

/: ENDIF

/: IF &REGUD-WRBTR& LT 0

  • CR

/: ENDIF</b>

Reward points if useful.

Regards,

SaiRam

Former Member
0 Kudos

Thanks Sai,

I tried your code but it doesn't work. CR is still being printed even when the value is 1175.00.

Gill

Former Member
0 Kudos

Hi!

Is your SAPScript activated?

You can debug your SAPScript also, maybe a previous IF is excluding your code...

Just go to SE71, Tools - Set debugger.

Regards

Tamá

Former Member
0 Kudos

Hi Tamas,

My sapscript is activated. If I change the code to print out DR everytime it changes, so I know that peice of code is called by the print program.

Gill