Register Login

BAdI implementation for append fields in mass maintenance MM17

Updated May 19, 2018

Prerequisite for the implementation of customer-specific append fields in mass maintenance MM17:

The system must be able to process the customer-specific append fields in the ALE inbound processing of the material master maintenance.

Note for the Note Assistant:
With the Note Assistant Transaction SNOTE it is only possible to implement program changes. If you want to implement the note with the Note Assistant, you have to create all new objects manually before (Table types, type groupe, BadI definition + BAdI methods for the example implementation.).

    1. Create the new table type MARA_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MARA_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MARA_TAB' and choosing Enter,

        d) entering the short description 'MARA table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MARA' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MARA_TAB' in development class 'MGA'.

    2. Create the new table type MAKT_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MAKT_TAB' and choosing pushbutton 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MAKT_TAB' and choosing Enter,

        d) entering the short description 'MAKT table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MAKT' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MAKT_TAB' in development class 'MGA'.

    3. Create the new table type MARC_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MARC_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MARC_TAB' and choosing Enter,

        d) entering the short description 'MARC-table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MARC' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MARC_TAB' in development class 'MGA'.

    4. Create the new table type MBEW_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MBEW_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MBEW_TAB' and choosing Enter,

        d) entering the short description 'MBEW table',

        e) selecting tab page 'Line type and access', selecting radio button 'line type', entering line type 'MBEW' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MBEW_TAB' in development class 'MGA'.

    5. Create the new table type MARD_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MARD_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MARD_TAB' and choosing Enter,

        d) entering the short description 'MARD table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MARD' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MARD_TAB' in development class 'MGA'.

    6. Create the new table type MARM_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MARM_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MARM_TAB' and choosing Enter,

        d) entering short description 'MARM table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MARM' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MARM_TAB' in development class 'MGA'.

    7. Create the new table type MEAN_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MEAN_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MEAN_TAB' and choosing Enter,

        d) entering the short description 'MEAN table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MEAN' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MEAN_TAB' in development class 'MGA'.

    8. Create the new table type MLAN_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MLAN_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MLAN_TAB' and choosing Enter,

        d) entering the short description 'MLAN table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MLAN' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MLAN_TAB' in development class 'MGA'.

    9. Create the new table type MLGT_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MLGT_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MLGT_TAB' and choosing Enter,

        d) entering short description 'MLGT table',

        e) selecting tab page 'Line type and access', selecting radio button 'Line type', entering line type 'MLGT' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MLGT_TAB' in development class 'MGA'.

    10. Create the new table type MVKE_TAB by

        a) calling Transaction SE11,

        b) selecting radio button 'Data type', entering the new data type 'MVKE_TAB' and choosing button 'Create',

        c) selecting radio button 'Table type' on dialog box 'Create type MVKE_TAB' and choosing Enter,

        d) entering short description 'MVKE table',

        e) selecting tab page 'Line type and access', selecting radio button 'line type', entering line type 'MVKE' and selecting access type 'Standard Table',

        f) selecting tab page 'Key', selecting key definition 'Standard key' and key category 'Non-unique',

        g) saving, checking and activating the new table type 'MVKE_TAB' in development class 'MGA'.

    11. Creating type group MGMC

        a) Call Transaction SE11.
        Call dialog box 'Other Dictionary objects' via menu path -> 'Utilities -> Other Dictionary objects'.Select radio button 'Type group', enter the name of the type group 'MGMC' and choose button 'Create (F5)'.
        As of Release 4.70 (R/3 Enterprise) you select dictionary object 'Type group' directly on the initial screen of Transaction SE11, enter the name of the type group 'MGMC' there and choose button 'Create'.
        Enter short description 'Type group material master mass maintenance' on dialog box 'Type group MGMC:Create text' and choose button 'Save (Enter)'.
        On dialog box 'Create object directory entry', enter the development class or (as of Release 4.70) the package named 'MGA' and choose button 'Save (Enter)'.
        The creation of the type group automatically generates the first line of type group MGMC:

           TYPE-POOL mgmc .

        b) Implement the advance correction (refer to the corrections) in type group MGMC.The advance correction starts the already automatically genertated context block 'TYPE-POOL mgmc' and adds the required type declarations.
        Save, check and activate type group MGMC.

    12. Create the BadI definition 'MG_MASS_NEWSEG' by

        a) calling the BAdI Builder via Transaction SE18,

        b) entering the following attributes:
        Definition name: 'MG_MASS_NEWSEG'
        Type:             'Multiple use' Not selected
                        'Filter-Dependent' Not selected
        Short text: 'Customer-defined fields & segments in the mass maintenance'
        Development class: 'MGA'

        c) calling tab title 'Interface' and calling the methods via double-click on interface-name 'IF_EX_MG_MASS_NEWSEG',

        d) entering method 'RETURN_IDOC_TYPE' with type 'Instance Method' and description 'Change message type and basic type',

        e) calling the parameters of method 'RETURN_IDOC_TYPE' and entering parameters 'MESSAGE_TYPE' and 'IDOC_TYPE' with type 'Changing', typing 'Type', reference type 'EDI_MESTYP' or 'EDI_IDOCTP' and initial parameter pass by value, Optional, Default value:
        Parameter Type Typing Reference type Description
        MESSAGE_TYPE CHANGING TYPE EDI_MESTYP message type
        IDOC_TYPE CHANGING TYPE EDI_IDOCTP basic type

        f) entering method 'ADD_NEW_SEGMENT' with type 'Instance Method' and description 'Supply New Segments',

        g) calling the parameters of method 'ADD_NEW_SEGMENT' and adding the following parameters:
        Parameter Type Typing Reference type Description
        SMARA Importing Type MARA_TAB MARA-table
        SMAKT Importing Type MAKT_TAB MAKT-table
        SMARC Importing Type MARC_TAB MARC-table
        SMBEW Importing Type MBEW_TAB MBEW-table
        SMARD Importing Type MARD_TAB MARD-table
        SMARM Importing Type MARM_TAB MARM-table
        SMEAN Importing Type MEAN_TAB MEAN-table
        SMLAN Importing Type MLAN_TAB MLAN-table
        SMLGT Importing Type MLGT_TAB MLGT-table
        SMVKE Importing Type MVKE_TAB MVKE-table
        SELDATA Importing Type MASS_TABDATA table with
                                                        (Mass
                                                        maintenance)
        T_E1MARAM Importing Type MGMC_E1MARAM_TAB E1MARAM-table
        T_E1MAKTM Importing Type MGMC_E1MAKTM_TAB E1MAKTM-table
        T_E1MARCM Importing Type MGMC_E1MARCM_TAB E1MARCM-table
        T_E1MBEWM Importing Type MGMC_E1MBEWM_TAB E1MBEWM-table
        T_E1MARDM Importing Type MGMC_E1MARDM_TAB E1MARDM-table
        T_E1MARMM Importing Type MGMC_E1MARMM_TAB E1MARMM-table
        T_E1MEANM Importing Type MGMC_E1MEANM_TAB E1MEANM-table
        T_E1MLANM Importing Type MGMC_E1MLANM_TAB E1MLANM-table
        T_E1MLGTM Importing Type MGMC_E1MLGTM_TAB E1MLGTM-table
        T_E1MVKEM Importing Type MGMC_E1MVKEM_TAB E1MVKEM-table
        T_IDOC_DATA Changing Type EDIDD_TT table type
                                                        for EDIDD
        MSG Changing Type MASS_MSGS message for
                                                        mass changes

        Add all parameters with the initial attributes 'Value', 'Optional' and 'Default''.

        h) Return to the attributes of the BadI definition and via the menu call -> Goto -> Example source code -> Create in order to generate the BadI methods for the example implementation.

        i) the example source code from the advance correction (see corrections:
        METH CL_EXM_IM_MG_MASS_NEWSEG IF_EX_MG_MASS_NEWSEG~ADD_NEW_SEGMENT
        METH CL_EXM_IM_MG_MASS_NEWSEG IF_EX_MG_MASS_NEWSEG~RETURN_IDOC_TYPE )
        implement implementations as an example.

        j) Save, check and activate the BAdI.

    13. Implement the advance correction (refer to the corrections) in function module MASS_MATMAS03_CHANGE.This advance correction calls the BAdI methods in the save module of the mass maintenance before save module MASS_MATMAS03_CHANGE calls the ALE inbound processing of the material master maintenance for the update of the mass changes.

    14. In save module MASS_MATMAS03_CHANGE the system first calls BAdI method ADD_NEW_SEGMENT.By a suitable implementation of this method the system can supply the desired material master append fields with new field values.
    The BAdI is delivered with an example implementation that describes, how to supply customer-specific append fields or IS-OIL-specific append fields with new field values.

        a) Prerequisite:

    Customer-specific append fields:
    Enhance the standard IDOCs by the required customer-specific IDoc segments as described in Notes 44410 and 116311, for example ZE1MARAM for the MARA-data, ZE1MARCM for the MARC data, ... and so on.

    IS-OIL-specific append fields:
    In the IS-OIL R/3 System the required IDOC segments E1OILMA, E1OILMC and E1OILMW already exist.

        a) Use Transaction SE19 to create an implementation name, for example 'ZZ_MG_MASS_NEWSEG' for BAdI definition name MG_MASS_NEWSEG.Call method ADD_NEW_SEGMENT in Transaction SE19 by selecting tab title 'Interface' and double-click method 'ADD_NEW_SEGMENT'.Copy the example implementation of method ADD_NEW_SEGMENT delivered with the BAdI (SE18 -> Definition name MG_MASS_NEWSEG -> Display -> menu -> Goto -> Sample code -> Display) or example implementation CL_EXM_IM_MG_MASS_NEWSEG of interface method IF_EX_MG_MASS_NEWSEG~ADD_NEW_SEGMENT described in the correction instructions (refer to the corrections) into the implementation created by you.

        b) Adjust the example-implementation to your requirements.In R/3 Systems that are not IS-OIL-specific, all source code passages that are flagged as IS-OIL-specific must be deleted.In IS-OIL R/3 Systems, all source code passages that are flagged as customer-specific must be deleted if no other customer-specific append fields are supposed to be supplied in addition to the IS-OIL-specific append fields.

        c) In the local TYPES declaration of your method implementation you must delete the lines flagged with "<<< DELETE LINE, because the lines are needed in the example implementation for syntactic reasons.You must delete comment '*' before the lines flagged with "<<< INSERT LINE in order to include the customer-specific or IS-OIL-specific IDOC segments.In the example implementation this is not possible for syntactic reasons, because the required customer-specific or IS-OIL-specific IDOC segments do not exist in the R/3 standard system.Check, save and activate the created implementation of method 'ADD_NEW_SEGMENT'.

    15. In the save module of mass maintenance MASS_MATMAS03_CHANGE, message type MESSAGE_TYPE = 'MATMAS' and basic type IDOC_TYPE = 'MATMAS03' is set for the ALE inbound processing.
    Prior to the call of the ALE inbound processing the system calls the second BAdI method 'RETURN_IDOC_TYPE'.In method 'RETURN_IDOC_TYPE' you can change the message type and/or the basic type.

    R/3 standard system
    In R/3 standard systems neither the message type nor the basic type may be changed, otherwise the ALE inbound processing does not function correctly.

    IS-OIL R/3
    In IS-OIL Systems you must replace message type MESSAGE_TYPE = 'MATMAS' by 'OILMAT' and basic type IDOC_TYPE = 'MATMAS03' by 'OILMAT03' if you want to change IS-OIL-specific fields via MM17.You achieve this, if you (analog to the above described implementation of method 'ADD_NEW_SEGMENT') use Transaction SE19 to call the implementation name (for example 'ZZ_MG_MASS_NEWSEG') created by you and copy the example-implementation for method 'RETURN_IDOC_TYPE' into the implementation of method 'RETURN_IDOC_TYPE' created by you.Save, check and activate the created implementation for method 'RETURN_IDOC_TYPE'.

    16. Note that the system runs your implementations of BAdI methods 'ADD_NEW_SEGMENT' and 'RETURN_IDOC_TYPE' only if you choose icon 'Activate' (Ctrl+Shift+F4) on the initial screen of Transaction SE19 and if you enter the implementation name you have chosen (for example 'ZZ_MG_MASS_NEWSEG').

    17. The desired append fields that should be generally available in the mass maintenance for changes must be included in the field list (table MASSFLDLST) of the mass maintenance, proceed as follows

        a) Call Transaction MASSOBJ,

        b) select object type 'BUS1001 Materials (industry)' and call 'Application tables',

        c) select the desired table, for example 'MARA', and call the field list,

        d) add and save the necessary new entries.

           In IS-OIL R/3 Systems you must add the following new entries to the field list of the mass maintenance, so that you can select the IS-OIL-specific material master fields in the mass maintenance for changes:

           Object type Table name Field name

           BUS1001 MARA OIGROUPNAM
