下面创建一个ICON数据查询程序,将ICON的名称及相关图标从系统中抓出。控制报表每页显示数量最多不超过10行,具体如下:
REPORT ZZWEI_REPORT_DEMO NO STANDARD PAGE HEADING.
*NO STANDARD PAGE HEADING (FOR LIST HEADING)
DATA:PAGE_LINE TYPE I VALUE 10, "每頁行數
ICONTAB LIKE STANDARD TABLE OF V_ICON WITH HEADER LINE,"參照VIEW建內表
Num TYPE I.
*每次分页时绘制表头
TOP-OF-PAGE.
WRITE: /2 'Pages:',SYST-PAGNO RIGHT-JUSTIFIED.
ULINE AT /1(80).
WRITE: /1(1) SY-VLINE,'ID' COLOR 1,
7(1) SY-VLINE ,'ICON' COLOR 1,
15(1) SY-VLINE,'NAME' COLOR 1,
41(1) SY-VLINE, 'SHORTTEXT' COLOR 1,
80(1) SY-VLINE.
ULINE AT /1(80).
START-OF-SELECTION. "屏幕开始时查询数据...
SELECT * FROM ICON INNER JOIN ICONT ON ICON~ID = ICONT~ID INTO
CORRESPONDING FIELDS OF TABLE ICONTAB WHERE ICONT~LANGU = SY-LANGU.
LOOP AT ICONTAB.
WRITE: /1(1) SY-VLINE,SY-TABIX LEFT-JUSTIFIED,
7(1) SY-VLINE,ICONTAB-ID AS ICON LEFT-JUSTIFIED,
"LEFT-JUSTIFIED:左对齐,RIGHT_JUSTIFIED:右对象,CENTERED:居中对齐。
15(1) SY-VLINE,ICONTAB-NAME,
41(1) SY-VLINE,ICONTAB-SHORTTEXT,
80(1) SY-VLINE.
ULINE /1(80).
Num = SY-TABIX MOD PAGE_LINE.
IF Num = 0.
NEW-PAGE. "新的一页
ENDIF.
ENDLOOP.
运行结果如下: