cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in SAP-Script Conditional Block

Former Member
0 Kudos

Hi All,

I am creating one report form using SAP Script, which uses standard driver program. There is a control statement like,

{ Consider W=1, X=0 , Y=0 & Z=0 }

/: IF ((X==0 AND Y==0) OR (Z==0 OR W==0) OR ...) { lot of OR & AND stament used in this conditional statment }

  • ....

/: ELSE

  • ....

/: ENDIF

Here is a mistery, it executes both if and else statement. Please give me some idea on this, and why such a weird output is displaying?

<<removed by moderator>>

Edited by: kishan P on Sep 13, 2010 4:17 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Vinod,

As Karthi said, it is syntax problem only.

The problem is, SAP Script never accept open & close brackets '(' or ')', so remove the brackets will work.

More thing, if you use more AND and OR statement, then beware of the place of AND and OR, else logic would be fail, if you not able to handle then split logic by using more than on if else stament.

Hope this will help.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

In SAPScript (as in ABAP), the == should be = or EQ (ie. not 2 ='s).

Regards, Andy

Former Member
0 Kudos

Hi..

The syntax of the command could be incorrect. Check for full stops, variables etc.

http://help.sap.com/saphelp_40b/helpdata/en/d1/80325f454211d189710000e8322d00/content.htm

Please check the above link's last paragraph which says :

"If a syntax error occurs in the interpretation of this command, then the command is not executed. This may have an unexpected effect on the subsequent text output. For example, if the IF statement is incorrect, then all following ELSEIF and ELSE commands will be ignored, since the opening IF command is u2018missingu2019. This will cause all the text lines attached to the ELSEIF and ELSE commands to be printed."

Regards,

Karthik