cancel
Showing results for 
Search instead for 
Did you mean: 

Bopf: Modify in BAdI while do_save

0 Kudos
891

Hi all,

I try do save data via bopf in BAdI /SCMTMS/TOR_SE_GEN_RQ_OUT.

When it's regenerated by transaction sppfp it works.Because in that case I could call transaction_manager, finalize, save etc.

It also worked when the bopf is in state interaction. Here it is enough if i call the modify method.

But at the creation the PPF action is customized while save. So the TM freight order bopf set a commit work and the bopf is in state do_save.

Is it not possible to work with the service_manager->modify here? How could I solve this?

Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

a_scheer
Employee
Employee
0 Kudos

Hello Stefan,

please note that the general purpose of BAdI /SCMTMS/TOR_SE_GEN_RQ_OUT is to adapt the standard mapping of the TransportationOrderGenericRequest_Out message. Writing or saving new data at this point in time is in general difficult, because the PPF framework runs as a post-save plugin in BOPF, and at this point in time BOPF will not allow any more modifications. At this point in time, the "Before Save - Finalize" determination cycle is already over. The only way to write data into custom tables at this point in time would be direct DB inserts (which is of course not recommended in general).

The reason that executing the action via transaction SPPFP works is that in this case we are not in the BOPF save cycle.

Best regards,

Alexander

0 Kudos

Hello Alexander,

I thought something like that. We are currently filling additional ASN fields in our BAdI implementation or making a custom mapping. So we would like to have something like a run log or slg1 entries in which we can write what we have changed.

If necessary, we can also write this as an insert. When creating the ASN via idoc, we still had a timepoint afterwards in which we could save our changes/log. But of course, that was possible with modules in update task.

Best regards

Stefan

former_member190794
Active Participant
0 Kudos

Hello Stefan,

while execution of a certain “do_save”-determination (BOPF's "do_save" phase), it is not allowed to modify any other business object than the business object to which the currently processed “do_save”-determination has been assigned to. If a modify request to a foreign business object is required, it basically would be possible to implement this leveraging a “finalize”-determination. At that point during the early save phase, modifications of foreign business objects are possible. However, please obey that after the finalize-phase, the transaction could be turned back into interaction phase (e.g. in case of a failed consistency validation) and could be afterwards finalized again - or cleaned up.

As far as I understood the issue, you invoke the BOPF modify during the “do_save” phase of BAdI /SCMTMS/TOR_SE_GEN_RQ_OUT of a PPF action. So I would recommend to open a ticket on the BAdI owner/ TM and describe the need for modifying a certain BO at that late state and what is the use case for your demand.

Best regards
Tilmann

0 Kudos

Hello Tilmann,

thank you for your reply.

Yes, I would like to save data in a customer table when creating the ASN. I.e when the SAP standard PPF action TOR_TPNOR_ASN creates an ASN, the BAdI /SCMTMS/TOR_SE_GEN_RQ_OUT is run through.

There I tried to write the entry with bopf modify.

If the ppf action is repeated in transaction SPPFP, it works.

But not when saving the freight order. (do_save of another business object)

I.e. it would be my business object that I would like to change there.

Would leveraging a "finalize" determination also work in that case?

Best regards

Stefan