‎2005 Dec 09 8:12 PM
I am trying to run a SQL command built from a variable, and I am receiving an error. Is what I am trying to do not possible?
Here is an example:
EXEC SQL.
:l_statement
ENDEXEC.
l_statement contains a valid Oracle statement.
Thanks for any help.
‎2005 Dec 09 8:15 PM
‎2005 Dec 09 8:15 PM
‎2005 Dec 09 8:21 PM
Here is an example. Just put your statement in the variable.
report zrich_0001 .
types: t_source(72).
data: routine(32) value 'TEMP_ROUTINE',
program(8),
message(128),
line type i.
data: l_statement(50) type c value 'What Ever'.
data: isource type table of t_source,
xsource type t_source.
xsource = 'REPORT ZTEMP_REPORT.'.
insert xsource into isource index 1.
xsource = 'FORM &.'.
replace '&' with routine into xsource.
insert xsource into isource index 2.
xsource = 'EXEC SQL.'.
append xsource to isource.
xsource = l_statement.
append xsource to isource.
xsource = 'ENDEXEC.'.
append xsource to isource.
xsource = 'ENDFORM.'.
append xsource to isource.
generate subroutine pool isource name program
message message
line line.
if sy-subrc = 0.
perform (routine) in program (program).
else.
write:/ message.
endif.
Regards,
Rich Heilman
‎2005 Dec 09 8:16 PM
EXEC SQL.
SELECT CLIENT, ARG1 INTO :F1, :F2 FROM AVERI_CLNT
WHERE ARG2 = :F3
ENDEXEC.what kind of error you are getting....
‎2005 Dec 09 8:29 PM
Subroutine Calls Not Allowed in an ABAP Objects context.
if you are using in OO it won't work....
EXEC SQL.
:l_statement
ENDEXEC.will fail...