Skip to Content
0

SAP Script form - If else statement not working

Feb 07 at 12:04 PM

46

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Raymond Giuseppi
Feb 07 at 01:01 PM
1

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.
Show 2 Share
10 |10000 characters needed characters left characters exceeded

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.

0

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

0
Tim Schempp Feb 07 at 02:00 PM
1

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

thanks

Share
10 |10000 characters needed characters left characters exceeded
Sandra Rossi Feb 07 at 01:08 PM
-1

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.
Show 1 Share
10 |10000 characters needed characters left characters exceeded

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.

0