2020 Apr 07 6:20 PM
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.
2020 Apr 08 11:43 AM
>> "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.
2020 Apr 07 7:51 PM
Your CALL BADI misses the parameters you're talking about...
2020 Apr 07 7:53 PM
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).
2020 Apr 07 7:55 PM
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.
2020 Apr 08 4:48 AM
2020 Apr 08 5:34 AM
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
2020 Apr 08 9:32 AM
Your CALL BADI misses the parameters you're talking about...
2020 Apr 08 10:43 AM
ive marked "Pass By Value", the issue still persist
ive defined parameters in the program as well
2020 Apr 08 11:43 AM
>> "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.
2020 Apr 08 2:29 PM
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'.
2020 Apr 08 1:53 PM
I'm not talking about the parameters of CAL_PERC.
I'm talking about: "Your CALL BADI misses the parameters you're talking about..."