Application Development and Automation 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: 
Read only

FM Enhancement implementation: IF ... ELSE ... ENDIF.

steven_dierick
Participant
0 Likes
942

Hey,

I want to use the enhacement framework to modify a SAP standard function module (BUA_ADDRESS_F4). The function module is a F4-help. The available F4 fields are hard coded and I want to a add some fields to the F4.

I add an enhancement implemetation at the beginning of the FM and at the end of the FM.

In the beginning enhancement I simply put "IF 1 = 2."

In the ending enhancement " ELSE. CALL FUNCTION own_function ENDIF."

But that seems to be impossible. I get a syntax error on the IF statement.

Is it impossible to open an if statement in the beginning implementation of an enhancement and close the if statement in the ending implementation of the enhancement?

Does anyone has some suggestions

Thanks in advance.

Steven

Hey,

I want to use the enhacement framework to modify a SAP standard function module (BUA_ADDRESS_F4). The function module is a F4-help. The available F4 fields are hard coded and I want to a add some fields to the F4.

I add an enhancement implemetation at the beginning of the FM and at the end of the FM.

In the beginning enhancement I simply put "IF 1 = 2."

In the ending enhancement " ELSE. CALL FUNCTION own_function ENDIF."

But that seems to be impossible. I get a syntax error on the IF statement.

Is it impossible to open an if statement in the beginning implementation of an enhancement and close the if statement in the ending implementation of the enhancement?

Does anyone has some suggestions

Thanks in advance.

Steven

2 REPLIES 2
Read only

former_member194669
Active Contributor
0 Likes
668

if your ENDIF statement is outside of ENDFUNCTION system will not accept

All you IF ELSE and ENDIF statement are with in the ENDFUNCTION.

aRs

Read only

0 Likes
668

aRs,

If and endif statements are nested correctly (both are within the endfunction).

I found a solution for my problem. Instead of placing the SAP code between the IF and ELSE statement and my own code after the ELSE, I place my code in the beginning between an IF and ENDIF. And I use an exit to skip the SAP code.

I'm however still interested in some comments on my first question?

Steven