Skip to Content

Set a number of MM02 fields, across numerous tabs, to R/O, based on Z table lookup against matnr

We have an external system which is used to maintain certain materials. After creating or updating these materials they ared passed to BODS and then fed into SAP. These materials do not have anything that identifies them as being maintained externally, other than an extry in a Z table.

As a result of this I need to set around 20 fields (spread across numerous tabs) to Read/Only in MM02, so that the user can not update these fields. If the user want to change of these fields they update the matewrial back in the external maintenance system and then propagate back to SAP automatically.

Therefore, I have a Z table that holds the material numbers of those maintained externally. I need to find a way to set a range of fields in MM02 to Read/Only based on this Z table and the material in question.

I can't use Selection field groups, I don't believe, because these seem to be base on a change of Plant or material type or suchlike, which we don't have. .

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 29, 2017 at 03:58 PM

    I believe I have resolved this issue by creating an enhancement implementation of


    Method IF_EX_BADI_MAT_F_SPEC_SEL~FIELD_SELECTION allows me set the field to Read only.

    Code below works, although I have not yet defined the correct fields to set to Read only, and, I have also not tested this across tabs in MM02.

    IF t130m-tcode = 'MM02' AND t130m-AKTYP = 'V'. "V = Activty category for Change. See table T365.
    * Determine if we've already searched Z table for this material, if not then get count.
    * Otherwise avoid needless SQL call.
    IF rmmg1-matnr <> gv_matnr.
    SELECT COUNT( * ) INTO gv_count
    FROM zmaintained_outside
    WHERE matnr EQ rmmg1-matnr. "MATNR is Primary key in table
    * Update instance variable with material for next call to this method
    gv_matnr = rmmg1-matnr.
    * Only process if material exists in the Z table, and therefore has a count > 0
    IF gv_count > 0.
    CASE fauswtab-fname.
    fauswtab-kzinp = 0. "Set to Read Only to stop user from updating!
    ENDIF. "IF gv_count >0
    ENDIF. "IF t130m-tcode = 'MM02'...

    Add comment
    10|10000 characters needed characters exceeded