4 weeks ago - last edited 4 weeks ago
Hello Experts,
I'm trying my best to use the FM BAPI_USER_CREATE1 so i'll be able to create a user on S/4, since i'm working in a managed scenario i have implemented a determination on save so when a new record is created a method that is using BAPI_USER_CREATE1 will be triggered as shown below
determination createUser on save {create;}
METHOD CreateUser.
READ ENTITIES OF zi_user1_rh IN LOCAL MODE
ENTITY User
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(entites).
LOOP AT entites INTO DATA(entity).
DATA: ls_address TYPE bapiaddr3.
ls_address-firstname = entity-Firstname.
ls_address-lastname = entity-Lastname.
DATA: ls_logondata TYPE bapilogond.
ls_logondata-ustyp = 'A'.
DATA: lv_password TYPE bapipwd VALUE 'passworD123@@',
lv_username TYPE bapibname-bapibname.
lv_username = entity-Username.
ENDLOOP.
CALL FUNCTION 'BAPI_USER_CREATE1'
IN UPDATE TASK
EXPORTING
username = lv_username
logondata = ls_logondata
password = lv_password
address = ls_address.
ENDMETHOD.
PS: Please ignore the password that is being mentioned directly in the code as i'm still testing
Unfortunately that didn't work and i got the below st22 dump.
So i decided to take a different approach, so i create a different method which the same logic as the previous one and made it executable via an action button as shown below
action CreateUser result[1] $self;
However i'm still getting exactly the same dump, i came across many blogs like the below one which indicates that a validation or a determination should work with a FM in a managed scenario.
https://community.sap.com/t5/technology-q-a/adding-custom-code-function-module-in-managed-scenario-s...
And recommendations please ?
Request clarification before answering.
Hi @gzghidi I understood you are able to resolve your issue. I also agree with @suzanne_alivand suggestions to call FM with Destination 'NONE' which was suggested approach from SAP because RAP does not support COMMIT WORK call, because ABAP RAP handles all COMMITS.
But now SAP has come up with solution to this problem or situation. SAP is now suggesting if you need to call any FM or BAPI which has COMMIT statement inside somewhere in standard code, you should generate Proxy class for that BAPI/FM.
A new transaction code is available now /nACO_PROXY which helps you generate Proxy class and Interfaces. For more details how to use this please follow below post:
Hope this helps...
Thanks-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
21 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.