on 2024 Jul 06 9:27 AM
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 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
Add the table /CEECV/ROFI_BPTY in the table lists and select the “Process” check box.
Specify the join with BUT000 table in the process model.
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.
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
Here you write the code to map your custom table data to Business partner API structures.
Here you write the code to save your additional custom table data to DB.
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.
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
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.
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.
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.
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.
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.
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!!
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.