-
Notifications
You must be signed in to change notification settings - Fork 1
/
ucopy.abap
69 lines (59 loc) · 1.85 KB
/
ucopy.abap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
REPORT zsbucopy1.
DATA:
uname_from LIKE bapibname-bapibname VALUE 'UNAMEFROM',
ls_logondata TYPE bapilogond,
ls_defaults TYPE bapidefaul,
ls_address TYPE bapiaddr3,
ls_company TYPE bapiuscomp,
lt_parameter TYPE STANDARD TABLE OF bapiparam,
lt_profiles TYPE STANDARD TABLE OF bapiprof,
lt_activitygroups TYPE STANDARD TABLE OF bapiagr,
lt_return TYPE STANDARD TABLE OF bapiret2,
lt_parameter1 TYPE STANDARD TABLE OF bapiparam1,
lt_groups TYPE STANDARD TABLE OF bapigroups,
uname_to LIKE bapibname-bapibname VALUE 'UNAMETO',
is_password TYPE bapipwd.
is_password-bapipwd = 'Init2014'.
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = uname_from
cache_results = ' '
IMPORTING
logondata = ls_logondata
defaults = ls_defaults
address = ls_address
company = ls_company
TABLES
parameter = lt_parameter
profiles = lt_profiles
activitygroups = lt_activitygroups
return = lt_return
parameter1 = lt_parameter1
groups = lt_groups.
MOVE uname_to TO: ls_address-lastname, ls_address-fullname.
CALL FUNCTION 'BAPI_USER_CREATE1'
EXPORTING
username = uname_to
logondata = ls_logondata
password = is_password
defaults = ls_defaults
address = ls_address
company = ls_company
ref_user = uname_from
TABLES
parameter = lt_parameter
return = lt_return
groups = lt_groups
parameter1 = lt_parameter1.
CALL FUNCTION 'BAPI_USER_PROFILES_ASSIGN'
EXPORTING
username = uname_to
TABLES
profiles = lt_profiles
return = lt_return.
CALL FUNCTION 'BAPI_USER_ACTGROUPS_ASSIGN'
EXPORTING
username = uname_to
TABLES
activitygroups = lt_activitygroups
return = lt_return.