Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to make only one line IF-Statements in ABAP

schmelto
Active Participant
0 Kudos
1,978

Is it possible to make only one line IF-Statement without ENDIF at the end?

Something like this in JavaScript:

var x = true;
if (x === true) console.log("true");
1 ACCEPTED SOLUTION

DominikTylczyn
Active Contributor
581

Hello 6e829fd780204f76b10f492049a3773c

No, it's not. Refer to SAP Help on details of IF syntax

IF is always concluded with ENDIF. Similarly as LOOP with ENDLOOP or DO with ENDDO. That's the ABAP syntax. However you can put IF ... ENDIF. in one line of code. Just mind the readability.

Best regards

Dominik Tylczynski

3 REPLIES 3

Patrick_vN
Active Contributor
581

The stuff that comes to mind are the COND and SWITCH keywords.

abo
Active Contributor
581

No, the complete instruction is "IF... (ELSE)... ENDIF"

DominikTylczyn
Active Contributor
582

Hello 6e829fd780204f76b10f492049a3773c

No, it's not. Refer to SAP Help on details of IF syntax

IF is always concluded with ENDIF. Similarly as LOOP with ENDLOOP or DO with ENDDO. That's the ABAP syntax. However you can put IF ... ENDIF. in one line of code. Just mind the readability.

Best regards

Dominik Tylczynski