ABAP screen
Instance One :
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:P_ON1 RADIOBUTTON GROUP RAD1 DEFAULT 'X'. "Display
SELECTION-SCREEN PUSHBUTTON 04(8) TEXT-101 USER-COMMAND UC1.
SELECTION-SCREEN COMMENT 13(6) TEXT-999.
PARAMETERS:P_ON2 RADIOBUTTON GROUP RAD1. "Update
SELECTION-SCREEN PUSHBUTTON 23(8) TEXT-102 USER-COMMAND UC2.
SELECTION-SCREEN END OF LINE .
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-200.
SELECT-OPTIONS: S_WERKS FOR VBAP-WERKS OBLIGATORY . "工廠
SELECT-OPTIONS: S_HKUNNR FOR KNVH-HKUNNR, "高階客戶
S_SPMON FOR ZDB026-SPMON. "分析期間-月
SELECT-OPTIONS: S_EDATU FOR VBEP-EDATU OBLIGATORY NO-EXTENSION, "排程日期
S_AUART FOR VBAK-AUART NO INTERVALS. "訂單類型
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-300.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 02(66) COMMTEXT .
SELECTION-SCREEN END OF LINE .
SELECTION-SCREEN END OF BLOCK B3.
*&********************************************************************&*
*& RADIOBUTTON 顯示設置 &*
*&********************************************************************&*
AT SELECTION-SCREEN OUTPUT.
IF P_ON1 EQ 'X'.
CLEAR : S_EDATU,S_AUART,COMMTEXT.
REFRESH : S_EDATU,S_AUART.
LOOP AT SCREEN.
CHECK
SCREEN-NAME CS 'S_EDATU' OR
SCREEN-NAME CS 'S_AUART'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDLOOP.
LOOP AT SCREEN.
CHECK
( SCREEN-GROUP3 EQ 'BLK' AND
SCREEN-NAME CS 'B3' ).
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
ENDLOOP.
ELSEIF P_ON2 EQ 'X'.
CLEAR : S_HKUNNR,S_SPMON.
REFRESH : S_HKUNNR,S_SPMON.
LOOP AT SCREEN.
CHECK
SCREEN-NAME CS 'S_HKUNNR' OR
SCREEN-NAME CS 'S_SPMON'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDLOOP.
*賦值排程日期
CLEAR : S_EDATU.
REFRESH : S_EDATU.
S_EDATU-SIGN = 'I'.
S_EDATU-OPTION = 'BT '.
S_EDATU-LOW = SY-DATUM.
S_EDATU-LOW+6(2) = '01'.
T_YEAR1 = S_EDATU-LOW+0(4).
T_MONTH1 = S_EDATU-LOW+4(2) + 1.
T_DAY1 = S_EDATU-LOW+6(2).
IF T_MONTH1 EQ '13'.
T_YEAR1 = T_YEAR1 + 1.
T_MONTH1 = '01'.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = T_MONTH1
IMPORTING
OUTPUT = T_MONTH1.
CONCATENATE T_YEAR1 T_MONTH1 T_DAY1 INTO S_EDATU-HIGH.
CALL FUNCTION 'WSAF_GET_LAST_DAY_OF_MONTH'
EXPORTING
I_DATUM = S_EDATU-HIGH
IMPORTING
E_LAST_DAY_MONTH = S_EDATU-HIGH.
APPEND S_EDATU.
CLEAR S_EDATU.
*賦值訂單類型
CLEAR : S_AUART,S_AUART[].
S_AUART-SIGN = 'I'.
S_AUART-OPTION = 'EQ'.
S_AUART-LOW = 'AG'. "QT
APPEND S_AUART.
S_AUART-LOW = 'KL'. "FREE
APPEND S_AUART.
S_AUART-LOW = 'TA'. "OR--STANDARD FOR INNER SALE
APPEND S_AUART.
S_AUART-LOW = 'OE'. "OE--STANDARD FOR OUTER SALE
APPEND S_AUART.
MOVE 'Note : 更新資料會根據輸入的"交貨日期"按月份處理'
TO COMMTEXT.
ENDIF.
LOOP AT SCREEN.
CHECK SCREEN-NAME = 'P_ON1' OR
SCREEN-NAME = 'P_ON2' .
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDLOOP.
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN .
CASE SSCRFIELDS-UCOMM.
WHEN 'UC1' .
P_ON1 = 'X'.
P_ON2 = ' '.
WHEN 'UC2' .
P_ON1 = ' '.
P_ON2 = 'X'.
ENDCASE.
INITIALIZATION.
Instance Two :
*&********************************************************************&*
*& SELECTION SCREEN / OPTION / PARAMETER &*
*&********************************************************************&*
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-020 .
*PARAMETERS S_BUKRS LIKE BSID-BUKRS OBLIGATORY MODIF ID M1. "公司代碼
SELECT-OPTIONS P_BUKRS FOR BSID-BUKRS OBLIGATORY MODIF ID M2. "公司代碼
SELECTION-SCREEN SKIP.
SELECT-OPTIONS S_VKORG FOR VBAK-VKORG NO-EXTENSION MODIF ID M3. "銷售組織
SELECTION-SCREEN SKIP.
PARAMETERS S_DATUM LIKE SY-DATUM DEFAULT SY-DATUM OBLIGATORY MODIF ID M3. "基準日期
*SELECTION-SCREEN SKIP.
*PARAMETERS S_DATUM1 LIKE SY-DATUM MODIF ID M4. "前期基準日期
SELECTION-SCREEN SKIP .
SELECT-OPTIONS S_KUNNR FOR BSID-KUNNR MODIF ID M3. "客戶代號
SELECTION-SCREEN SKIP .
SELECT-OPTIONS S_BUDAT FOR BSID-BUDAT DEFAULT BSID-BUDAT TO SY-DATUM MODIF ID M3."過帳日期
*SELECTION-SCREEN SKIP .
*SELECT-OPTIONS S_BUDAT1 FOR BSID-BUDAT MODIF ID M4. " 前期過帳日期
SELECTION-SCREEN SKIP .
SELECT-OPTIONS S_SAKNR FOR SKB1-SAKNR OBLIGATORY MODIF ID M3. " 統制科目
SELECTION-SCREEN SKIP .
SELECTION-SCREEN END OF BLOCK BLK1 .
*新增逾期(天數)&報表類型
SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-603 .
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 08(01) TEXT-508 MODIF ID M3.
PARAMETERS: P_EX0(3) DEFAULT '0' MODIF ID M3,
P_EX1(3) DEFAULT '30' MODIF ID M3,
P_EX2(3) DEFAULT '60' MODIF ID M3,
P_EX3(3) DEFAULT '90' MODIF ID M3,
P_EX4(3) DEFAULT '120' MODIF ID M3,
P_EX5(3) DEFAULT '121' MODIF ID M3.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BLK2 .
SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-604
.
SELECTION-SCREEN BEGIN OF LINE .
PARAMETER:R_DETAIL RADIOBUTTON GROUP RAD1 DEFAULT 'X' MODIF ID MC . "明細
SELECTION-SCREEN PUSHBUTTON 04(8) TEXT-606 USER-COMMAND RPT1 MODIF ID MC .
*SELECTION-SCREEN END OF LINE .
*
*SELECTION-SCREEN BEGIN OF LINE .
PARAMETER:R_SUM RADIOBUTTON GROUP RAD1 MODIF ID MC . "統計
SELECTION-SCREEN PUSHBUTTON 16(8) TEXT-607 USER-COMMAND RPT2 MODIF ID MC .
*SELECTION-SCREEN END OF LINE .
*
*SELECTION-SCREEN BEGIN OF LINE .
PARAMETER:R_SUMTWD RADIOBUTTON GROUP RAD1 MODIF ID MC . "統計(轉台幣)
SELECTION-SCREEN PUSHBUTTON 28(8) TEXT-613 USER-COMMAND RPT3 MODIF ID MC .
SELECTION-SCREEN END OF LINE .
SELECTION-SCREEN BEGIN OF BLOCK BLOCK4 WITH FRAME TITLE TEXT-605
NO INTERVALS.
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN COMMENT 01(01) TEXT-508 MODIF ID M5 . " 空
PARAMETERS R_DET RADIOBUTTON GROUP R2 DEFAULT 'X' MODIF ID M5.
SELECTION-SCREEN COMMENT 05(8) TEXT-608 MODIF ID M5 . " 明細表
PARAMETERS R_NATIV RADIOBUTTON GROUP R2 MODIF ID M5 .
SELECTION-SCREEN COMMENT 16(8) TEXT-609 MODIF ID M5 . " 負項金額
SELECTION-SCREEN END OF LINE .
SELECTION-SCREEN END OF BLOCK BLOCK4.
SELECTION-SCREEN BEGIN OF BLOCK BLOK5 WITH FRAME TITLE TEXT-612
NO INTERVALS.
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN COMMENT 01(01) TEXT-508 MODIF ID M6 . " 空
PARAMETERS R_TLC RADIOBUTTON GROUP R3 MODIF ID M6 .
SELECTION-SCREEN COMMENT 05(8) TEXT-610 MODIF ID M6 . " 本國貨幣
PARAMETERS R_TALL RADIOBUTTON GROUP R3 MODIF ID M6 .
SELECTION-SCREEN COMMENT 16(22) TEXT-611 MODIF ID M6 . " ALL(本國貨幣&外國貨幣)
SELECTION-SCREEN END OF LINE .
SELECTION-SCREEN END OF BLOCK BLOK5.
SELECTION-SCREEN BEGIN OF BLOCK PRE WITH FRAME TITLE TEXT-617 .
PARAMETERS S_DATUM1 LIKE SY-DATUM MODIF ID M4. "前期基準日期
SELECT-OPTIONS S_BUDAT1 FOR BSID-BUDAT MODIF ID M4. " 前期過帳日期
SELECTION-SCREEN END OF BLOCK PRE.
SELECTION-SCREEN BEGIN OF BLOCK CURRENCY WITH FRAME TITLE TEXT-614 NO INTERVALS.
PARAMETERS:O_KKURS LIKE KONV-KKURS MODIF ID M7. "美金兌人民幣
PARAMETERS:T_KKURS LIKE KONV-KKURS MODIF ID M7 . "港幣兌人民幣
PARAMETERS:P_KKURS LIKE KONV-KKURS MODIF ID M7 . "台幣兌人民幣
PARAMETERS:X_KKURS LIKE KONV-KKURS MODIF ID M7 . "新加坡幣兌人民幣
SELECTION-SCREEN END OF BLOCK CURRENCY.
*SELECTION-SCREEN BEGIN OF BLOCK CONFIRM WITH FRAME TITLE TEXT-615 NO INTERVALS.
*SELECTION-SCREEN PUSHBUTTON 04(6) TEXT-616 USER-COMMAND RPT4 MODIF ID MC .
*SELECTION-SCREEN END OF BLOCK CONFIRM.
SELECTION-SCREEN END OF BLOCK BLK3 .
*--
*說明部分
*新增注意事項說明部分.
SELECTION-SCREEN COMMENT /02(10) COMMTX01.
FORMAT COLOR = 6 .
SELECTION-SCREEN COMMENT /02(42) COMMTX00.
FORMAT COLOR OFF.
SELECTION-SCREEN COMMENT /02(80) COMMTX02.
SELECTION-SCREEN COMMENT /02(80) COMMTX03.
SELECTION-SCREEN COMMENT /02(80) COMMTX04.
SELECTION-SCREEN COMMENT /02(80) COMMTX05.
*&********************************************************************&*
*& RADIOBUTTON 顯示設置 &*
*&********************************************************************&*
AT SELECTION-SCREEN OUTPUT.
IF R_DETAIL EQ 'X'.
LOOP AT SCREEN.
CHECK
SCREEN-NAME = 'R_SUM' OR
SCREEN-NAME = 'R_SUMTWD' OR
SCREEN-NAME = 'R_TLC' OR
SCREEN-NAME = 'R_TALL'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDLOOP.
ELSEIF R_SUM EQ 'X'.
LOOP AT SCREEN.
CHECK
SCREEN-NAME = 'R_DETAIL' OR
SCREEN-NAME = 'R_SUMTWD' OR
SCREEN-NAME = 'R_DET' OR
SCREEN-NAME = 'R_NATIV'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDLOOP.
ELSEIF R_SUMTWD EQ 'X'.
LOOP AT SCREEN.
CHECK
SCREEN-NAME = 'R_DETAIL' OR
SCREEN-NAME = 'R_SUM' OR
SCREEN-NAME = 'R_TLC' OR
SCREEN-NAME = 'R_TALL' OR
SCREEN-NAME = 'R_DET' OR
SCREEN-NAME = 'R_NATIV'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
LOOP AT SCREEN.
* IF SCREEN-GROUP1 EQ 'M1'. "SINGLE BUKRS
* IF R_CON EQ 'X' AND R_SUMTWD NE 'X'.
* SCREEN-ACTIVE = '1'.
* ELSE.
* SCREEN-ACTIVE = '0'.
* ENDIF.
* ENDIF.
* IF SCREEN-GROUP1 EQ 'M2'. "SERVAL BUKRS
* IF R_CON EQ 'X' AND R_SUMTWD EQ 'X'.
* SCREEN-ACTIVE = '1'.
* ELSE.
* SCREEN-ACTIVE = '0'.
* ENDIF.
* ENDIF.
* IF SCREEN-GROUP1 EQ 'M3'. "Common
* IF R_CON EQ 'X'.
* SCREEN-ACTIVE = '1'.
* ELSE.
* SCREEN-ACTIVE = '0'.
* ENDIF.
* ENDIF.
IF SCREEN-GROUP1 EQ 'M4'. "前期
* IF R_CON EQ 'X' AND R_SUMTWD EQ 'X'.
IF R_SUMTWD EQ 'X'.
SCREEN-ACTIVE = '1'.
ELSE.
SCREEN-ACTIVE = '0'.
ENDIF.
ENDIF.
IF SCREEN-GROUP1 EQ 'M5'. "R_DETAIL
IF R_CON EQ ' ' AND R_DETAIL EQ 'X'.
SCREEN-ACTIVE = '1'.
ELSE.
SCREEN-ACTIVE = '0'.
ENDIF.
ENDIF.
IF SCREEN-GROUP1 EQ 'M6'. "R_SUM
IF R_CON EQ ' ' AND R_SUM EQ 'X'.
SCREEN-ACTIVE = '1'.
ELSE.
SCREEN-ACTIVE = '0'.
ENDIF.
ENDIF.
IF SCREEN-GROUP1 EQ 'M7'. "Currency
IF R_CON EQ ' ' AND R_SUMTWD EQ 'X'.
SCREEN-ACTIVE = '1'.
ELSE.
SCREEN-ACTIVE = '0'.
ENDIF.
ENDIF.
* IF SCREEN-GROUP1 EQ 'MC'. "Pushbutton
* IF R_CON EQ ' '.
* SCREEN-ACTIVE = '1'.
* ELSE.
* SCREEN-ACTIVE = '0'.
* ENDIF.
* ENDIF.
MODIFY SCREEN.
ENDLOOP.
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN .
CASE SSCRFIELDS-UCOMM.
WHEN 'RPT1' .
R_DETAIL = 'X' . R_SUM = ' ' .
R_DET = 'X'. R_NATIV = ' '.
R_TLC = ' '. R_TALL = ' '. R_SUMTWD = ' ' .
WHEN 'RPT2' .
R_DETAIL = ' ' . R_SUM = 'X' .
R_DET = ' '. R_NATIV = ' '.
R_TLC = ' '. R_TALL = 'X'. R_SUMTWD = ' ' .
WHEN 'RPT3' .
R_DETAIL = ' ' . R_SUM = ' ' .
R_DET = ' '. R_NATIV = ' '.
R_TLC = ' '. R_TALL = ' '. R_SUMTWD = 'X' .
* WHEN 'RPT4'.
* R_CON = 'X'.
ENDCASE.
*&********************************************************************&*
*& INITIALIZATION &*
*&********************************************************************&*
INITIALIZATION.
* 新增注意事項說明部分.
MOVE '注意事項:' TO COMMTX01.
MOVE '1.明細和統計表本國幣別一致才可多公司輸入!' TO COMMTX00.
MOVE '2.針對文件類型為RV(發票文件轉換)之會計文件:' TO COMMTX02.
MOVE ' 若稅代碼不為A0(銷項稅0%)或A5(銷項稅5%)或X0(銷項稅0%)'
TO COMMTX03.
MOVE ' 或X1(銷項稅17%)或X2(銷項稅13%),則報表均已銷項稅0%處理,'
TO COMMTX04.
MOVE ' 且項目明細後面會亮紅燈警示.'
TO COMMTX05.
*依公司代碼抓取統制科目資料
REFRESH: S_SAKNR.
SELECT SAKNR INTO I_SKB1 FROM SKB1 WHERE BUKRS IN P_BUKRS
AND MITKZ EQ 'D'.
S_SAKNR-SIGN = 'I'.
S_SAKNR-OPTION = 'EQ'.
S_SAKNR-LOW = I_SKB1-SAKNR.
APPEND S_SAKNR.
ENDSELECT.
*美金兌人民幣
SELECT * FROM TCURR UP TO 1 ROWS INTO I_TCURR
WHERE KURST EQ 'M'
AND FCURR EQ 'USD'
AND TCURR EQ 'RMB'
ORDER BY GDATU .
MOVE I_TCURR-UKURS TO O_KKURS.
ENDSELECT.
REFRESH I_TCURR.
CLEAR I_TCURR-UKURS.
*港幣兌人民幣
SELECT * FROM TCURR UP TO 1 ROWS INTO I_TCURR
WHERE KURST EQ 'M'
AND FCURR EQ 'HKD'
AND TCURR EQ 'RMB'
ORDER BY GDATU .
MOVE I_TCURR-UKURS TO T_KKURS.
ENDSELECT.
REFRESH I_TCURR.
CLEAR I_TCURR-UKURS.
*台幣兌人民幣
SELECT * FROM TCURR UP TO 1 ROWS INTO I_TCURR
WHERE KURST EQ 'M'
AND FCURR EQ 'TWD'
AND TCURR EQ 'RMB'
ORDER BY GDATU .
MOVE I_TCURR-UKURS TO P_KKURS.
ENDSELECT.
REFRESH I_TCURR.
CLEAR I_TCURR-UKURS.
*新加坡幣兌人民幣
SELECT * FROM TCURR UP TO 1 ROWS INTO I_TCURR
WHERE KURST EQ 'M'
AND FCURR EQ 'SGD'
AND TCURR EQ 'RMB'
ORDER BY GDATU .
MOVE I_TCURR-UKURS TO X_KKURS.
ENDSELECT.
REFRESH I_TCURR.
CLEAR I_TCURR-UKURS.
本人常年接收SAP运维和远程项目,ECC,S/4HANA,CRM,WDA.
远程人天可谈,终身售后,有活请联系V信:18925782767(问问题免费,欢迎交流!)
!!请关注本人技术分享公众号:SAP翔子(可扫头像二维码)
每天分享新知识,博客文章也会陆续整理并迁移至公众号,与您一起共同学习