SAP ABAP Function 'TH_SERVER_LIST'
로그온 한 서버 이름 찾기
서버 이름 = hostname + '_' + SystemID + '_' + SystemNumber
방법 1. : 정확하지 않음
로그온 한 서버 이름이 맨위로 올라 오지 않는 경우 있음.
하나의 host에 여러 시스템 넘버를 가지고 있는 경우도 있음.
data: i_servlist like msxxlist occurs 0 with header line.
call function 'TH_SERVER_LIST'
tables
list = i_servlist
exceptions
no_server_list = 1
others = 2.
if sy-subrc = 0.
read table i_servlist index 1.
if sy-subrc = 0.
i_servlist-name -> 로그온 한 서버이름
endif.
또는
READ TABLE I_SERVLIST WITH KEY HOST = SY-HOST.
i_servlist-name -> 로그온 한 서버이름
endif
방법 2.
data: servername like msxxlist-name.
call 'C_SAPGPARAM'
id 'NAME' field 'rdisp/myname'
id 'VALUE' field servername.
if sy-subrc <> 0.
clear servername.
else.
servername -> -> 로그온 한 서버이름
endif.