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

Enhancement/Badi/User-Exit to make Vendor Material Number Mandatory in Me11/ME12

Former Member
0 Kudos
2,202

I have a requirement that based on certain conditions the 'Vendor Mat. No.' i.e. 'EINA-IDNLF' of screen '0101' program 'SAPMM06I' be made mandatory in Tcode ME11 / ME12.

I have tried looking for user-exits, BADIs, or even screen-exits.

I did not find any suitable BADI / User-Exits for the same.

I found that in screen 0101 --> PBO --> MODULE modify_screen --> PERFORM feldauswahl --> I could add an enhancement for changing the screen properties.

I did add the code Below :-

ENHANCEMENT 17  ZZ_MAKE_VMN_FOR_CORP_PART.    "active version

IF ( SY-TCODE = 'ME11' ) OR ( SY-TCODE = 'ME12' ).

   IF EINA-MATNR IS NOT INITIAL.

     Data : wa_mara TYPE MARA.

     SELECT SINGLE * from MARA INTO wa_mara where MATNR = EINA-MATNR.

      IF SY-SUBRC = 0.

        IF wa_mara-extwg = 'CORP' AND wa_mara-mprof = 'AML'.

          LOOP AT SCREEN.

            IF SCREEN-NAME = 'EINA-IDNLF'.

              Screen-REQUIRED = 1.

              MODIFY SCREEN.

            ENDIF.

          ENDLOOP.

        ENDIF.

      ENDIF.

   ENDIF.

ENDIF.

ENDENHANCEMENT.


The code got executed, the screen-field required value changed to 1.


However I found that the field is not made mandatory, and its possible to save without entering value.



Additional Info :-


1. There is a module in Screen 0101 --> PAI --> MODULE check_mandatory_fields.

    This module checks for the mandatory fields being filled but works on certain field only. ( chain - endchain )


2. I could not find any other place in PAI, where I can insert additional code.




Did i miss something?  What Steps should I do to make this field mandatory.


( Please Note : Suggestion other than taking an access key are welcome ).

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
1,032

Solved it Myself.

Instead of

0101 --> PBO --> MODULE modify_screen --> PERFORM feldauswahl

I placed enhancement in

0101 --> PBO --> MODULE modify_screen  --> PERFORM CHECK_INFREC_ARCHIVE.

That helped.

However could not identify where the attribute got changed in between though.

2 REPLIES 2
Read only

Former Member
0 Kudos
1,033

Solved it Myself.

Instead of

0101 --> PBO --> MODULE modify_screen --> PERFORM feldauswahl

I placed enhancement in

0101 --> PBO --> MODULE modify_screen  --> PERFORM CHECK_INFREC_ARCHIVE.

That helped.

However could not identify where the attribute got changed in between though.

Read only

kiran_k8
Active Contributor
0 Kudos
1,032

Hemanth,

Implicit enhancement should be the last option,if we don't have any an option in SPRO config or BADI/Customer Exit/User Exit to include a check .You should have explored the Customer Exit and also a BADI immediately following the Customer Exit as showin in the attached pic.

CALL CUSTOMER-FUNCTION '901' and

Perform BADI_MATN1_CHECK_INIT.

And also from Functional Point of view,Fucntional Consultant should have checked SPRO config ie ME11/12 screen layout.

SPRO>>Materials Management>>Purchasing>>Purchasing Info Record>>Define Screen Layout.

K.Kiran.