Skip to Content
0
Former Member
Mar 07, 2007 at 03:09 PM

BAPI_USER_ACTGROUPS_ASSIGN does not work as advertised

1330 Views

I've written a user conversion program that utilizes BAPI_USER_ACTGROUPS_ASSIGN to assign roles to users. This bapi does not work. The first userid in the file gets assigned his/her role. However subsequent user roles are not saved to the database even though the bapi return a successful message. To test this:

1. Create 3 users via SU01. Call then AAA, BBB, CCC. Do not assign roles.

2. Create and execute the code below.

3. In my system the bapi only saves roles for AAA.

report ZROLES.

data: v_userid like bapibname-bapibname.

data: actgroups type bapiagr occurs 0 with header line.

data: return like bapiret2 occurs 0 with header line.

start-of-selection.

do.

case sy-index.

when 1.

v_userid = 'AAA'.

when 2.

v_userid = 'BBB'.

when 3.

v_userid = 'CCC'.

when others.

exit.

endcase.

refresh: actgroups,

return.

clear return.

actgroups-agr_name = 'SAP_ISA_B2B_ORDER'.

actgroups-from_dat = '20070201'.

actgroups-to_dat = '20070401'.

append actgroups.

actgroups-agr_name = 'SAP_ISA_B2B_VIEW'.

actgroups-from_dat = '20070201'.

actgroups-to_dat = '20070401'.

append actgroups.

call function 'BAPI_USER_ACTGROUPS_ASSIGN'

exporting

username = v_userid

tables

activitygroups = actgroups

return = return.

write:/ v_userid.

loop at return.

write:/ return-type, return-message.

endloop.

skip.

enddo.