sap longon abap选择屏幕代码
时间: 2024-05-16 18:13:10 浏览: 149
以下是 ABAP 中的 SAP 登录屏幕代码示例:
```
REPORT zlogin_screen.
TABLES: dd02l.
PARAMETERS: p_uname TYPE sy-uname,
p_pass TYPE char10.
DATA: lpass TYPE string,
l_exit TYPE sy-subrc,
wa_usr02 TYPE usr02.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_PASS'.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
CONCATENATE p_pass cl_abap_char_utilities=>cr_lf INTO lpass.
CALL FUNCTION 'RSAQ_REMOTE_LOGIN'
EXPORTING
client = sy-mandt
userid = p_uname
password = lpass
EXCEPTIONS
communication = 1
system_failure = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc = 0.
SELECT SINGLE bname name lname
INTO wa_usr02
FROM usr02
WHERE bname = p_uname.
IF sy-subrc = 0.
WRITE: / 'Welcome', wa_usr02-lname.
ENDIF.
ELSEIF sy-subrc = 4.
MESSAGE 'Invalid User ID or Password' TYPE 'E'.
ELSE.
MESSAGE 'Logon Error' TYPE 'E'.
ENDIF.
```
以上代码中,PARAMETERS 语句用于定义输入参数,AT SELECTION-SCREEN OUTPUT 语句用于修改输入屏幕,START-OF-SELECTION 语句用于执行登录操作,使用 CALL FUNCTION 调用函数 RSAQ_REMOTE_LOGIN 实现登录。
阅读全文