Skip to Content
0
Former Member
Sep 29, 2006 at 08:12 PM

exec sql help

61 Views

Hi,

I have this abap/exec sql code to extract data from as400/db2.

I am getting data by a "select" statement and i am trying to append the records with append statements.

but, not works.

EXEC SQL.

CONNECT TO 'SATDBR'

ENDEXEC.

EXEC SQL.

--->(HERE THE PROBLEM) OPEN C1 FOR.

SELECT A,B,C,D

FROM SAPTEST.XX1

ENDEXEC.

EXEC SQL.

OPEN C1

FETCH NEXT C1 INTO

:ZTABLE.AA, :ZTABLE.BB, :ZTABLE.CC, :ZTABLE.DD

ENDEXEC.

IF sy-subrc <> 0.

EXIT.

ELSE.

APPEND ZTABLE.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE C1

ENDEXEC.

EXEC SQL.

DISCONNECT 'SATDBR'

ENDEXEC.

I need to declare the cursor??? whats wrong in my code :S

the runtime error is "A SQL mistake has appeared by the execution of Native SQL."

i would appreciate your help.

thanks

vicky