cancel
Showing results for 
Search instead for 
Did you mean: 

Calling BAPI in RAP Action - managed scenario - BEHAVIOR_ILLEGAL_STATEMENT

0 Kudos
6,459

Hi Experts,

We are using RAP managed scenario which performs CRUD on a custom table which is working fine. Also, we have added a custom action to perform Goods movement 101. For which, I want to call BAPI_GOODSMVT_CREATE.


How can I achieve this ?

I tried below options:

1. ) Calling BAPI directly in Action

2. ) Calling a wrapper FM in update task

both are failing with dump BEHAVIOR_ILLEGAL_STATEMENT.

View Entire Topic
Andre_Fischer
Product and Topic Expert
Product and Topic Expert

I don't see an issue with this. It's the workaround that is available.

In future releases we will offer the option to perform asynchronous calls using a wrapper that we (SAP) will provide for the bgrfc framwork.

In general the problem with using features such as calling a function moduel using destination 'NONE' is that this "breaks" the logical unit of work.

So it can happen that the changes performed by your remote call are committed while the changes in the calling implementation fail late an something like a dump occurs.

Yes Andre, Thanks for explaining it perfectly as always !!! For me it works fine as we are not calling the RFC on 'SAVE' but on an Action Button. We want to just perform an action while major part is to save data that is already performed and after that only this Action is enabled using feature control. So this is an independent event which can not break my SAVE implementation.

My query is answered.

rammel_sapdev
Participant
0 Kudos
Hi Andre, what is the better approach here? We are having a similar issue where we have a custom fiori app that post goods movement using the released RAP BO I_MATERIALDOCUMENTTP. I have created my fiori app using MANAGED with UNMANAGED SAVE. Within the SAVE_MODIFIED, I am trying to create the goods movement but only to realize that this is not allowed. I tried adding the code in the custom determinations but I still think that the code shouldn't be there and should be in the SAVE_MODIFIED. So now, I am looking for ways on how to bundle the updates within the calling RAP BO and the standard RAP BO updates. So far, my options points me to either using CALL RFC DESTINATION NONE and the bgpf framework. In both cases, I want to pass the calling RAP BO data so that I can bundle the updates from within the RFC/class method implementation. Is this the proper way of doing it?