Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Need help

Former Member
0 Likes
527

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
502
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
3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
502

Add this code.



clear dtab. refresh dtab.

loop at ttab.
move-corresponding ttab to dtab.
append dtab.
endloop.


Regards,

RIch Heilman

Read only

Former Member
0 Likes
503
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
Read only

0 Likes
502

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 !!