‎2006 Dec 19 5:04 PM
Can soembody send soem sample code using an IN statement? I am using it but get errors. Proble is the editor is in German and I don't know what it is saying!
IF COMM_STRUCTURE-COSTELMNT IN ('84300005','84300006').
RESULT = 'PM_LABOR'.
elseif COMM_STRUCTURE-COSTELMNT IN (61100950).
RESULT = 'PM_NON_STOCK'.
endif.
‎2006 Dec 19 5:07 PM
Hi,
For IF statement you cannot use fixed values..Instead create a ranges..and use it in your IN..
Example..
RANGES: R_MATNR FOR MARA-MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = 'ABCD'.
APPEND R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = 'ABCDADSF'.
APPEND R_MATNR.
IF MARA-MATNR IN R_MATNR.
WRITE: / 'TRUE'.
ELSE.
WRITE: / 'FALSE'.
ENDIF.
Thanks
Naren
‎2006 Dec 19 5:07 PM
Hi,
For IF statement you cannot use fixed values..Instead create a ranges..and use it in your IN..
Example..
RANGES: R_MATNR FOR MARA-MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = 'ABCD'.
APPEND R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = 'ABCDADSF'.
APPEND R_MATNR.
IF MARA-MATNR IN R_MATNR.
WRITE: / 'TRUE'.
ELSE.
WRITE: / 'FALSE'.
ENDIF.
Thanks
Naren
‎2006 Dec 19 5:17 PM
The sample code I am looing at uses it. I thought it was due to missing spaces. I can't really use a range becuase in some cases it isn't a range of values so i quess I could use the equal to
‎2006 Dec 19 5:07 PM
IF COMM_STRUCTURE-COSTELMNT IN ( '84300005' , '84300006' ).
RESULT = 'PM_LABOR'.
elseif COMM_STRUCTURE-COSTELMNT IN ( '61100950' ).
RESULT = 'PM_NON_STOCK'.
endif.
Make sure you have space after and before ().
Regards,
Ravi
Note - Please mark all the helpful answers
‎2006 Dec 19 5:13 PM
I did that and now it says
E:Comma without preceding colon (after IF ?).
‎2006 Dec 19 5:18 PM
Looks like the problem is with the statement before / after the IF statement.
Regards,
Ravi
Note - Please mark all the helpful answers
‎2006 Dec 19 5:24 PM
‎2006 Dec 19 5:24 PM
WHEN i DO WHAT Narendran suggests it works. I think he is correct and I can't use constants with and IF
‎2006 Dec 19 5:19 PM
Hi,
For single values also you can use the RANGES..
You have to give EQ in the option..
RANGES: R_MATNR FOR MARA-MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = <b>'EQ'</b>.
R_MATNR-LOW = 'ABCD'.
APPEND R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = <b>'EQ'</b>.
R_MATNR-LOW = 'ABCDADSF'.
APPEND R_MATNR
Thanks,
Naren
‎2006 Dec 19 5:20 PM
Hi,
here is a suggestion for your statement. Instead of using IN Statement you can use this:
if COMM_STRUCTURE-COSTELMNT >= ''84300005' AND COMM_STRUCTURE-COSTELMNT <= '84300006'.
RESULT = 'PM_LABOR'.
elseif COMM_STRUCTURE-COSTELMNT = 61100950.
RESULT = 'PM_NON_STOCK'.
endif.
Is it useful?
Ashven
‎2006 Dec 19 5:26 PM