Skip to Content

SAP Script form - If else statement not working

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 07 at 01:01 PM

    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.
    Add comment
    10|10000 characters needed characters exceeded

  • Feb 07 at 02:00 PM

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

    thanks

    Add comment
    10|10000 characters needed characters exceeded

  • 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.
    Add comment
    10|10000 characters needed 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.