cancel
Showing results for 
Search instead for 
Did you mean: 

Create entities for another BO inside custom action

Kostiantyn_K
Explorer
0 Kudos

Hello, experts

You only my last hope 🙂

I created RAP app where user creates catalog for example products. That app works fine and no questions here. But users want me to create something like export from that catalog app to another app with some predefined information which no need in Catalog app. I created custom action in Catalog app and I get instances from Catalog app convert it into data which I need for another app add some new data, and the most important that records now have different keys that is why I created another application. Everything works correctly, entities are created by EML like MODIFY ENTITIES... ENTITY... CREATE FIELDS blah blah blah, but in case of errors I can't get reported and failed records tables are empty. I can't use COMMIT ENTITIES and get failed and reported entities inside behavior pull because it is prohibited and I've got error message. May be somebody has ideas how to make that happen, because in other case I have to save data directly into DB tables and I don't want to loose advantages which are provided by using BO with behavior.

Thank you in advance.

P.S. All applications managed without draft, oData 2. ABAP Platform 2022 SP2

P.P.S. @Andre_Fischer maybe you can help, or just give a link where I can read that that is impossible 🙂

 

Kostiantyn_K
Explorer
0 Kudos

Hello,

I've solved the problem. I don't know is it correct solution or not but at least it is solved my problem.

I created RFC function module where I created records for other BO and call commit entities inside that FM. FM has parameter I_COMMIT so I can manage commit work inside FM.

So inside FM I call 

 

 

COMMIT ENTITIES RESPONSE OF z_bo_where_records_created REPORTED DATA(local_table) FAILED DATA(local_table). 

 

 

Collect results messages, whole information which I need and send it back to behavior pool.

Function module should be executed in different LUW in order to not interfere with BO LUW so I call it as showed below

 

 

CALL FUNCTION 'Z_CREATE_OTHER_BO' DESTINATION 'NONE'
   EXPORTING
     IT_DATA = LT_DATA_FOR_CREATION
     I_COMMIT = abap_true
   IMPORTING
     ET_RETURN = lt_return

 

 

Repeat that again 🙂 I don't know is it correct, but at least it works as expected.

View Entire Topic
Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

I would start to add break points in the implementation of the RAP BO that is being called to see what kind of data reaches the RAP BO that is being called.

If this doesn't help I would try to start with an ABAP cross trace.

Working with the ABAP Cross Trace | SAP Help Portal

Kind regards,

Andre 

 

Kostiantyn_K
Explorer
0 Kudos

Hello,

Thank you for your fast answer.

In debug everything good, reported records are saved into reported table, failed are saved into failed table.

So I'll try to use suggested ABAP cross trace.