350 likes | 553 Views
Interactive List Techniques. Detail Lists Program Flow in Detail Lists Events Page Headings SET TITLEBAR Data Transport Selecting Multiple Lines Field Selection System Fields for interactive Lists 補充:利用 ALV GRID 顯示資料. 1. Detail Lists. Program Flow in Detail Lists. Creating Data Lists.
E N D
Interactive List Techniques • Detail Lists • Program Flow in Detail Lists • Events • Page Headings • SET TITLEBAR • Data Transport • Selecting Multiple Lines • Field Selection • System Fields for interactive Lists • 補充:利用ALV GRID顯示資料
練習1-1 REPORT Z9901_0518A. START-OF-SELECTION. WRITE:/ 'BASIC LIST', SY-LSIND. AT LINE-SELECTION. WRITE:/ 'DETAIL LIST', SY-LSIND.
練習1-2 REPORT Z9901_0518A. START-OF-SELECTION. FORMAT HOTSPOT ON COLOR 3 INVERSE ON. WRITE:/ 'BASIC LIST', SY-LSIND. TOP-OF-PAGE. WRITE: 'TITLE1:', SY-TITLE. ULINE. AT LINE-SELECTION. WRITE:/ 'DETAIL LIST', SY-LSIND. TOP-OF-PAGE DURING LINE-SELECTION. write:/ 'TITLE2'.
練習1-3 REPORT Z9901_0518A NO STANDARD PAGE HEADING. START-OF-SELECTION. SET TITLEBAR 'T01' WITH SY-DATUM. FORMAT HOTSPOT ON COLOR 3 INVERSE ON. WRITE:/ 'BASIC LIST', SY-LSIND. TOP-OF-PAGE. WRITE: 'TITLE1:', SY-TITLE. ULINE. AT LINE-SELECTION. SET TITLEBAR 'T02' WITH SY-LSIND. WRITE:/ 'DETAIL LIST', SY-LSIND. TOP-OF-PAGE DURING LINE-SELECTION. write:/ 'TITLE2'.
練習2 REPORT Z9901_0518B. START-OF-SELECTION. TABLES Z9901SELECTION. SELECT * FROM Z9901SELECTION. FORMAT HOTSPOT ON COLOR 5 INVERSE ON. WRITE:/ Z9901SELECTION-SNO, Z9901SELECTION-SNAME, Z9901SELECTION-CNO. HIDE: Z9901SELECTION-CNO. ENDSELECT. AT LINE-SELECTION. TABLES Z9901COURSE. SELECT * FROM Z9901COURSE WHERE CNO = Z9901SELECTION-CNO. WRITE:/ Z9901COURSE-CNO, Z9901COURSE-CNAME, Z9901COURSE-CGRADE, Z9901COURSE-TEACHER. ENDSELECT.
3. Selecting Multiple Lines DATA MARK. WRITE:/ MARK AS CHECKBOX, … AT LINE-SELECTION. DO. CLEAR MARK. READ LINE SY-INDEX FIELD VALUE MARK. IF SY-SUBRC <> 0. EXIT. ENDIF. IF MARK <> SPACE. WRITE:/ Z9901SELECTION-SGRADE, Z9901SELECTION-SNAME. MODIFY CURRENT LINE FIELD VALUE MARK FROM SPACE. ENDIF. ENDDO.
練習3 REPORT Z9901_0518C. DATA MARK. START-OF-SELECTION. TABLES Z9901SELECTION. SELECT * FROM Z9901SELECTION. FORMAT HOTSPOT ON COLOR 5 INVERSE ON. WRITE:/ MARK AS CHECKBOX, Z9901SELECTION-SNO, Z9901SELECTION-SNAME, Z9901SELECTION-CNO. HIDE: Z9901SELECTION-SGRADE, Z9901SELECTION-SNAME. ENDSELECT.
練習3 (續) AT LINE-SELECTION. DO. CLEAR MARK. READ LINE SY-INDEX FIELD VALUE MARK. IF SY-SUBRC <> 0. EXIT. ENDIF. IF MARK <> SPACE. WRITE:/ Z9901SELECTION-SGRADE, Z9901SELECTION-SNAME. MODIFY CURRENT LINE FIELD VALUE MARK FROM SPACE. ENDIF. ENDDO.
6. 補充:利用ALV GRID顯示資料(應用物件導向及dialog programming)
修改程式碼 REPORT zpu101_01_alv_grid2 . DATA gdt_spfli TYPE STANDARD TABLE OF zpu101_01_art. DATA ok_code LIKE sy-ucomm. DATA: container_r TYPE REF TO cl_gui_custom_container, grid_r TYPE REF TO cl_gui_alv_grid. START-OF-SELECTION. * fill internal table SELECT * FROM zpu101_01_art INTO TABLE gdt_spfli. CALL SCREEN 100.
修改程式碼 MODULE create_control OUTPUT. IF container_r IS INITIAL. CREATE OBJECT container_r EXPORTING container_name = 'CONTAINER_1'. CREATE OBJECT grid_r EXPORTING i_parent = container_r. CALL METHOD grid_r->set_table_for_first_display EXPORTING i_structure_name = ' zpu101_01_art' CHANGING it_outtab = gdt_spfli. ENDIF. ENDMODULE.
練習:讓使用者以進階查詢方式,輸入團體編號範圍,進行查詢練習:讓使用者以進階查詢方式,輸入團體編號範圍,進行查詢
修改程式碼參考 REPORT zpu101_01_alv_grid2 . DATA gdt_spfli TYPE STANDARD TABLE OF zpu101_01_art. DATA ok_code LIKE sy-ucomm. DATA: container_r TYPE REF TO cl_gui_custom_container, grid_r TYPE REF TO cl_gui_alv_grid. tables zpu101_01_show. SELECT-OPTIONS team for zpu101_01_show-team. START-OF-SELECTION. * fill internal table SELECT * FROM zpu101_01_art INTO TABLE gdt_spfli where artid in team. CALL SCREEN 100.