cancel
Showing results for 
Search instead for 
Did you mean: 

BADI is not triggering MDG_BS_MAT_API_ENRICH_BADI in change mode

0 Kudos

Hi Experts,

This BADI is called from the class CL_MDG_BS_MAT_API of method SAVE in case of Material creation(for WF-BATCH user) but not in case of Material Change we want this MDG_BS_MAT_API_ENRICH_BADI BADI in Material changes for plant extension.

Kindly give your suggestion for this issue.

Regards

Mohammed Sajid

0 Kudos

any update on this

Accepted Solutions (0)

Answers (4)

Answers (4)

loga201
Contributor
0 Kudos

Hi,

when user clicks activate button in the final approavl process, System will check by creating material in test mode i.e iv_test_mode = abap_true. If there is any error then user is stopped with the error in the UI. In case everything is fine, system will call save method in iv_test_mode = abap_false for final save. It is the normal process for create ,change or delete material. If save method is not called in change material better to raise a tciket. also make sure that filter name of the BADI is correctly mentioned ,check the same in the debugging mode..

CALL BADI lo_enrich_badi->enrich

Thanks and regatds,

Logan.D

bpawanchand
Active Contributor
0 Kudos

Hi,

I am not sure what you want to achieve, but the point is very simple in either CREATE or CHANGE badi will be called only before activating the CR. If my understanding is correct the BADi is called only before the CR final approval processes is done. In case of change there can be possibility that you just try to create and save it as a draft version. I would recommend to check if the BADI is getting called if the existing material is changed by using MAT02 CR type and save but do not submit or finalize process. IN this case I guess it should trigger the BADI>

One more point which I would like to know is how and why are you creating the break points on the user WF-BATCH. Usually WF-BATCH user is a non dialog user and this makes the user of not having the rights to execute in debug mode. Please check with your basis team about this

Thanks,Pavan

0 Kudos

Hi Ingo Bruss,

Thanks for your response I tried to debug this method CL_MDG_BS_MAT_API => SAVE this method is called When we activate the material during creation of material MAT01 and the importing parameter IV_TEST_MODE = abap_false for the WF-BATCH user and that's why the BADI is called

IF iv_test_mode IS INITIAL.

TRY.

GET BADI lo_enrich_badi.

CALL BADI lo_enrich_badi->enrich

IMPORTING et_message = lt_message

CHANGING cs_data = ls_data.

APPEND LINES OF lt_message TO et_message.

CATCH cx_badi_not_implemented . "There is not BADI Implementation CATCH cx_root.

ENDTRY.

ENDIF.

But in case of material change MAT02 this method is not called for WF-BATCH user . But for the final approval user when we activate the material this method parameter fills with IV_TEST_MODE = abap_true .

kindly help on this issue.

Regards

Sajid

d024348
Employee
Employee
0 Kudos

Hi, the BAdI should be called for create as well as update.

You can debug this via break-point in class CL_MDG_BS_MAT_API => SAVE by setting a break-point at the call of enrich_custom_segments

If this doesn't work, might be reason for a ticket.

Regards, Ingo Bruß