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

save extra data with material master

Former Member
0 Likes
1,142

Hi Gurus,

My requirement is to save material master data in additional Z tables when material is created or modified. I am trying to find proper BADI or Userexit but I cannot find any. Iu2019ve tried with BADI_MATERIAL_REF and BADI_MATERIAL_CHECK and BADI_MATERIAL_OD and EXIT_SAPLMGMU_001 but they all seem to be designed for other purposes. Do you know if there is any reasonable solution that could be used ?

Regards

Pawel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
753

Hi Pawel,

EXIT_SAPLMGMU_001 I hope this will work.

I am using the same to update the values in the Ztable.

Please find my sample code:



    IF wstat-aktyp = lc_h.

      SELECT COUNT(*)
             FROM zmarc_entry
             WHERE werks = wmarc-werks AND
                   matnr = wmara-matnr.

* If entry already exists, don't add it to the table

      CHECK sy-dbcnt LE 0.

      MOVE : wmarc-werks TO lwa_marc_entry-werks,
             wmara-matnr TO lwa_marc_entry-matnr,
             sy-datum TO lwa_marc_entry-erdat.

* Store data in Table 

      INSERT zmarc_entry FROM lwa_marc_entry.


    ENDIF.
  ENDIF.

I hope this may helpfull.

Thank you,

Thanks,

AMS

4 REPLIES 4
Read only

Former Member
0 Likes
754

Hi Pawel,

EXIT_SAPLMGMU_001 I hope this will work.

I am using the same to update the values in the Ztable.

Please find my sample code:



    IF wstat-aktyp = lc_h.

      SELECT COUNT(*)
             FROM zmarc_entry
             WHERE werks = wmarc-werks AND
                   matnr = wmara-matnr.

* If entry already exists, don't add it to the table

      CHECK sy-dbcnt LE 0.

      MOVE : wmarc-werks TO lwa_marc_entry-werks,
             wmara-matnr TO lwa_marc_entry-matnr,
             sy-datum TO lwa_marc_entry-erdat.

* Store data in Table 

      INSERT zmarc_entry FROM lwa_marc_entry.


    ENDIF.
  ENDIF.

I hope this may helpfull.

Thank you,

Thanks,

AMS

Read only

Former Member
0 Likes
753

Hi Pawel,

Can I expect the problem is solved.If solved please make this post as closed.

If you got any other solution please post it before closing it may helpfull to others.

Thank you,

Thanks,

AMS

Read only

Former Member
0 Likes
753

hello,

yes it was helpful, thank a lot. i have one more question related to this code. do you know or maybe anyone else knows what are possible values of wstat-aktyp ?

regards

pawel

Read only

0 Likes
753

AKTYP = 'V'. " Only Change

AKTYP = 'H'. " Only Creation mode.

01 Create

02 Change

03 Display

04 Modify (Direct Input: Create/Change)

06 Delete

11 Create defaults

12 Change defaults

13 Display defaults

Based on the table AKTYP changes.

I hope this may helpfull.

Thank you.

Thanks,

AMS