ABAP顾问
分类:
2009-07-01 16:42:54
本程序只是针对Oracle数据库的情况
REPORT Z_BARRY_TEST NO STANDARD PAGE HEADING .
DATA: BEGIN OF ITAB OCCURS 0 ,
EBELN LIKE EKKO-EBELN ,
BUKRS LIKE EKKO-BUKRS ,
END OF ITAB.
DATA: m type i ,
n TYPE i ,
f TYPE i .
m = 10 . "起始记录
n = 10 . "要取的记录条数
f = m + n .
*EXEC SQL PERFORMING add.
* SELECT bukrs INTO :ekko-bukrs FROM EKKO where rownum < 6
*ENDEXEC.
EXEC SQL PERFORMING append.
SELECT t2.ebeln,t2.bukrs INTO :ITAB FROM
(select rownum rown,t1.* from ekko t1
where rownum <= :f and mandt = :sy-mandt
and LENGTH(ERNAM) > 6
) t2 where rown > :m
ENDEXEC.
LOOP AT ITAB.
WRITE: / ITAB-EBELN ,ITAB-BUKRS .
ENDLOOP.
FORM APPEND.
APPEND ITAB.
ENDFORM. "ADD