2022 May 30 1:15 PM
DATA: RESULT(3) TYPE P DECIMALS 2,
OPERATOR TYPE C.
case val.
when >=97.
operator = 'A+'.
when others.
operator = 'F'.
endcase.
how can i use value of variable val with comparision operands of >= or <= signs in case statement ?Thanks
2022 Jun 01 9:34 AM
Hi,
You can use case statement with conditions inside select statement.
for e.g.
SELECT
werks,
matnr,
ersda,
clabs,
cinsm,
cspem,
CASE WHEN clabs > 0 OR cinsm > 0 AND cspem > 0 THEN
matnr && charg END AS ztest
FROM mchb INTO TABLE
@DATA(it_mchb).But Outside select statement you can't do this. If you want to compare you can use if statement.
Regards,
Anuja Kawadiwale
Hi,
You can use case statement with conditions inside select statement.
for e.g.
SELECT
werks,
matnr,
ersda,
clabs,
cinsm,
cspem,
CASE WHEN clabs > 0 OR cinsm > 0 AND cspem > 0 THEN
matnr && charg END AS ztest
FROM mchb INTO TABLE
@DATA(it_mchb).But Outside select statement you can't do this. If you want to compare you can use if statement.
Regards,
Anuja Kawadiwale
2022 May 30 1:59 PM
Hi jp1239,
use an IF statement instead of the CASE statement. With CASE, you compare two operands and it's best to have constant values after WHEN.
Best regards,
Lena
2022 May 30 4:48 PM
Your syntax is wrong.
CASE is only for = comparison, as explained in the ABAP Documentation.
2022 Jun 01 9:34 AM
Hi,
You can use case statement with conditions inside select statement.
for e.g.
SELECT
werks,
matnr,
ersda,
clabs,
cinsm,
cspem,
CASE WHEN clabs > 0 OR cinsm > 0 AND cspem > 0 THEN
matnr && charg END AS ztest
FROM mchb INTO TABLE
@DATA(it_mchb).But Outside select statement you can't do this. If you want to compare you can use if statement.
Regards,
Anuja Kawadiwale
2022 Jun 01 9:56 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |