‎2006 Jan 03 2:25 PM
The following code I have written and I need to append ttab to an internal table and later to have those values to be updated in another table (dtab) that has a different structure(but only want to append the fields from ttab). Everytime I append to another table or internal table it goes to a dump. The code below is working fine but need to modify it to copy it into a dtab that has a different strucutre. Thanks in advance.
DATA: BEGIN of ttab occurs 100,
REPORT(40) TYPE C,
RESPTI TYPE I,
CPUTI TYPE I,
QUEUETI TYPE I,
TCODE(20) TYPE C,
RSYSTEM(8) TYPE C,
LOADTI(15) TYPE P,
AVBYTES(15) TYPE P,
MAXMEM TYPE I,
TASKTYPE(1) TYPE X,
DBCALLTI(15) TYPE P,
DATUM type sy-datum,
ACCOUNT(12) TYPE C,
BTCJOBNAME(32) TYPE C,
END of ttab.
EXEC SQL.
OPEN C1 FOR SELECT REPORT, RESPTI, CPUTI, QUEUETI, TCODE,
RSYSTEM, LOADTI, AVBYTES, MAXMEM, TASKTYPE, DBCALLTI, DATUM, ACCOUNT,
BTCJOBNAME FROM ZBMCYGRTASKS
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT C1 INTO :ttab
ENDEXEC.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
ENDDO.
EXEC SQL.
CLOSE C1.
ENDEXEC.
‎2006 Jan 03 2:33 PM
clear sometab.
refresh sometab.
<b>DO.</b>
EXEC SQL.
FETCH NEXT C1 INTO :ttab
ENDEXEC.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
loop at ttab.
move-corresponding ttab to sometab.
append sometab.
endloop.
<b>enddo.</b>
thanks
vijay
‎2006 Jan 03 2:28 PM
‎2006 Jan 03 2:33 PM
clear sometab.
refresh sometab.
<b>DO.</b>
EXEC SQL.
FETCH NEXT C1 INTO :ttab
ENDEXEC.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
loop at ttab.
move-corresponding ttab to sometab.
append sometab.
endloop.
<b>enddo.</b>
thanks
vijay
‎2006 Jan 03 9:09 PM
Ok thanks. I'll try that peice of code, but before I can try that the original code is going to dump. Its saying Invalid request to database interface. It was working before I dont know I renamed the prg and itab, but still the same result. Other times I get a runtime error saying "the error occured in the current database connection "DEFAULT" " Please help me to resolve this. Thanks in advance guys !!