Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Call BAPI_USER_CHANGE from RFC in a visual basic application

former_member577095
Participant
0 Likes
1,175

Hi all,

we are developing a tool in order to update users info (SU01).

The BAPI involved is BAPI_USER_CHANGE.

We have a table which contains a set of actions. Each action change one field at time. So, if I nedd to change the first name and last name, I call the BAPI two times.

More or less it works but, some time, it seems that a buffer (some where) is not cleared and one user is filled with the data of the previous user in the table of actions.

To specify the USER ID we use:

Set paramUserName = rfcFunction.Exports("USERNAME")

paramUserName.VALUE = USER_ID

To specify one filed value we use the structures (ADDRESS, LOGONDATA, DEFAULTS, ecc):

Set paramFieldName = rfcFunction.Exports("ADDRESS")

paramFieldName("FIRSTNAME") = "Wallace"

Of course we set the corresponding X in the fileld name involved of the structure ADDRESSX.

We have used other BAPI (eg. PRGN_RFC_DEL_AGRS_IN_COLL_AGR) which invold tables.

In such case we use the freetable statement to clear the table.

Is the a correspoind statement to clear a structure (like ADDRESS in BAPI_USER_CHANGE) ?

Where I can find a detailed documentation of SAP DLL used to make RFC calls ?

Thanks in advance.

Andrea

6 REPLIES 6
Read only

former_member577095
Participant
0 Likes
857

I have seen in other post that calling BAPI_TRANSACTION_COMMIT could be necessary.

When is mandatory call BAPI_TRANSACTION_COMMIT ?

Thanks

Andrea

Read only

0 Likes
857

BAPI_TRANSACTION_COMMIT is neccesary... the Logical Unit of Work of changing the user details need to be committed in SAP.

when is it mandatory:

when the change what you wanted to make is successfull, than BAPI_TRANSACTION_COMMIT need to be called to commit the work.

Read only

0 Likes
857

Hi J@Y,

thanks!!!

Andrea

Read only

0 Likes
857

Do I need to call BAPI_TRANSACTION_COMMIT for each call of BAPI_USER_CHANGE of only once at the end.

In other words:

Case 1:

while not .eof actions

BAPI_USER_CHANGE

BAPI_TRANSACTION_COMMIT

wend

Case 2

while not .eof actions

BAPI_USER_CHANGE

wend

BAPI_TRANSACTION_COMMIT

Read only

0 Likes
857

It would be your call, but the Logical Unit of work need to be committed before coming out of the Unit..

Read only

0 Likes
857

I have added the BAPI_TRANSACTIONS_COMMIT but the results is not changed.

My loop have 11670 actions (12 filelds to update for 1000 users).

It seems tha the some fields values are not refreshed and the value is the same as the previous users.

The e-mail field is changed for alla users but always with the value of the first user.

My opinion is that is necessary to clear the input parameters of the structure ADDRESS and ADDRESSX before fill it again and call tha BAPI again.

I have tried to use the freetable statement but it is not accepted by VBA.

Any suggestions ?

Thanks

Andrea