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 form - If else statement not working

Former Member
0 Likes
1,916

Hi experts,

I have a problem within a SAP Script form while checking a value to add a SO10 text.

In the header text I want to check if VKORG = '0005'.

In debugging mode I can see that the value is correct filled, but the statement is skipped.

Thats the Code:

/: IF TVKO-VKORG = '0005'.

* INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 1234 PARAGRAPH ZD.

/:

/: ENDIF.

/: INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 1235 PARAGRAPH ZD.

At the moment the debugger is standing on the if-line, the value of TVKO-VKORG is 0005.

Any ideas on that?


Thanks in regards for helping

6 REPLIES 6
Read only

RaymondGiuseppi
Active Contributor
1,385

Did you try to debug a code with an actual statement (neither space nor commented) between IF and ENDIF like

/: IF &TVKO-VKORG& EQ '0005'.
/: IF &TVKO-VKORG& NE '0000'.
/: ENDIF.
/: ENDIF.
Read only

0 Likes
1,385

Just now as you asked.

The same problem. It just skipps the line as the requirement wouldn´t be fulfilled.

Could it be something with the prefixes in the lines?

Is '/:' even correct?

Do I have to consider something in the lines above?

I also tested:

/: IF 1 = 1.

That worked... but the other statement is still being skipped.

Read only

0 Likes
1,385

Was it all that long ago that I created/edited a Sapscript for the last time...

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,385

The paragraph format * means that the line is a text to output. You should use /: for all SAPscript commands, i.e. in your case:

/: INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 1234 PARAGRAPH ZD.
Read only

0 Likes
1,385

Thanks for your reply.

I tried both. The basic problem is, that the coding is not reacting correct on the if statement.

As I answered to raymond, I tried it with IF 1 = 1. That works.. even with * at the beginning of the line.

Read only

Former Member
1,385

Problem solved. TVKO-VKORG was wrong.. &TVKO-VKORG& works instead.

thanks