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: 

BADI after save for Material using MM01

former_member515329
Participant
0 Kudos

Hello All,

I have searched all posts/blogs before posting this.

I need a BADI/User-exit immediately after save of material using MM01.

i tried below ones:

BADI_MATERIAL_REF

BADI_MATERIAL_CHECK

BADI_MATERIAL_od

and also the user-exit -> EXIT_SAPLMGMU_001

These are all called before saving the material using MM01.

Thanks in advance.

1 ACCEPTED SOLUTION

MatthiasH
Explorer
0 Kudos

Hi,

we use for this the Buiness Object Events.

In transaction SWEC you can maintain a business object event based on change documents:


then maintain the field restrictions (in this case "material group was maintained")

Now the customizing is completed for raising the event.

Afterwards maintain the "Event Type Linkage" to the function module to be called with transaction SWETYPV.

After that, you implement the receiver function module with your logic.
As copy template take SWE_TEMPLATE_RECTYPE_FB or SWE_TEMPLATE_RECTYPE_FB_2, which both contain a (german) documentation.
Remark: the parameter OBJKEY contains the changed material number.

Best regards, Matthias

7 REPLIES 7

jitendra_it
Active Contributor
0 Kudos

What you trying to achieve through post-commit BADI ?

raymond_giuseppi
Active Contributor

You can use any of those BAdI/Exit to CALL a FUNCTION IN BACKGROUND UNIT so it will be executed after the update has been processed.

0 Kudos

Thanks Raymond...can you please explain in details..is this a ZFM(which i can create?)...currently i am using BADI_MATERIAL_CHECK for validating other MARA fields...so in this BADI implementation shall i call this ZFM in background task?

Yes create a Z FM, RFC enabled, just insure

  • You have already the required parameter values
  • You don't call multiple time the FM before commit (you could call the FM in a form executed withPERFORM, ON COMMIT)

0 Kudos

Wrote below code in BADI implementation-> calling a rfc call in background mode with commit work-> is this allowed??

it is calling FM while running MM01 tcode -> BUT since i am changing values of same material using BAPI BAPI_MATERIAL_SAVEDATA -> it is throwing error as "the group data for the material is locked by user" -> how to overcome this - need to update few fields of same material AFTER the material is saved in MARA.

Any suggestions??

0 Kudos

Remove

  • the destination NONE
  • your COMMIT WORK, so the main transaction COMMIT WORK will trigger the FM after update task performed.

MatthiasH
Explorer
0 Kudos

Hi,

we use for this the Buiness Object Events.

In transaction SWEC you can maintain a business object event based on change documents:


then maintain the field restrictions (in this case "material group was maintained")

Now the customizing is completed for raising the event.

Afterwards maintain the "Event Type Linkage" to the function module to be called with transaction SWETYPV.

After that, you implement the receiver function module with your logic.
As copy template take SWE_TEMPLATE_RECTYPE_FB or SWE_TEMPLATE_RECTYPE_FB_2, which both contain a (german) documentation.
Remark: the parameter OBJKEY contains the changed material number.

Best regards, Matthias