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: 

BADI Enhancement Point issue

former_member670450
Participant
0 Kudos
1,967

Hi, I am new to abap and learning about badi enhancement

REPORT ZABAP_ENHANCEMENT .

DATA: w_badi type REF TO ZABAP_BADI_ENHANCEMENT.        ""BADi Definition


START-OF-SELECTION.

GET BADI w_badi.
call BADI w_badi->cal_perc.


ENHANCEMENT-POINT ZTEST_ENHANCEMENT SPOTS ZABAP_ENHANCEMENT_IMPL .

Im actually calling another method from my badi source code

When I changed the importing into Changing in BADI source code, it prompt me the following error:

Formal parameter "EV_PERCENTAGE" is a EXPORTING parameter, not a CHANGING parameter.

Parameters of Method: CAL_PERC

IV_ACT	    Importing	Type	I
IV_MAX	     Importing	Type	I
EV_PERCENTAGE	Changing	Type	P

However, when i tried to change the Changing into Exporting, it prompts yet another error:

Method "CAL_PERC" of the BAdI interface "ZABAP_BADI_INTERFACE" of the multiuse BAdI "ZABAP_BADI_ENHANCEMENT" must only contain IMPORTING and CHANGING parameters.

1 ACCEPTED SOLUTION

michael_piesche
Active Contributor
1,572

>> "No value was passed to the mandatory parameter "IV_ACT" , not sure why

You are not passing the values to the badi-method (!). You have to pass them like this for example:

CALL BADI w_badi->cal_perc EXPORTING iv_act = iv_act 
                                     iv_max = iv_max
                     CHANGING ev_percentage = ev_percentage.
10 REPLIES 10

Sandra_Rossi
Active Contributor
0 Kudos
1,572

Your CALL BADI misses the parameters you're talking about...

Sandra_Rossi
Active Contributor
0 Kudos
1,572

NB: BAdI and enhancement point are not related at all. Do things simple. First do BAdI only (and later, try enhancement point in separated program not related to BAdI).

Sandra_Rossi
Active Contributor
1,572

If you define your BAdI "multiuse" (several implementations are possible), you cannot define the interface method with parameters of type EXPORTING, only CHANGING can be used.

former_member1716
Active Contributor
1,572
arnold92 For all your Inputs and doubts kindly use Comment option, do not use the Answering Option unless you have a valid input towards answering.

former_member670450
Participant
0 Kudos
1,572

Hi Sandra, my badi is marked as multiple use and ive just made exporting parameters to changing. Ive marked Pass In Value for all Parameters in method even in the superclass I called in badi, now it says "No value was passed to the mandatory parameter "IV_ACT" , not sure why

Sandra_Rossi
Active Contributor
0 Kudos
1,572

Your CALL BADI misses the parameters you're talking about...

former_member670450
Participant
0 Kudos
1,572

ive marked "Pass By Value", the issue still persist

ive defined parameters in the program as well

michael_piesche
Active Contributor
1,573

>> "No value was passed to the mandatory parameter "IV_ACT" , not sure why

You are not passing the values to the badi-method (!). You have to pass them like this for example:

CALL BADI w_badi->cal_perc EXPORTING iv_act = iv_act 
                                     iv_max = iv_max
                     CHANGING ev_percentage = ev_percentage.

1,572

arnold92

Since you are new to ABAP, please dont mix BADIS and ENHANCEMENTS right away. Do one concept at a time and master it.

Then, and only then, you can think about use cases where you might want to mix them for whatever reason you choose to.

These two concepts are not directly related to each other. They both have their own use cases, which doesnt prevent you of mixing them. But in a LEARNING PHASE, please dont mix them. Master them one at a time first. Please!

And especially dont mix several separate questions in the SAP community in one question. This wont get you any closer to a quick and good answer and it doesnt help the community either. In the long run, you might even get flagged for Cross-Posting or Unprofessional Conduct. If you havnt done already, please consider (re-)reading and taking the Tutorial on 'Ask and Answer Questions on SAP Community'.

Sandra_Rossi
Active Contributor
0 Kudos
1,572

I'm not talking about the parameters of CAL_PERC.

I'm talking about: "Your CALL BADI misses the parameters you're talking about..."