标签:
有时候我们知道SAP当前用户登录的ID,也就是SY-UNAME,可以取得用户中文名称,如下:
***取得用户中文名称
DATA: g_sheet_jsr TYPE string. "用户中文名称
DATA: L_DEPARTMENT TYPE AD_DPRTMNT,
L_ADDRNUMBER TYPE AD_ADDRNUM,
L_PERSNUMBER TYPE AD_PERSNUM,
L_UNAME TYPE SY-UNAME,
L_NAME_FIRST TYPE AD_NAMEFIR,
L_NAME_LAST TYPE AD_NAMELAS.
***取得用户中文名称
SELECT SINGLE persnumber addrnumber INTO
(l_persnumber, l_addrnumber)
FROM usr21
WHERE bname = SY-UNAME.
IF sy-subrc = 0.
SELECT SINGLE name_first name_last INTO (l_name_first,l_name_last)
FROM adrp
WHERE persnumber = l_persnumber.
IF sy-subrc = 0.
CONCATENATE l_name_last l_name_first INTO g_sheet_jsr.
CONDENSE g_sheet_jsr NO-GAPS. "去掉空格字符
ENDIF.
ENDIF.
write: g_sheet_jsr.
标签:
原文地址:http://blog.csdn.net/qinyuezhan/article/details/42100719