‎2006 May 23 6:41 AM
Help to simplify a code (it is necessary for BW-extraction)
It would be desirable to do without database table zdbasetable1
But the cursor is necessary
************************************************************************
* Data transfer: First Call OPEN CURSOR + FETCH
* Following Calls FETCH only
************************************************************************
* Ãà ÷à ëî îáðà áîòêè
* First data package -> OPEN CURSOR
IF S_COUNTER_DATAPAKID = 0.
delete from zdbasetable1.
import inttable1 inttable2 inttable3 from database INDX(IM) ID 'IDENT'.
loop at inttable1.
move-corresponding inttable1 to zdbasetable1.
modify zdbasetable1.
clear zdbasetable1.
endloop.
OPEN CURSOR WITH HOLD S_CURSOR FOR
SELECT (S_S_IF-T_FIELDS) FROM zdbasetable1.
ENDIF. "First data package ?
* Fetch records into interface table.
* named E_T_'Name of extract structure'.
FETCH NEXT CURSOR S_CURSOR
APPENDING CORRESPONDING FIELDS
OF TABLE inttablerezult
PACKAGE SIZE S_S_IF-MAXSIZE.
IF SY-SUBRC <> 0.
CLOSE CURSOR S_CURSOR.
RAISE NO_MORE_DATA.
ENDIF.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
ENDIF.
‎2006 May 23 7:25 AM
I think you have to continue using the custom table but can populate it a bit more efficiently....
data tzdb type table of zdbasetable1.
IF S_COUNTER_DATAPAKID = 0.
delete from zdbasetable1.
import inttable1 inttable2 inttable3 from database INDX(IM) ID 'IDENT'.
loop at inttable1.
move-corresponding inttable1 to zdbasetable1.
modify zdbasetable1.
clear zdbasetable1.
append zdbasetable1 to tzdb.
endloop.
insert zdbasetable1 from table tzdb.
‎2006 May 23 8:36 AM
of course, if the inttable1 is a table of 'zdbasetable1' you can do the insert direct from there without using the loop!