2005 Aug 30 3:28 PM
Hi,
Can anyone explain the <b>'1 = 2'</b> which you can find in SAP sources (for example : SAPDBVAV, SAPDBVLV, SAPF011) ?
Regards,
Rob Makelaar
The Netherlands
2005 Aug 30 3:38 PM
It looks to me that it is being used as a way of exiting the FORM. For example, in the program SAPF011.
FORM VORTRAG_AUF_GLEICHES_KONTO.
IF CONTR-EXIST = SPACE.
MIGTAB-RACCT = EXTR-RACCT.
MIGTAB-BUKRS = EXTR-BUKRS.
CASE CONTR-ERROR.
WHEN 'SKA1'. MIGTAB-TEXT1 = TEXT-007.
WHEN 'SKB1'. MIGTAB-TEXT1 = TEXT-008.
WHEN 'T001'. MIGTAB-TEXT1 = TEXT-026.
ENDCASE.
COLLECT MIGTAB.
CHECK 1 = 2.
ENDIF.
If it goes inside this IF statement, then it will never go any further in the FORM, it will exit at the CHECK 1 = 2.
Not sure why they didn't just use the "EXIT" statement.
Regards,
Rich Heilman
Hi,
Can anyone explain the <b>'1 = 2'</b> which you can find in SAP sources (for example : SAPDBVAV, SAPDBVLV, SAPF011) ?
Regards,
Rob Makelaar
The Netherlands
2005 Aug 30 3:38 PM
It looks to me that it is being used as a way of exiting the FORM. For example, in the program SAPF011.
FORM VORTRAG_AUF_GLEICHES_KONTO.
IF CONTR-EXIST = SPACE.
MIGTAB-RACCT = EXTR-RACCT.
MIGTAB-BUKRS = EXTR-BUKRS.
CASE CONTR-ERROR.
WHEN 'SKA1'. MIGTAB-TEXT1 = TEXT-007.
WHEN 'SKB1'. MIGTAB-TEXT1 = TEXT-008.
WHEN 'T001'. MIGTAB-TEXT1 = TEXT-026.
ENDCASE.
COLLECT MIGTAB.
CHECK 1 = 2.
ENDIF.
If it goes inside this IF statement, then it will never go any further in the FORM, it will exit at the CHECK 1 = 2.
Not sure why they didn't just use the "EXIT" statement.
Regards,
Rich Heilman
2005 Aug 30 3:41 PM
2005 Aug 30 3:39 PM
It's a not possible equality, so you will stop at this point and exit the form. It's like an EXIT command.
The people who make this code like to play
Regards
Frédéric
2005 Aug 30 3:56 PM
It's a way to not execute the code of program after the control.
In a routine like FORM you could also write EXIT instead of CHECK 1 = 2 or...... CHECK 'BATMAN' = 'ROBIN'.... eh! eh! eh!
2005 Aug 30 3:57 PM
Hi,
I suppose that this CHECK performs always a negative result.
"CHECK with a negative outcome terminates the current loop pass and goes back to the beginning of the loop to start the next pass, if there is one. "
Svetlin
2005 Aug 30 3:59 PM
2005 Aug 30 4:04 PM
Sometimes it used to make possible searching something (e.g. messages) via <b>where-used</b> list. E.g. there are places where they collect messages into some application log without issueing it by MESSAGE statement, and obviously in that case you cannot find particular message via where-used list. And certainly something like
IF 1 = 2.
MESSAGE ....
ENDIF.can help somehow.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |