cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP RAP MAP_MESSAGES is not triggerred when foreign entity finalize() save sequence fails

SameerPanigrahi
Newcomer
0 Kudos

I have create a custom managed RAP BO. In the interaction phase, when the action processInstance is triggered, I create a Purchase Requisition using EML MODIFY statement

 

 

"pseudo code
method processInstance "for RAP action

      ...
     MODIFY ENTITIES OF i_purchaserequisitiontp
     ENTITY purchaserequisition
     CREATE FIELDS (
                     PurchaseRequisitionType
                     PurReqnDescription )
     WITH VALUE #(   ( %cid                    = |My%CID_{ counter }|
                       PurchaseRequisitionType = purchaseRequisitionType
                       PurReqnDescription      = purReqnDescription ) )
      ...
      ...
endmethod.

 

 

The action also triggers the save sequence.

In the save phase, the foreign entity I_PurchaseRequisitionTP fails in the finalize() method and returns the error messages in the reported structure.

I want to log these error messages.

So, I declare this foreign entity in my BO behavior base definition (not in the Consumption Behavior Definition)

 

 

managed implementation in class zbp_i_pr_mass_upload unique;
strict ( 2 );
  foreign entity I_PurchaseRequisitionTP alias PurchaseRequisition;
  foreign entity I_PurchaseReqnItemTP alias PurchaseRequistionItems;


define behavior for ZI_PR_MASS_UPLOAD alias filestore
with additional save
...
...

 

 

And in my generate class from managed BO, I have explicitly redefined the MAP_MESSAGES method.

 

 

"managed RAP behaviour class implementation
"save sequence
CLASS lsc_zi_pr_mass_upload DEFINITION INHERITING FROM cl_abap_behavior_saver.
  PROTECTED SECTION.
    METHODS save_modified REDEFINITION.
    METHODS map_messages REDEFINITION.
ENDCLASS.

CLASS lsc_zi_pr_mass_upload IMPLEMENTATION.
  METHOD map_messages.
    CHECK reported IS NOT INITIAL.
    "logic to log the errors from foreign entity follows
  ENDMETHOD.

 

 

When I do a test run from the UI preview, the map_message method is not triggered (even the breakpoints do not hit)

I am referring to Message Mapping | SAP Help Portal where it mentions that -

...If [map_messages is] implemented, the method is called immediately after every invocation of a saver class that has returned messages in reported. This means that the message mapping occurs before the messages are processed further by the RAP framework...

 

Can someone guide what am I missing?

 

@Andre_Fischer - Could you please guide

Accepted Solutions (0)

Answers (0)