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

SAP Script IF ELSE Check

Former Member
0 Likes
1,892

Hi SDN,

I am adding a condition in the script. IF ELSE condition. The condition happens to be longer than the line size of the editor. It comes to the next line and the other.

When my script run, it checks the condition only on the first line and the rest is not checked and printed as text. I mean the whole condition gets printed as text.

Can anyone help me out with this.

How shall I modify the script so that the whole text is treated as a condition and not the text.

Thanks in advance,

Useful answers will be rewarded with points.

Thanks,

Manu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,381

Hi ,

even i faced the same problem.

As script doent check the very long conditions (more than 1 line)

The solution which i adopted is :

Call the Perform Routine from ur script and with in SE38 editor, u have to mention all ur If.........else conditions.

witth in this condition pass the Flag to the variable .

Ex:

If.......

gv_x = 'X'.

else.

gv_x = ' '.

endif.

Now u can use this flag variable in the script editor to check whther it has passed IF condition , or ELSE Condition.

Revrt back if nay issues,

Regards,

Naveen

8 REPLIES 8
Read only

Former Member
0 Likes
1,381

Make sure the paragraph format of the second line is blank, SAPscript will treat this as a continuation of the line.

Regards,

Nick

Read only

0 Likes
1,381

I did that already. There is no paragraph format in that line.

Read only

0 Likes
1,381

Are you using the graphical or text editor? If you're using the text you have the function Ctrl+F8 which shifts the line left or right.

Alternatively the paragraph format = acts as a line continuation.

If all else fails you may need to split you condition into nested IFs.

Regards,

Nick

Read only

0 Likes
1,381

You may use this under text editor:-

Edit>Page Left/Right

or

put your mouse cursor on the line, and then press Shift+F8

Read only

Former Member
0 Likes
1,382

Hi ,

even i faced the same problem.

As script doent check the very long conditions (more than 1 line)

The solution which i adopted is :

Call the Perform Routine from ur script and with in SE38 editor, u have to mention all ur If.........else conditions.

witth in this condition pass the Flag to the variable .

Ex:

If.......

gv_x = 'X'.

else.

gv_x = ' '.

endif.

Now u can use this flag variable in the script editor to check whther it has passed IF condition , or ELSE Condition.

Revrt back if nay issues,

Regards,

Naveen

Read only

Former Member
0 Likes
1,381

Hi Manu,

Try to put whole cond. in single line like...

when you are in edit mode in script press Shift + F8..then you'll get continuation line. here you can enter whole cond in single line.

I'm not sure you are getting error because of writing IF cond in two lines.

Thanks

Read only

0 Likes
1,381

I have tried using SHIFT+F8. The condition is longer. I think I will have to write a seperate routine as suggested by Naveen.

Thanks,

Manu

Read only

0 Likes
1,381

Hi ,

seperate subroutine will definetly work as i did the same.

regards,

Naveen