Code: Alles auswählen.
SELECT * FROM ztoa01otxcoi
INTO TABLE lt_ztoa01otxcoi
WHERE status = '1'.
SELECT toadv~ar_object, toadv~doc_type, toasp~objecttext " alle ar_object in lt_archive_objects speichern
FROM toadv
LEFT JOIN toasp ON toasp~ar_object = toadv~ar_object
INTO TABLE @DATA(lt_archive_objects)
WHERE language = 'D'.
IF lt_ztoa01otxcoi[] IS NOT INITIAL.
DATA: lt_aida TYPE TABLE OF but0id-idnumber.
LOOP AT lt_ztoa01otxcoi ASSIGNING FIELD-SYMBOL(<lfs_ztoa01otxcoi>).
APPEND <lfs_ztoa01otxcoi>-aida TO lt_aida.
ENDLOOP.
SELECT idnumber, partner "Ermittelt die Partnernummer von die BUT0id Tabelle wenn die AIDA nummer = idnumber
FROM but0id
INTO TABLE @lt_but0id
FOR ALL ENTRIES IN @lt_aida
WHERE type = 'ZAIDA'
AND idnumber = @lt_aida-table_line.
ENDIF.
LOOP AT lt_ztoa01otxcoi INTO ls_ztoa01otxcoi.
CASE ls_ztoa01otxcoi-storagetype.
WHEN '1'.
ls_ztoa01otxcoi-zw_reserve = 'PDF'.
WHEN '2'.
ls_ztoa01otxcoi-zw_reserve = 'JPG'.
WHEN '3'.
ls_ztoa01otxcoi-zw_reserve = 'TIFF'.
WHEN '4'.
ls_ztoa01otxcoi-zw_reserve = 'DOC'.
WHEN '5'.
ls_ztoa01otxcoi-zw_reserve = 'PPT'.
WHEN '6'.
ls_ztoa01otxcoi-zw_reserve = 'XLS'.
WHEN '7'.
ls_ztoa01otxcoi-zw_reserve = 'MSG'.
WHEN '8'.
ls_ztoa01otxcoi-zw_reserve = 'GIF'.
WHEN '9'.
ls_ztoa01otxcoi-zw_reserve = 'HTM'.
ENDCASE.
LOOP AT lt_archive_objects ASSIGNING FIELD-SYMBOL(<lfs_archive_object>) "Ermittelt das richtige ar_object
WHERE doc_type = ls_ztoa01otxcoi-zw_reserve
AND objecttext CS ls_ztoa01otxcoi-zw_belegart
AND ar_object CS 'ZBPCOI'.
EXIT.
ENDLOOP.
IF sy-subrc IS INITIAL AND <lfs_archive_object> IS ASSIGNED.
ls_ztoa01otxcoi-zw_ar_object = <lfs_archive_object>-ar_object.
ENDIF.
CLEAR: lv_partnrcount, ls_but0id.
LOOP AT lt_but0id INTO ls_but0id
WHERE idnumber = ls_ztoa01otxcoi-aida.
lv_partnrcount = lv_partnrcount + 1.
ENDLOOP.
IF lv_partnrcount = 1.
ls_ztoa01otxcoi-zw_obj_id = ls_but0id-partner.
ENDIF.
IF ls_ztoa01otxcoi-zw_obj_id IS NOT INITIAL
AND ls_ztoa01otxcoi-zw_ar_object IS NOT INITIAL
AND ls_ztoa01otxcoi-zw_reserve IS NOT INITIAL
AND lv_partnrcount = 1.
ls_ztoa01otxcoi-status = '2'.
lv_count = lv_count + 1.
ELSE.
ls_ztoa01otxcoi-status = '4'.
ENDIF.
APPEND ls_ztoa01otxcoi TO lt_updated_lines.
CLEAR: lv_partnrcount, ls_ztoa01otxcoi.
ENDLOOP.
LOOP AT lt_updated_lines INTO ls_temp.
APPEND ls_temp TO lt_temp.
count_eintraege = count_eintraege + 1.
IF count_eintraege MOD 50000 = 0 OR count_eintraege EQ lines( lt_updated_lines ).
UPDATE ztoa01otxcoi FROM TABLE lt_temp.
COMMIT WORK.
CLEAR lt_temp.
ENDIF.
ENDLOOP.
Code: Alles auswählen.
DATA: lv_package_size TYPE i,
lv_cursor TYPE cursor.
lv_package_size = 100000.
OPEN CURSOR WITH HOLD lv_cursor FOR
SELECT * FROM Tabelle
DO.
FETCH NEXT CURSOR lv_cursor
INTO TABLE Interne_tabelle PACKAGE SIZE lv_package_size. "100000 Linie
IF sy-subrc <> 0.
EXIT.
ENDIF.
.............
schreib hier dein Code etc....
Danach falls du APPEND und UPDATE brauchst, sollst du danach kein COMMIT WORK verwenden weil es funktioniert mit OPEN CURSOR nicht. Hier kann man die Fnktionsbaustein DB_COMMIT verwenden (sie macht COMMIT WORK).
ENDDO.
CLOSE CURSOR lv_cursor.