cancel
Showing results for 
Search instead for 
Did you mean: 

IF_USMD_PP_ACCESS Save to Database

benjamin_allsopp
Active Participant
0 Kudos

I've created a custom data model using reuse method,

I need to save the data from the staging table to the database but am having some trouble.

The save method never seems to be called, so I can't put the code in there.

I've put my code in the check method, and saved down to the database based on step number and status.

This works when I press 'Approve' but because the 'Check' button has the same step number and status the data is being saved to the database when the check button is pressed.

The way I see it, I have two options:

1. Add another condition of the action. Is there anywhere in the check method where I can retrieve that the user has pressed 'Approve'?

OR

2. The check method is not the place to save down to the database. If this is the case, where do put my code?

Accepted Solutions (1)

Accepted Solutions (1)

benjamin_allsopp
Active Participant
0 Kudos

We have managed to achieve the results by implementing a secondary access class and custom interface.

Answers (1)

Answers (1)

Former Member
0 Kudos

The save method should be called only when you are "activating" the CR and not during the approval process. You might need to return a success parameter or something from the check method.

However, one thing for sure, you must not save during check because check will be called at different points of time and not only during activation.

benjamin_allsopp
Active Participant
0 Kudos

That makes sense but there doesn't appear to be any flag to set or anyway to call the save method without explicitly calling it which defeats the object because we'd be back to explicitly calling it from the check method.

I've tried looking in to CL_MDG_FS_SFLIGHT_ACCESS as an example and it is saving from the SAVE method but that doesn't help me if mine is never called.

There doesn't appear to be any helpful documentation about it either

former_member276384
Participant
0 Kudos

Dear Benjamin,

I have implemented a Z class inheriting of CL_MDG_BS_BP_ACCESS_MASTER and I have made the reimplementation of IF_USMD_PP_ACCESS~READ_VALUE and IF_USMD_PP_ACCESS~SAVE methods. I have followed the CL_MDG_FS_SFLIGHT_ACCESS implementation as example.

Then, on MDGIMG data model, define a new reuse area and assign the new class:

Then, assign the new reuse area to your custom entities:

We also needed to implement on our MDG7.0 SP04 the SAP notes 2117752 and 2123019. (view thread http://scn.sap.com/thread/3466323)

Best regards,

Jordi.