cancel
Showing results for 
Search instead for 
Did you mean: 

Sapscript ignores 'IF'-Command

Former Member
0 Kudos

Hi,

I have the problem that sapscript ignores the IF/Else-Statement.

Example:

/: IF &flag& = 'X'

/: DEFINE &var& = 'YES'

/: ENDIF

  • &var&

When I start the form in debug-mode I can see the '/:' at IF/ENDIF. Then, it is replaced by a '/(' and the Command is interpretetd as an Output-Text. The DEFINE is ok! I see the '/:'.

What's wrong? Or is it only possible to have Text-Output between IF/ENDIF?

Thx.

Message was edited by:

Thomas Kper

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Define &Var& before the if condition. Not in IF condition. Check out this one.

/: DEFINE &var& = 'YES'.

/: IF &flag& = 'X'

  • &var&

/: ENDIF

Br,

Laxmi

Former Member
0 Kudos

Yes,

between IF and ENDIF you will only output text lines. If you want to have similar program logic working, then

- do this in the print program

or if the print program is a SAP standard then

- PERFORM (calling ABAP subroutines)

How to use the PERFORM in SAPscript, please see the help information on SAP help portal

http://help.sap.com/

Former Member
0 Kudos

Thanks. That will make the work harder but solve my problem.