Skip to Content
0
Former Member
Jan 16, 2008 at 05:22 AM

Dynamic Tables & SQL Statements

40 Views

Example:

A user types in a SQL statement, " Country = 'US' ", into a input field. i read it and copy into table A. how am i supposed to use the statement found in the table to do a comparison of data from table B? i've found a example in the abap documentation but i'm not sure how to retrieve the statement from table A. please provide sample codes so i know how it works. i'll reward handsomely if the answer's close (((((((:

Thanks (:

REPORT demo_special_tech_subroutine_1.

DATA: code TYPE TABLE OF rssource-line,

prog(8) TYPE c, msg(120) TYPE c, lin(3) TYPE c,

wrd(10) TYPE c, off(3) TYPE c.

APPEND 'PROGRAM SUBPOOL.'

TO code.

APPEND 'FORM DYN1.'

TO code.

APPEND

'WRITE / ''Hello, I am the temporary subroutine DYN1!''.' "#EC NOTEXT

TO code.

APPEND 'ENDFORM.'

TO code.

APPEND 'FORM DYN2.'

TO code.

APPEND

'WRIT / ''Hello, I am the temporary subroutine DYN2!''.' "#EC NOTEXT

TO code.

APPEND 'ENDFORM.'

TO code.

GENERATE SUBROUTINE POOL code NAME prog

MESSAGE msg

LINE lin

WORD wrd

OFFSET off.

IF sy-subrc <> 0.

WRITE: / 'Error during generation in line', lin, "#EC NOTEXT

/ msg,

/ 'Word:', wrd, 'at offset', off. "#EC NOTEXT

ELSE.

WRITE: / 'The name of the subroutine pool is', prog. "#EC NOTEXT

SKIP 2.

PERFORM dyn1 IN PROGRAM (prog).

SKIP 2.

PERFORM dyn2 IN PROGRAM (prog).

ENDIF.

Edited by: Leslie Koh on Jan 16, 2008 6:31 AM