2015 Feb 14 9:30 AM
HI,
Can anyone tell me what is wrong with the following code.
IF NOT P_KUNNR IS INITIAL.
* ** IF P_KUNNR NOT BETWEEN R_KUNNR-LOW AND R_KUNNR-HIGH.
IF P_KUNNR NOT IN R_KUNNR.
R_KUNNR_LINE-SIGN = 'I'.
R_KUNNR_LINE-OPTION = 'EQ'.
R_KUNNR_LINE-LOW = P_KUNNR.
APPEND R_KUNNR_LINE TO R_KUNNR.
ENDIF.
ENDIF.
When P_KUNNR is not inital and R_KUNNR was not containing P_KUNNR, mycode does not pass through the ranges statements.
2015 Feb 14 10:57 AM
Hi,
Try this,
IF NOT P_KUNNR IS INITIAL.
IF ( P_KUNNR NOT IN R_KUNNR[] ) OR ( R_KUNNR[] IS INITIAL ).
R_KUNNR_LINE-SIGN = 'I'.
R_KUNNR_LINE-OPTION = 'EQ'.
R_KUNNR_LINE-LOW = P_KUNNR.
APPEND R_KUNNR_LINE TO R_KUNNR.
ENDIF.
ENDIF.
Hope it helpful,
Regards,
Venkat.
HI,
Can anyone tell me what is wrong with the following code.
IF NOT P_KUNNR IS INITIAL.
* ** IF P_KUNNR NOT BETWEEN R_KUNNR-LOW AND R_KUNNR-HIGH.
IF P_KUNNR NOT IN R_KUNNR.
R_KUNNR_LINE-SIGN = 'I'.
R_KUNNR_LINE-OPTION = 'EQ'.
R_KUNNR_LINE-LOW = P_KUNNR.
APPEND R_KUNNR_LINE TO R_KUNNR.
ENDIF.
ENDIF.
When P_KUNNR is not inital and R_KUNNR was not containing P_KUNNR, mycode does not pass through the ranges statements.
2015 Feb 14 10:40 AM
2015 Feb 14 10:57 AM
Hi,
Try this,
IF NOT P_KUNNR IS INITIAL.
IF ( P_KUNNR NOT IN R_KUNNR[] ) OR ( R_KUNNR[] IS INITIAL ).
R_KUNNR_LINE-SIGN = 'I'.
R_KUNNR_LINE-OPTION = 'EQ'.
R_KUNNR_LINE-LOW = P_KUNNR.
APPEND R_KUNNR_LINE TO R_KUNNR.
ENDIF.
ENDIF.
Hope it helpful,
Regards,
Venkat.
2015 Feb 14 11:26 AM
Thanks Eitan and Venkat for your response..
Issue solved venkat..
As you have pointed out we have to check both conditions.
When R_KUNNR is an empty table P_KUNNR NOT IN R_KUNNR[] alone is not sufficient.
Thanks..
2015 Feb 15 8:25 AM
If you define R_KUNNR correctly (i.e. as RANGE OF) then you do not need the []