cancel
Showing results for 
Search instead for 
Did you mean: 

MDG Flex Mode - Handler class for Custom Objects

Former Member
0 Kudos

Hi SCN,

I have created a custom Data Model (Flex Mode) and did the complete set-up of the UI and process.

In the GET_DATA method of a feeder class behind one of my UIBB I'm clearing the value of an inputfield based on certain conditions.

When leaving the GET_DATA method the value of the inputfield is cleared which is good, however in the MDG table the old value from before the clear has been saved.

When a value is not correctly saved to the database in MDG BP you can take a look in the handler class mappings 2API, however I can't seem to find a handler class for Cusom Objects.

Is there something similar to a handler class for custom objects where I can investiate why the data is not correctly persisted?

Thank you in advance for your response.

Kind regards,

Niels De Greef

Accepted Solutions (1)

Accepted Solutions (1)

michael_theis
Active Contributor
0 Kudos

Hi Niels,

since you've decided to implement a data model using the flexible storage option, there's no access or handler class available. Those types of classes do exist only if you implement a re-use data model. In that case the access class is responsible for the connection of MDG's framework to the actual re-use area and vice versa.

Using a flexible model, MDG itself takes care of storing and reading the data, in both inactive and active versions.

Your description sounds like a common derivation of master data. For flexible models, MDG offers the "rule service" BAdI. This BAdI is usable for both validating and deriving master data. The same is implemented by MDG's pre-defined data model 0G for financial master data. Even if you don't use this data model in your system, you might take a look at the existing SCN extensibility guides (there's  a specific one describing custom derivations) or at the pre-defined source code in package USMDZ7 (all classes that contain a CL_*_RS_*).

If you really want to stay with your code in the UI level, consider that GET_DATA is the good old "process before output". Anything that you do in GET_DATA only will not be sent to the MDG framework unless you force the system to do the same. Enforcement is possible via the MO_ENTITY that you should have in your feeder class and its methods "SET_ACCESS_ATTRIBUTE" or "SET_PROPERTY". To send this data to the lower layers, you need to get an instance of CL_CRM_BOL_CORE afterwards and then call its "MODIFY" method.

From business perspective I would recommend implementing a derivation in the rule services BAdI. This code is processed in other scenarios (e.g. file import), too. Any code in the feeder class will only be called in the UI that makes use of the feeder.

Best regards

Michael

Former Member
0 Kudos

Hi Michael,

As you recommended I have implemented the rule service for our custom Data Model and now the values are indeed correctly stored.

Thank you very much for your detailled input.

Kind regards,

Niels De Greef

Answers (3)

Answers (3)

shaila_kasha
Contributor
0 Kudos

Hi,

i am facing a similar issue, I am not able to update data on the UI for the custom entity after entering only once. the get_data is not getting the updated data and also my 2API method in the handler class also has the old data.

the data always gets refreshed back to the one i entered first on the list UIBB which is a type 4 custom entity for BP data model with RE-USE option.

Thank you.

sreenu_b2
Explorer
0 Kudos

Hi Niels,


Could you check doing the same in BADI usmd_ui_event2  method MODIFY_VIEW in parameter  CT_DATA.


Regrds

Bandi

former_member219747
Participant
0 Kudos

Hi Niels,

You need to create your's own handler class for this.

Cutom handler class must implement the interface-IF_MDG_BS_BP_ACCESS_HANDLER.

You can refer/inherit from the abstract handler class CL_MDG_BS_FND_HANDLER.

After creating the custom handler class, go to maintenance view(SM30), V_MDG_BS_BP_HDL and create a new entry with data model BP and your class.

Hope this helps you?

Regards,

Mrityunjai

Former Member
0 Kudos

Hi Mrityunjai,

Thank you for your reply.

This is the process for creating a handler for the BP data model I assume?

However in my case we are working with a custom Data Model, so is there a similar maintenance view to register the handler for a custom Data Model?

Kind regards,

Niels De Greef

former_member219747
Participant
0 Kudos

https://help.sap.com/erp_mdg_addon70/helpdata/en/16/a5115454744a18e10000000a423f68/content.htm

Yes Niels, you are correct.

Basically we create this handler class, when we are customizing/extending data model BP.

Please help me to understand your issue in detail.

You have created a custom data model (flex mode), so what is the namespace that you have used here?

If you create a data model with the correct namespace, you don't need a handler class.

When you create a data model in SAP namespace, you need to create a custom handler class and for this I will request you to check the link here-

Regards,

Mrityunjai