Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

sapscript - IF condition on multiple lines

was_wasssu
Participant
5,300

I have a sapscript and a IF condition like this, very long :

if cond1 or cond2 or cond3

or cond4 or cond5 or cond6 or ....

How can i write this condition on multiple lines? I tried with "=" and "/=" on the left but doesn't work.

Thank you

10 REPLIES 10
Read only

Former Member
0 Likes
2,921

Hello,

The command line should be

Example

/: IF &condition& NE ' '

OR &condtion& NE ' '

Read only

former_member585060
Active Contributor
0 Likes
2,921

Hi try with

/ Line feed

Read only

Former Member
0 Likes
2,921

To the best of my knowledge, only single line conditions should be given in an Script. May be you can use an nested IF statement.

Something like,

/: IF condition 1

/: IF condition 5

something like this.

Again, i am not completely sure but i think this is the solution.

Read only

Former Member
0 Likes
2,921

Hi,

Go to your script and in change editor option and then write down all your if conditions, hopefully system will automatically considered it and it will work

Regards,

Vijay

Read only

was_wasssu
Participant
0 Likes
2,921

I can't change the editor.

So i have to do something like this?

/: IF ........

(empty here) or ......

(empty here) or ......

or something like this:?

/: IF ......

/: or ....

/: or.......

or something like this?

/ IF ......

/ or ....

/ or.......

Edited by: Was Wasssu on Jun 3, 2009 2:32 PM

Read only

Former Member
0 Likes
2,921

Hello,

for me seems to work just fine like this

IF ( 1 > 0 ) or ( 2 > 1 ) or ( 3 > 2 ) or ( 4 > 3 ) or ( 5 > 4 ) or
 ( 6 > 5 ) or ( 7 > 6 ).
message i001.
ENDIF.

try to check if you put space between parenthesis and condition. maybe the error is from there.

Hope it helps.

Read only

0 Likes
2,921

Doesn't work with:

/: IF ......

/: or ....

/: or.......

Any new ideea?

Read only

0 Likes
2,921

I had the same problem.

The solution is that You have to leave 'OR'or 'AND'

in the previous line:

/: IF ...... or

/: .... or

/: .......

Read only

Former Member
0 Likes
2,921

This message was moderated.

Read only

das_shubhashish
Explorer
0 Likes
2,921

Hello,

You can write all your checks in your driver program and can set a flag if all "if(s)" are satisfied. Then at the Script you can check for your flag.

Something like this-->

Data: gv_flag type abap_bool. "In Driver Program
.
.
.
.
Clear gv_flag.
If ltap-werks eq '8160' or ltap-werks eq '8160' or etc etc etc.
   gv_flag = abap_true.
endif.

*In Script
If &GV_FLAG& eq 'X'.
   "Do Something
Endif.