on 03-17-2023 1:09 PM
Hey,
I need some swarm knowledge. How exactly can I use BAPIs in the RAP environment?
I have a managed RAP app and this app should get a simple action:
action ( features: instance ) createUser result [1] $self;
and execute the BAPI - BAPI_USER_CREATE1.
According to my current research, there seems to be a possibility about using "with unmanaged save".
There I can redefine the save_modified method in the cl_abap_behavior_saver, is these right? But do I now have to implement every modify in this method itself?
I just want to use this BAPI and preferably uncomplicated within my managed app
regards
Tim
Hi Tim,
Since that it is managed implementation, and you have an instance bound action for creation of user, I don't see any harm in calling BAPI_USER_CREATE inside the action handler method itself if the interaction & save sequence are in same LUW because BAPI's usually comes with the checks of validations in built so if you have any errors upon creation of user then you can fill FAILED & REPORTED table in the action handler method itself and framework will call COMMIT ENTITIES is there are no errors.
OR
Suppose if would have a case to create a user on SAVE then it would be possible by implementing in below two ways:
1. Additional Save - Here RAP Managed framework will handle the save by default, but it will provide you a hook in the late save phase i.e SAVE_MODIFIED [ i.e local handler save class must inherit from the class cl_abap_behavior_saver ], if you want to perform additional save functionality e.g Application logging and so on.
If your case is just to create a user and you want RAP framework to handle interaction & save phase, then it is better to implement the "Validation on Save" to check the BAPI is consistent for creating a user suppose if there are any errors then the FAILED response can be sent back to UI thereby stopping the creation of user and the SAVE_MODIFIED can be redefined base on the use case to check for CREATE-ENTITY / UPDATE-ENTITY / DELETE-ENTITY and call the BAPI accordingly.
2. Unmanaged Save - Here RAP Managed framework will handle interaction and early save phase only so here saving the data to the persistent table is the responsibility of the developer as the framework will provide the hook in the late save phase i.e SAVE_MODIFIED [ i.e local handler save class must inherit from the class cl_abap_behavior_saver ],eg. suppose if you have a legacy FM that will help you to save data in those persistent tables.
Suppose if you choose unmanaged save also then also it is better to implement the "Validation on Save" to check the BAPI is consistent for creating a user suppose if there are any errors then the FAILED response can be sent back to UI thereby stopping the creation of user and the SAVE_MODIFIED can be redefined base on the use case to check for CREATE-ENTITY / UPDATE-ENTITY / DELETE-ENTITY and call the BAPI accordingly.
Thanks,
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tim,
Are you calling the BAPI in update task as it is not valid? If not then may be some of the statements called inside BAPI are not valid in the RAP context as stated in the error analysis.
Please try to call BAPI asynchronously in a NEW TASK so that processing of the BAPI happens in the new session.
Thanks,
Pavan
User | Count |
---|---|
75 | |
10 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.