有时候需要在用户登录时sap时触发一特定程序去执行,sap提供了两种方法t.
1) 使用函数 'NAVIGATION_SET_START_TCODE' ,用该函数可以设置用户和一个TCODE,该TCODE当用户登录sap系统后就可以自动执行。sap对应的程序:ADMIN_SET_START_TRANSACTION_FO
2)使用用户出口
该用户出口的模块名称是:SUSR0001,你可以在该单元里增加你的代码进行相应的控制。.
ADMIN_SET_START_TRANSACTION_FO 程序如下:
*& Report ADMIN_SET_START_TRANSACTION_FO *
REPORT ADMIN_SET_START_TRANSACTION_FO.
tables: usr02, tstc.
data: start_tcode_dummy like sy-tcode.
data: i_usr02 like usr02 occurs 0 with header line.
parameters: sttcd like sy-tcode.
parameters: over as checkbox.
parameters: all as checkbox.
parameters: user1 like sy-uname.
parameters: user2 like sy-uname.
parameters: user3 like sy-uname.
parameters: user4 like sy-uname.
parameters: user5 like sy-uname.
parameters: user6 like sy-uname.
parameters: user7 like sy-uname.
parameters: user8 like sy-uname.
parameters: user9 like sy-uname.
parameters: user10 like sy-uname.
data: hex01 type x value '01'.
AUTHORITY-CHECK OBJECT 'S_USER_GRP'
ID 'CLASS' FIELD '*'
ID 'ACTVT' FIELD '02'.
if sy-subrc <> 0. message i203(s#). exit. endif.
select single * from tstc where tcode = sttcd.
if ( sy-subrc <> 0 or tstc-cinfo o hex01 ) and sttcd <> space.
MESSAGE S466(SF) WITH sttcd. exit.
endif.
if all = 'X'.
select * from usr02 into table i_usr02.
else.
select single * from usr02 where bname = user1.
if sy-subrc = 0. i_usr02-bname = user1. append i_usr02. endif.
select single * from usr02 where bname = user2.
if sy-subrc = 0. i_usr02-bname = user2. append i_usr02. endif.
select single * from usr02 where bname = user3.
if sy-subrc = 0. i_usr02-bname = user3. append i_usr02. endif.
select single * from usr02 where bname = user4.
if sy-subrc = 0. i_usr02-bname = user4. append i_usr02. endif.
select single * from usr02 where bname = user5.
if sy-subrc = 0. i_usr02-bname = user5. append i_usr02. endif.
select single * from usr02 where bname = user6.
if sy-subrc = 0. i_usr02-bname = user6. append i_usr02. endif.
select single * from usr02 where bname = user7.
if sy-subrc = 0. i_usr02-bname = user7. append i_usr02. endif.
select single * from usr02 where bname = user8.
if sy-subrc = 0. i_usr02-bname = user8. append i_usr02. endif.
select single * from usr02 where bname = user9.
if sy-subrc = 0. i_usr02-bname = user9. append i_usr02. endif.
select single * from usr02 where bname = user10.
if sy-subrc = 0. i_usr02-bname = user10. append i_usr02. endif.
endif.
loop at i_usr02 where bname <> space.
clear start_tcode_dummy.
if over = space.
CALL FUNCTION 'NAVIGATION_GET_START_TCODE'
EXPORTING
UNAME = i_usr02-bname
IMPORTING
START_TCODE = start_tcode_dummy.
endif.
if start_tcode_dummy = space.
CALL FUNCTION 'NAVIGATION_SET_START_TCODE'
EXPORTING
UNAME = i_usr02-bname
START_TCODE = sttcd.
endif.
endloop.
阅读(616) | 评论(0) | 转发(0) |