cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling Custom/Customer Namespace Table Maintenance via MDC for Business Partner

AKSPAWAR
Newcomer
501

Welcome! to all my fellow MDG consultants. I trust you are in search of content which would help you to implement custom table maintenance via SAP’s MDC framework. Well, your search has ended!!

You have found just the right blog which will hopefully answer all the questions regarding your requirement.

As part of your initial research, I you all might have already scourged the SAP community and knowledge blogs to find the below How to documents.

SAP How-To Guide: Node (Table) Extension for Business Partner in MDG Consolidation and Mass Processi...

SAP How-To Guide: Field Extension for Business Partner/Supplier/Customer in MDG Consolidation and Ma...

SAP Note 2755336 - CMP: Using Custom Namespaces in Enhancements

If you have not had a chance to go through the above documents, now is a good time to do it!!

For those of you who might have already followed the steps mentioned in the above documents and are still struggling with several errors while enabling real-time maintenance of custom table via MDC, I have decided to easy your pain, by sharing my implementation experiences with you.

The remainder of the blog explains the things that I had to additionally to enable real time custom table maintenance via MDC for process model 147 (Business Partner).

Business Requirement:

Enable maintenance of a table /CEECV/ROFI_BPTY via MDC process model 147 (Business Partner).

Steps To be Followed:

Step 1: Enhance the MDC 147 process model with custom table.

Goto transaction MDCIMG >>Configure Process Models and Field Properties >> Configure Process Models

AKSPAWAR_0-1720252897837.png

Add the table /CEECV/ROFI_BPTY in the table lists and select the “Process” check box.

AKSPAWAR_1-1720252934373.png

Specify the join with BUT000 table in the process model.

AKSPAWAR_2-1720252963734.png

AKSPAWAR_3-1720252978799.png

Step 2: Define your custom Data and Model classes.  

Before you generate any process relevant structures for your added custom table it is important that you have defined your own Data and Model classes for processing the 147 (Business Partner) process model.

You can follow the basic instructions mentioned in SAP’s How-To documents (Please refer links provided at the beginning of the blog) for creating and implementing these classes.

The Data Class:

The data class is created by inheriting the standard BP process model’s data class CL_MDC_DATA_BP.

AKSPAWAR_4-1720253527354.png

Re-define the constructor of the original class and write the below lines of code.

super->constructor(
      EXPORTING
        io_model = io_model
      iv_table_name = iv_table_name
      iv_process_id = iv_process_id
      iv_step_number = iv_step_number
      iv_step_type = iv_step_type
      iv_package_size = iv_package_size
      iv_process_relevant = iv_process_relevant
      iv_brfplus_allowed = iv_brfplus_allowed
      iv_omit_rules = iv_omit_rules
      iv_skip_own_system = iv_skip_own_system
    ).

IF me->table_name EQ ‘/CEECV/ROFI_BPTY’.

      me->client_field = ‘CLIENT’.                 “MDC process table’s client field
      me->active_client_field = ‘MANDT’.   “Active tables client field

      me->source_id_field = 'BPNUM'.       “Active tables BPnumber field
 ENDIF.

Trust me, the above lines of code given in the IF condition is going to save you from lot of dumps. Had to debug a lot for this!! Even ended up raising an OSS message to SAP for this :).

The Model Class:

The model class is created by inheriting the standard BP process model’s model class CL_MDC_MODEL_BP.

Typically you need to implement the below methods in your custom model class

  1. MAP_EXTENSIONS_2API

Here you write the code to map your custom table data to Business partner API structures.

  1. SAVE_BUSINESS_PARTNER_ACTIVE 

 Here you write the code to save your additional custom table data to DB.

  1. READ_ALL_DATA

Here you write code to read you custom table data.

For all the three methods the implementations can be done as per the business requirement and there are no additional things to be done in the model class.

You can pretty much refer the standard How-To document to implement the model class.

SAP How-To Guide: Node (Table) Extension for Business Partner in MDG Consolidation and Mass Processi...

Step 3: Generating the MDC process structures and Tables.

The next step is to generate MDC processing tables and structures for your added custom table, which in our case is /CEECV/ROFI_BPTY.

Please refer the below SAP note for this, as the table is in customer namespace.

SAP Note 2755336 - CMP: Using Custom Namespaces in Enhancements

AKSPAWAR_5-1720253748969.png

Also, would like to highlight here that the structure names can be generated as per your requirement.

All that is needed is to redefine the below methods in your custom data class.

It is important that the below code is available and activated before you generate the MDC process structures and tables.

  1. IF_MDC_DATA~ATTRIBUTE_STRUCTURE_NAME

CALL METHOD super->if_mdc_data~attribute_structure_name
      EXPORTING
        iv_name_prefixing = iv_name_prefixing
      RECEIVING
        rv_structure_name = rv_structure_name.

If me->table_name EQ /CEECV/ROFI_BPTY.
        rv_structure_name = '/CEECV/ROBPTY_ATTRIBUTES'.

Endif.

  1. IF_MDC_DATA~KEY_STRUCTURE_NAME

CALL METHOD super->if_mdc_data~key_structure_name
      EXPORTING
        iv_name_prefixing = iv_name_prefixing
      RECEIVING
        rv_structure_name = rv_structure_name.

    If me->table_name EQ ‘/CEECV/ROFI_BPTY’.
        rv_structure_name = '/CEECV/ROBPTY_KEY'.

    Endif.

  1. IF_MDC_DATA~TABLE_NAME_BY_TYPE

rv_table_name = super->if_mdc_data~table_name_by_type( iv_type ).

CASE iv_type.
      WHEN if_mdc_data=>gc_type-source.
        IF me->table_name = ‘/CEECV/ROFI_BPTY’.
          rv_table_name = '/CEECV/RBPTY_SRC'.
        ENDIF.

      WHEN if_mdc_data=>gc_type-process.
        IF me->table_name = ‘/CEECV/ROFI_BPTY’.
          rv_table_name = '/CEECV/RBPTY_PRC'.
        ENDIF.

  1. IF_MDC_DATA~TABLE_TYPE_NAME_BY_TYPE

CALL METHOD super->if_mdc_data~table_type_name_by_type
      EXPORTING
        iv_type            = iv_type
        iv_name_prefixing  = iv_name_prefixing
      RECEIVING
        rv_table_type_name = rv_table_type_name.

CASE iv_type.
      WHEN if_mdc_data=>gc_type-source.
        IF me->table_name = ‘/CEECV/ROFI_BPTY’.
            rv_table_type_name= '/CEECV/TT_ROBPTY_SRC'.
        ENDIF.

      WHEN if_mdc_data=>gc_type-process.
        IF me->table_name = ‘/CEECV/ROFI_BPTY’.
            rv_table_type_name= '/CEECV/TT_ROBPTY_PRC'.
        ENDIF.

The package that will be required to store the generated structures and tables needs to align with the customer namespace in our case /CEECV/. You cannot store a generated customer namespace object in a ‘Z’ or ‘Y ’package.

AKSPAWAR_6-1720253967353.png

That's all Folks!! these were the additional things that I did when enabling custom table maintenance in MDC for Business Partner process model. Hopefully, my experience would be helpful for many other aspiring and budding MDG consultants.

Stay tuned for more!!

Jayashri
Discoverer
0 Kudos
Good Information. Thank you

Accepted Solutions (0)

Answers (0)