728x90

Function 그룹 : XUSR

모듈 : EXIT_SAPLSUSF_001

INCLUDE : ZXUSRU01

*&---------------------------------------------------------------------*
*&  Include           ZXUSRU01
*&---------------------------------------------------------------------*
 
TABLES: UINFO.
DATA: N TYPE I VALUE 5.         "<- 최대 허용 중복 로그인 수치
DATA: OPCODE TYPE X VALUE 2, I TYPE I, A(60), N_C(3), B(250), c(250), TEMP_A(250),
          TEMP_B(250), TEMP_C(250),TEMP_D(250).
DATA: I_n TYPE I VALUE 4.
DATA: BEGIN OF BDC_TAB1 OCCURS 5.
        INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDC_TAB1.
 
DATA: BEGIN OF USR_TABL OCCURS 10.
        INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
 
DATA: GT_USR41 LIKE USR41 OCCURS 0 WITH HEADER LINE.
 
* 예외처리할 ID있으면 아래에 표시
IF  SY-UNAME <> 'ADMIN'
      AND SY-UNAME <> 'SAP*'
      AND SY-UNAME <> 'INTERFACE'
      AND SY-UNAME <> 'DDIC'
      AND SY-UNAME <> 'DDID'
      AND SY-UNAME <> 'ALEREMOTE'
      AND SY-UNAME <> 'BWREMOTE'
      AND SY-UNAME <> 'IF_BIZTALK'
      AND SY-UNAME <> 'ALEREMOTE'
      AND SY-UNAME <> 'RSDUSER'
      AND SY-UNAME <> 'SAPCPIC'
      AND SY-UNAME <> 'TMSADM'.
 
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
  ID 'TAB' FIELD USR_TABL-*SYS*.
 
LOOP AT USR_TABL.
  IF SY-UNAME = USR_TABL-BNAME AND SY-MANDT = USR_TABL-MANDT.
    I = I + 1.
  ENDIF.
 
ENDLOOP.
 
 
  SELECT *
  INTO TABLE GT_USR41
  FROM USR41
  WHERE BNAME = SY-UNAME.
 
    I_n = 0.
    TEMP_C = ''.
    TEMP_D = ''.
 
  LOOP AT GT_USR41.
    TEMP_A  = GT_USR41-TERMINAL.
    TEMP_B  = '  /  '.
    I_n  = I_n + 1.
    IF I_n < 3 .
      CONCATENATE  TEMP_A TEMP_B TEMP_C INTO TEMP_C.
    ELSEIF I_N < 5.
      CONCATENATE  TEMP_A TEMP_B TEMP_D INTO TEMP_D.
    ENDIF.
  ENDLOOP.
 
IF I >= N.
 
    N_C = I - 1.
 
    CONCATENATE ''  SY-UNAME '  계정이 현재  '  N_C ' 개가  로그인  되어  있습니다' INTO A.
 
      CALL FUNCTION 'POPUP_TO_INFORM'
           EXPORTING
                TITEL = 'SAP ID 정책 위반 안내'
                TXT1  = A
                TXT2  = '중복 로그인 정책에 위반되어 종료 합니다, 접속된 PC명 : '
                TXT3  = TEMP_C
                TXT4 =  TEMP_D.
 
      MOVE: 'SAPMSSY0' TO BDC_TAB1-PROGRAM,
              '120' TO BDC_TAB1-DYNPRO,
              'X' TO BDC_TAB1-DYNBEGIN.
      APPEND BDC_TAB1.CLEAR BDC_TAB1.
      MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
             '/nex' TO BDC_TAB1-FVAL.
      APPEND BDC_TAB1.CLEAR BDC_TAB1.
 
      CALL TRANSACTION 'SM04' USING BDC_TAB1 MODE 'N'.
 
ENDIF.
ENDIF.

반응형

'5. SAP' 카테고리의 다른 글

[PowerBuilder] - P.B 와 SAP 연결  (0) 2022.12.14
[1th] SAP 공부 해보자 - 1일차  (0) 2022.02.23
SAP R3 ABAP 프로그램 정리.  (0) 2020.10.08
SAP HANA 장점  (0) 2020.10.01
SAP S/4 HANA이란?  (0) 2020.10.01

+ Recent posts