當(dāng)數(shù)據(jù)特別多的時候SELECT可能會內(nèi)表溢出
PARAMETERS: p_size TYPE num6 DEFAULT 10000.
OPEN CURSOR WITH HOLD g_cursor FOR SELECT * FROM (tabname) WHERE (condwher).
DO.
lv_index = sy-index.
CONDENSE lv_index NO-GAPS.
FETCH NEXT CURSOR g_cursor INTO CORRESPONDING
FIELDS OF TABLE <fs_table> PACKAGE SIZE p_size.
IF sy-subrc <> 0.
CLOSE CURSOR g_cursor.
EXIT.
ELSE.
IF lt_temp IS NOT INITIAL.
SELECT *
FROM /bshm/fa_pcd
APPENDING TABLE gt_fa_pcd
FOR ALL ENTRIES IN lt_temp
WHERE ordernr = lt_temp-ordernr
AND ordertype = lt_temp-ordertype
AND posnum = lt_temp-posnum
AND fieldname = 'KI'.
ENDIF.
ENDIF.
ENDDO.
CLOSE CURSOR: g_cursor.