모듈 : BC
기능 설명 : 오라클 테이블스페이스 이력 기록 및 여유공간 알람 프로그램
사용 예시 : 각 테이블스페이스 사용량/여유량 이력 관리, 여유공간 부족시 사용자 알림
1. 소스 코드
***********************************************************************
* Report : ZBC_ORA_DBTS_RECORD *
* Module/Sub-Module : BC *
* Description : Oracle DB Tablespace Recods and Alarm *
***********************************************************************
* MODIFICATION LOG *
* *
* DATE AUTHORS DESCRIPTION *
* ---------- ------------------ ------------------------------------- *
* YHJ Initial Release *
***********************************************************************
REPORT ZBC_ORA_DBTS_RECORD.
*----------------------------------------------------------------------*
* TYPE-POOLS
*----------------------------------------------------------------------*
TYPE-POOLS: SLIS, ICON.
*----------------------------------------------------------------------*
* TABLES
*----------------------------------------------------------------------*
TABLES: ZBC_DBTS_RECORD.
TABLES: SSCRFIELDS.
*----------------------------------------------------------------------*
* DATA
*----------------------------------------------------------------------*
DATA: GT_DATA LIKE TABLE OF ZBC_DBTS_RECORD WITH HEADER LINE.
DATA: GT_TS LIKE TABLE OF TABLE_SPC WITH HEADER LINE.
DATA: BEGIN OF GV_SID OCCURS 0,
RFCSID TYPE STRING,
TXTSID TYPE STRING.
DATA: END OF GV_SID.
DATA: TS_DATE TYPE D,
TS_TIME TYPE T.
DATA: GT_USR21 LIKE TABLE OF USR21 WITH HEADER LINE,
GT_ADCP LIKE TABLE OF ADCP WITH HEADER LINE,
GT_ADRP LIKE TABLE OF ADRP WITH HEADER LINE,
GT_ADR6 LIKE TABLE OF ADR6 WITH HEADER LINE.
DATA: L_SENT_TO_ALL(1) TYPE C.
DATA: FUNCTXT TYPE SMP_DYNTXT.
DATA: IT_FIELDS TYPE STANDARD TABLE OF SVAL WITH HEADER LINE.
*----------------------------------------------------------------------*
* SELECTION-SCREEN
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t001.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE t002.
PARAMETERS: S_SR3A(10) TYPE N DEFAULT '0'.
PARAMETERS: S_USRA(10) TYPE N DEFAULT '0'.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE t003.
PARAMETERS: S_DATE TYPE D DEFAULT '000000'.
PARAMETERS: S_TIME TYPE T DEFAULT '000000'.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE t004.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (20) t100.
SELECTION-SCREEN COMMENT (10) t041.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (20) t042 FOR FIELD P_MAIL1.
PARAMETERS: P_MAIL1 LIKE SOMLRECI1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (20) t043 FOR FIELD P_MAIL2.
PARAMETERS: P_MAIL2 LIKE SOMLRECI1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B4.
SELECTION-SCREEN: FUNCTION KEY 1.
AT SELECTION-SCREEN.
PERFORM MENU_SELECT.
AT SELECTION-SCREEN OUTPUT.
PERFORM MODIFY_SCREEN.
*----------------------------------------------------------------------*
* INITIALIZATION *
*----------------------------------------------------------------------*
INITIALIZATION.
PERFORM INITIAL.
SSCRFIELDS-FUNCTXT_01 = FUNCTXT.
FUNCTXT-ICON_ID = ICON_ALARM.
FUNCTXT-QUICKINFO = 'CHG_ALERT_VALUE'.
FUNCTXT-ICON_TEXT = 'CHG ALERT VALUE'.
MOVE 'DB TableSpace Record' TO t001.
MOVE 'Warning Threshold' TO t002.
MOVE 'DB TableSpace Timestamp' TO t003.
MOVE 'Alarm Mail Recipient' TO t004.
MOVE 'Mail' TO t041.
MOVE 'Recipient 1' TO t042.
MOVE 'Recipient 2' TO t043.
MOVE ' ' TO t100.
*----------------------------------------------------------------------*
* START-OF-SELECTION.
*----------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM PREPARE_SELECT.
PERFORM SELECT_DATA.
*----------------------------------------------------------------------*
* END-OF-SELECTION.
*----------------------------------------------------------------------*
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& ZBC_DBTS_ARCH_F01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form PREPARE_SELECT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PREPARE_SELECT .
DATA: TEMP_DATE TYPE D.
REFRESH: GT_TS, GT_DATA.
CALL FUNCTION 'DB02_ORA_FILL_TS'
EXPORTING
FLAG_REFRESH = 'Y'
IMPORTING
CURR_DATE = TS_DATE
CURR_TIME = TS_TIME
TABLES
TS = GT_TS.
ENDFORM. " PREPARE_SELECT
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SELECT_DATA .
DATA: LT_DATA LIKE TABLE OF ZBC_DBTS_RECORD WITH HEADER LINE,
LT_RECORD LIKE TABLE OF ZBC_DBTS_RECORD WITH HEADER LINE.
DATA: TEMP_DAY(2) TYPE C,
TEMP_MTH(2) TYPE C,
TEMP_DATE TYPE D,
TEMP_USED1 TYPE I,
TEMP_USED2 TYPE I,
TEMP_CHGR TYPE F,
TEMP_CHGR_T TYPE I.
REFRESH: LT_DATA, LT_RECORD. CLEAR: LT_DATA, LT_RECORD, TEMP_DAY.
IF GT_TS[] IS NOT INITIAL.
"### 일일 TableSpace 기록
LT_DATA-ARCHDATE = TS_DATE.
LT_DATA-ARCHTIME = TS_TIME.
LT_DATA-FLG = 'D'.
TEMP_DATE = TS_DATE - 7.
SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_RECORD
FROM ZBC_DBTS_RECORD
WHERE ( ARCHDATE >= TEMP_DATE AND ARCHDATE =< TS_DATE )
AND FLG = 'D'.
SORT LT_RECORD STABLE BY ARCHDATE DESCENDING ARCHTIME DESCENDING.
READ TABLE LT_RECORD INDEX 1.
LOOP AT GT_TS.
CLEAR: TEMP_USED1, TEMP_USED2, TEMP_CHGR, TEMP_CHGR_T.
IF GT_TS-TS = 'PSAPSR3'.
"### 현재 현황 기록
LT_DATA-SR3_TOTL = ( GT_TS-TSIZE / 1024 ).
LT_DATA-SR3_FREE = ( GT_TS-TFREE / 1024 ).
LT_DATA-SR3_UPCT = GT_TS-TPCTUSED.
TEMP_USED1 = ( GT_TS-TSIZE / 1024 ) - ( GT_TS-TFREE / 1024 ).
LT_DATA-SR3_USED = TEMP_USED1.
TEMP_USED2 = LT_DATA-SR3_USED - LT_RECORD-SR3_USED.
LT_DATA-SR3_CHG = TEMP_USED2.
"### 증감량 계산 로직
IF LT_RECORD-SR3_USED <> '0'.
TEMP_CHGR_T = LT_DATA-SR3_USED - LT_RECORD-SR3_USED.
TEMP_CHGR = ( TEMP_CHGR_T / LT_RECORD-SR3_USED ) * 100.
ENDIF.
LT_DATA-SR3_CHGR = TEMP_CHGR.
"### 알림 임계점 저장
LT_DATA-SR3_ALM = S_SR3A.
"### 여유공간 경고 체크 로직
IF LT_DATA-SR3_FREE <= S_SR3A.
PERFORM ALERT_MAIL USING GT_TS-TS LT_DATA-SR3_FREE.
ENDIF.
ENDIF.
IF GT_TS-TS = 'PSAPSR3USR'.
"### 현재 현황 기록
LT_DATA-USR_TOTL = ( GT_TS-TSIZE / 1024 ).
LT_DATA-USR_FREE = ( GT_TS-TFREE / 1024 ).
LT_DATA-USR_UPCT = GT_TS-TPCTUSED.
TEMP_USED1 = ( GT_TS-TSIZE / 1024 ) - ( GT_TS-TFREE / 1024 ).
LT_DATA-USR_USED = TEMP_USED1.
TEMP_USED2 = TEMP_USED1 - LT_RECORD-USR_USED.
LT_DATA-USR_CHG = TEMP_USED2.
"### 증감량 계산 로직
IF LT_RECORD-USR_USED <> '0'.
TEMP_CHGR_T = LT_DATA-USR_USED - LT_RECORD-USR_USED.
TEMP_CHGR = ( TEMP_CHGR_T / LT_RECORD-USR_USED ) * 100.
ENDIF.
LT_DATA-USR_CHGR = TEMP_CHGR.
"### 알림 임계점 저장
LT_DATA-USR_ALM = S_USRA.
"### 여유공간 경고 체크 로직
IF LT_DATA-USR_FREE <= S_USRA.
PERFORM ALERT_MAIL USING GT_TS-TS LT_DATA-USR_FREE.
ENDIF.
ENDIF.
ENDLOOP.
MOVE-CORRESPONDING LT_DATA TO GT_DATA. APPEND GT_DATA.
"### 월간 TableSpace 기록
REFRESH: LT_DATA, LT_RECORD. CLEAR: LT_DATA, LT_RECORD, TEMP_DAY.
TEMP_DAY = TS_DATE+6(2).
IF TEMP_DAY = '01'.
LT_DATA-ARCHDATE = TS_DATE.
LT_DATA-ARCHTIME = TS_TIME.
LT_DATA-FLG = 'M'.
TEMP_DATE = TS_DATE - 40.
SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_RECORD
FROM ZBC_DBTS_RECORD
WHERE ( ARCHDATE >= TEMP_DATE AND ARCHDATE <= TS_DATE )
AND FLG = 'M'.
SORT LT_RECORD STABLE BY ARCHDATE DESCENDING ARCHTIME DESCENDING.
READ TABLE LT_RECORD INDEX 1.
LOOP AT GT_TS.
CLEAR: TEMP_USED1, TEMP_USED2, TEMP_CHGR.
IF GT_TS-TS = 'PSAPSR3'.
LT_DATA-SR3_TOTL = ( GT_TS-TSIZE / 1024 ).
LT_DATA-SR3_FREE = ( GT_TS-TFREE / 1024 ).
LT_DATA-SR3_UPCT = GT_TS-TPCTUSED.
TEMP_USED1 = ( GT_TS-TSIZE / 1024 ) - ( GT_TS-TFREE / 1024 ).
LT_DATA-SR3_USED = TEMP_USED1.
TEMP_USED2 = TEMP_USED1 - LT_RECORD-SR3_USED.
LT_DATA-SR3_CHG = TEMP_USED2.
IF LT_RECORD-SR3_USED <> '0'.
TEMP_CHGR_T = LT_DATA-SR3_USED - LT_RECORD-SR3_USED.
TEMP_CHGR = ( TEMP_CHGR_T / LT_RECORD-SR3_USED ) * 100.
ENDIF.
LT_DATA-SR3_CHGR = TEMP_CHGR.
ENDIF.
IF GT_TS-TS = 'PSAPSR3USR'.
LT_DATA-USR_TOTL = ( GT_TS-TSIZE / 1024 ).
LT_DATA-USR_FREE = ( GT_TS-TFREE / 1024 ).
LT_DATA-USR_UPCT = GT_TS-TPCTUSED.
TEMP_USED1 = ( GT_TS-TSIZE / 1024 ) - ( GT_TS-TFREE / 1024 ).
LT_DATA-USR_USED = TEMP_USED1.
TEMP_USED2 = TEMP_USED1 - LT_RECORD-USR_USED.
LT_DATA-USR_CHG = TEMP_USED2.
IF LT_RECORD-USR_USED <> '0'.
TEMP_CHGR_T = LT_DATA-USR_USED - LT_RECORD-USR_USED.
TEMP_CHGR = ( TEMP_CHGR_T / LT_RECORD-USR_USED ) * 100.
ENDIF.
LT_DATA-USR_CHGR = TEMP_CHGR.
ENDIF.
ENDLOOP.
MOVE-CORRESPONDING LT_DATA TO GT_DATA. APPEND GT_DATA.
ENDIF.
"### 연간 TableSpace 기록
REFRESH: LT_DATA, LT_RECORD. CLEAR: LT_DATA, LT_RECORD, TEMP_DAY.
TEMP_MTH = TS_DATE+4(2).
TEMP_DAY = TS_DATE+6(2).
IF ( TEMP_MTH = '01' ) AND ( TEMP_DAY = '01' ).
LT_DATA-ARCHDATE = TS_DATE.
LT_DATA-ARCHTIME = TS_TIME.
LT_DATA-FLG = 'Y'.
TEMP_DATE = TS_DATE - 400.
SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_RECORD
FROM ZBC_DBTS_RECORD
WHERE ( ARCHDATE >= TEMP_DATE AND ARCHDATE <= TS_DATE )
AND FLG = 'Y'.
SORT LT_RECORD STABLE BY ARCHDATE DESCENDING ARCHTIME DESCENDING.
READ TABLE LT_RECORD INDEX 1.
LOOP AT GT_TS.
CLEAR: TEMP_USED1, TEMP_USED2, TEMP_CHGR.
IF GT_TS-TS = 'PSAPSR3'.
LT_DATA-SR3_TOTL = ( GT_TS-TSIZE / 1024 ).
LT_DATA-SR3_FREE = ( GT_TS-TFREE / 1024 ).
LT_DATA-SR3_UPCT = GT_TS-TPCTUSED.
TEMP_USED1 = ( GT_TS-TSIZE / 1024 ) - ( GT_TS-TFREE / 1024 ).
LT_DATA-SR3_USED = TEMP_USED1.
TEMP_USED2 = TEMP_USED1 - LT_RECORD-SR3_USED.
LT_DATA-SR3_CHG = TEMP_USED2.
IF LT_RECORD-SR3_USED <> '0'.
TEMP_CHGR_T = LT_DATA-SR3_USED - LT_RECORD-SR3_USED.
TEMP_CHGR = ( TEMP_CHGR_T / LT_RECORD-SR3_USED ) * 100.
ENDIF.
LT_DATA-SR3_CHGR = TEMP_CHGR.
ENDIF.
IF GT_TS-TS = 'PSAPSR3USR'.
LT_DATA-USR_TOTL = ( GT_TS-TSIZE / 1024 ).
LT_DATA-USR_FREE = ( GT_TS-TFREE / 1024 ).
LT_DATA-USR_UPCT = GT_TS-TPCTUSED.
TEMP_USED1 = ( GT_TS-TSIZE / 1024 ) - ( GT_TS-TFREE / 1024 ).
LT_DATA-USR_USED = TEMP_USED1.
TEMP_USED2 = TEMP_USED1 - LT_RECORD-USR_USED.
LT_DATA-USR_CHG = TEMP_USED2.
IF LT_RECORD-USR_USED <> '0'.
TEMP_CHGR_T = LT_DATA-USR_USED - LT_RECORD-USR_USED.
TEMP_CHGR = ( TEMP_CHGR_T / LT_RECORD-USR_USED ) * 100.
ENDIF.
LT_DATA-USR_CHGR = TEMP_CHGR.
ENDIF.
ENDLOOP.
MOVE-CORRESPONDING LT_DATA TO GT_DATA. APPEND GT_DATA.
ENDIF.
MODIFY ZBC_DBTS_RECORD FROM TABLE GT_DATA .
IF SY-SUBRC = 0.
MESSAGE 'DB TABELSPACE Record Complete.' TYPE 'S'.
ENDIF.
ELSE.
"DB 연결 실패
ENDIF.
ENDFORM. " SELECT_DATA
*&---------------------------------------------------------------------*
*& Form INITIAL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM INITIAL .
S_DATE = SY-DATUM.
S_TIME = SY-UZEIT.
SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_DATA
FROM ZBC_DBTS_RECORD.
"### 가장 최근 데이터의 ALM 값을 읽어와서 디스플레이
SORT GT_DATA BY ARCHDATE ARCHTIME DESCENDING.
READ TABLE GT_DATA INDEX 1.
S_SR3A = GT_DATA-SR3_ALM.
S_USRA = GT_DATA-USR_ALM.
ENDFORM. " INITIAL
*&---------------------------------------------------------------------*
*& Form MODIFY_SCREEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MODIFY_SCREEN .
%_S_SR3A_%_APP_%-TEXT = 'PSAPSR3___ Warning Threshold (MB)'.
%_S_USRA_%_APP_%-TEXT = 'PSAPSR3USR Warning Threshold (MB)'.
%_S_DATE_%_APP_%-TEXT = 'Recording Date'.
%_S_TIME_%_APP_%-TEXT = 'Recording Time'.
LOOP AT SCREEN.
IF SCREEN-NAME CP 'S_*'.
SCREEN-INPUT = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDFORM. " MODIFY_SCREEN
*&---------------------------------------------------------------------*
*& Form MENU_SELECT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM MENU_SELECT .
DATA: IT_FIELDS LIKE SVAL OCCURS 0 WITH HEADER LINE.
DATA: LT_DATA LIKE TABLE OF ZBC_DBTS_RECORD WITH HEADER LINE.
CASE SY-UCOMM.
"### 1번 메뉴 : 공간부족 알림 임계치 변경
WHEN 'FC01'.
SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_DATA
FROM ZBC_DBTS_RECORD
WHERE FLG = 'D'.
"### 가장 최근 데이터의 ALM 값을 읽어와서 변경한다.
SORT LT_DATA BY ARCHDATE ARCHTIME DESCENDING.
READ TABLE LT_DATA INDEX 1.
IT_FIELDS-TABNAME = 'ZBC_DBTS_RECORD'.
IT_FIELDS-FIELDNAME = 'SR3_ALM'.
IT_FIELDS-FIELDTEXT = 'PSAPSR3___ Warning Threshold'.
IT_FIELDS-VALUE = LT_DATA-SR3_ALM.
APPEND IT_FIELDS.
IT_FIELDS-TABNAME = 'ZBC_DBTS_RECORD'.
IT_FIELDS-FIELDNAME = 'USR_ALM'.
IT_FIELDS-FIELDTEXT = 'PSAPSR3USR Warning Threshold'.
IT_FIELDS-VALUE = LT_DATA-USR_ALM.
APPEND IT_FIELDS.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
POPUP_TITLE = 'CHG ALERT'
START_COLUMN = '5'
START_ROW = '5'
TABLES
FIELDS = IT_FIELDS
EXCEPTIONS
ERROR_IN_FIELDS = 1
OTHERS = 2.
IF SY-SUBRC = 0. "AND IT_FIELDS-VALUE IS NOT INITIAL.
LOOP AT IT_FIELDS.
IF IT_FIELDS-FIELDNAME = 'SR3_ALM'.
LT_DATA-SR3_ALM = IT_FIELDS-VALUE. ENDIF.
IF IT_FIELDS-FIELDNAME = 'USR_ALM'.
LT_DATA-USR_ALM = IT_FIELDS-VALUE. ENDIF.
ENDLOOP.
MODIFY LT_DATA INDEX 1.
MODIFY ZBC_DBTS_RECORD FROM TABLE LT_DATA.
MESSAGE 'TableSpace warning threshold Changed' TYPE 'S'.
PERFORM INITIAL.
ENDIF.
ENDCASE.
ENDFORM. " MENU_SELECT
*&---------------------------------------------------------------------*
*& Form ALERT_MAIL
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ALERT_MAIL USING P_TS P_FREE.
********************************************************************
DATA: MAIL_DATA TYPE SODOCCHGI1.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: TEMP_TEXT(100) TYPE C,
N_FREE(10) TYPE N,
N_SR3A(10) TYPE N,
N_USRA(10) TYPE N,
LV_LINE TYPE SY-TABIX.
********************************************************************
REFRESH: OBJPACK, OBJHEAD, OBJBIN, OBJTXT, RECLIST.
CLEAR: TEMP_TEXT.
CONCATENATE '[' SY-SYSID '] ' P_TS ' Free Space Warning' INTO TEMP_TEXT SEPARATED BY SPACE.
MAIL_DATA-OBJ_NAME = 'REPORT'.
MAIL_DATA-OBJ_DESCR = TEMP_TEXT.
"### 숫자 데이터 전처리
N_FREE = P_FREE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING INPUT = N_FREE
IMPORTING OUTPUT = N_FREE.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING INPUT = S_SR3A
IMPORTING OUTPUT = N_SR3A.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING INPUT = S_USRA
IMPORTING OUTPUT = N_USRA.
OBJTXT = TEMP_TEXT.
APPEND OBJTXT.
CONCATENATE '| ERP : ' SY-SYSID INTO OBJTXT SEPARATED BY SPACE. APPEND OBJTXT.
CONCATENATE '| TableSpace : ' P_TS INTO OBJTXT SEPARATED BY SPACE. APPEND OBJTXT.
CONCATENATE '| Remaining Free Space : ' N_FREE 'MB' INTO OBJTXT SEPARATED BY SPACE. APPEND OBJTXT.
IF P_TS = 'PSAPSR3'.
CONCATENATE '| Alert Threshold : ' N_SR3A 'MB' INTO OBJTXT SEPARATED BY SPACE. APPEND OBJTXT.
ELSEIF P_TS = 'PSAPSR3USR'. .
CONCATENATE '| Alert Threshold : ' N_USRA 'MB' INTO OBJTXT SEPARATED BY SPACE. APPEND OBJTXT.
ENDIF.
DESCRIBE TABLE OBJTXT LINES LV_LINE.
OBJPACK-TRANSF_BIN = SPACE.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = LV_LINE.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
********************************************************************
CLEAR: RECLIST, TEMP_TEXT.
DATA: TEMP_MAIL(50) TYPE C.
SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ADCP
FROM ADCP
WHERE ROOMNUMBER NE SPACE.
SORT GT_ADCP BY ROOMNUMBER ASCENDING.
LOOP AT GT_ADCP.
CLEAR: TEMP_TEXT.
RECLIST-RECEIVER = P_MAIL1.
RECLIST-REC_TYPE = 'U'.
RECLIST-COM_TYPE = 'INT'.
RECLIST-NOTIF_DEL = 'X'.
RECLIST-NOTIF_NDEL = 'X'.
CONCATENATE 'Sent Mail' GT_ADRP-NAME_LAST INTO TEMP_TEXT.
RECLIST-REC_ID = TEMP_TEXT.
APPEND RECLIST.
RECLIST-RECEIVER = P_MAIL2.
RECLIST-REC_TYPE = 'U'.
RECLIST-COM_TYPE = 'INT'.
RECLIST-NOTIF_DEL = 'X'.
RECLIST-NOTIF_NDEL = 'X'.
CONCATENATE 'Sent Mail' GT_ADRP-NAME_LAST INTO TEMP_TEXT.
RECLIST-REC_ID = TEMP_TEXT.
APPEND RECLIST.
ENDLOOP.
SORT RECLIST BY RECEIVER ASCENDING.
DELETE ADJACENT DUPLICATES FROM RECLIST COMPARING RECEIVER.
********************************************************************
* Batchjob log
LOOP AT RECLIST.
MESSAGE 'All Mail sent Completed' TYPE 'S'.
ENDLOOP.
********************************************************************
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAIL_DATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = L_SENT_TO_ALL
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
********************************************************************
ENDFORM.
2. ABAP DIctionary
2-1. Table ZBC_DBTS_RECORD
테이블 필드 전부 BuiltIn Type
FieldKeyInitVDTypeLenDesc
ARCHDATE | X | X | DATS | 8 | Record Date |
ARCHTIME | X | X | TIMS | 6 | Record Time |
FLG | X | X | CHAR | 1 | Year/Month/Day Check Point |
SR3_TOTL | DEC | 16 | Tablespace PSAPSR3 Total Size | ||
SR3_FREE | INT4 | 10 | Tablespace PSAPSR3 Free Size | ||
SR3_USED | INT4 | 10 | Tablespace PSAPSR3 Used Size | ||
SR3_UPCT | INT4 | 10 | Tablespace PSAPSR3 Used Percent | ||
SR3_CHG | INT4 | 10 | Tablespace PSAPSR3 Change Size | ||
SR3_CHGR | INT4 | 10 | Tablespace PSAPSR3 Change Rate | ||
SR3_ALM | NUMC | 10 | Tablespace PSAPSR3 Warning Threshold | ||
USR_TOTL | DEC | 16 | Tablespace PSAPSR3USR Total Size | ||
USR_FREE | INT4 | 10 | Tablespace PSAPSR3USR Free Size | ||
USR_USED | INT4 | 10 | Tablespace PSAPSR3USR Used Size | ||
USR_UPCT | INT4 | 10 | Tablespace PSAPSR3USR Used Percent | ||
USR_CHG | INT4 | 10 | Tablespace PSAPSR3USR Change Size | ||
USR_CHGR | INT4 | 10 | Tablespace PSAPSR3USR Change Rate | ||
USR_ALM | NUMC | 10 | Tablespace PSAPSR3USR Warning Threshold |
'SAP BC-프로그램' 카테고리의 다른 글
SAPGUI 중복 로그인 제한 USER-EXIT (0) | 2024.03.11 |
---|---|
사용자 레이아웃 설정 복사 프로그램 (0) | 2024.03.11 |
ABAP - 마스터 패스워드 관리 프로그램 (2) | 2024.03.11 |
일일 간편 시스템 모니터링 프로그램 (0) | 2024.03.09 |
사용자 일괄 수정/복사 프로그램 (0) | 2024.03.09 |