BUS1001 MARA OITRIND
BUS1001 MARA OIHMTXGR

           BUS1001 MARC OITAXGRP
BUS1001 MARC OIOILCON
BUS1001 MARC OIEDCODE
BUS1001 MARC FDICH
BUS1001 MARC COEFF
BUS1001 MARC UOMGR
BUS1001 MARC UMRSL
BUS1001 MARC ABFAC

           BUS1001 MBEW OITAXKEY
BUS1001 MBEW OIPPINV
BUS1001 MBEW OIHANTYP

    18. In IS-OIL R/3 Systems the mass maintenance functions only correct, if the advance corrections of the IS-OIL-specific Notes 567779 and 593215 are implemented.

    19. The mass maintenance of customer-specific append fields functions only if the prerequisites for the distribution of these fields are fulfilled via ALE :

  • As already described above, the standard IDOCs must be enhanced by customer-specific segments for the mass maintenance and for the ALE distribution of customer-specific append fields.In the ALE inbound processing of the material master maintenance the field values of customer-specific append fields must be transferred from the customer-specific IDOC segment to the internal tables of the ALE inbound processing.For the processing of enhanced IDOCs, enhancement MGV00001 with customer exit EXIT_SAPLMV02_002 is available for the posting of the IDOCs.
     
  • If the checking of foreign key dependencies or of fixed values or another check is needed for a customer field in the ALE inbound processing, you can implement the required checks in function module exit EXIT_SAPLMGMU_001 (SAP enhancement MGA00001).


×