on ‎2023 May 04 10:08 AM

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.
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
The BAPI has to be called in the save_modified method of the save sequence, not in the interaction phase.
So you have to change your behavior definition so that your RAP BO supports an unmanged save
define behavior for /DMO/I_BookSuppl_M alias booksuppl
implementation in class /DMO/BP_BOOKINGSUPPLEMENT_M unique
persistent table /DMO/BOOKSUPPL_M
with unmanaged saveas described here in the documentation
Integrating Unmanaged Save in Managed Business Objects | SAP Help Portal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andre,I set the code as you explained, but a dump is appearing while calling a BAPI inside SAVE_MODIFIED method.
I need to modify a field from LFA1 using a BAPI and executing a COMMIT WORK, but it seems that it's not working:
CALL METHOD lo_vmd_ei_api->maintain_bapi
EXPORTING
is_master_data = l_ti_is_master_data
iv_collect_messages = 'X'
IMPORTING
es_master_data_correct = lv_a
es_message_correct = lv_b
es_master_data_defective = lv_c
es_message_defective = lv_d.
IF lv_d-is_error IS INITIAL AND
lv_d-messages[] IS INITIAL.
"CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
APPEND VALUE #( %tky = lv_lifnr
%msg = new_message( id = 'ZRAP'
number = '000'
v1 = lv_lifnr
severity = if_abap_behv_message=>severity-success )
) TO reported-proveedor.
ELSE.
"CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
If you need to perform a commit (please double-check if this is really necessary) you have to do this asynchronously in a separate session. E.g. by using the new background processing framework that is availble in SAP BTP ABAP Environement and as of 2023 on premise as well.
Hi Andre
I have done the changes in behavior definition and now can see save modified method in my implementation class.
But the keys field(i.e) the input payload is only available in the Action method. (I am creating Inbound Service to be consumed by integration suite)
Is there any way to use BAPI 'BAPI_GOODSMVT_CREATE' in Action method. If not how can pass my payload to the save modified method and also the result as output.
Thanks in advance
Hi Andre,
First of all thanks for your reply and sorry for replying this late, I was really tied up with some other work and I had found a workaround by calling the BAPI as RFC with DESTINATION 'NONE' and it is working fine within the Action code.
Do you see any issue with this ?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 11 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.