Skip to Content
author's profile photo Former Member
Former Member

How to execute code saved in string variable??

Hello experts,

I need to execute a select which I obtain concatenating several fields into string variable.

So the select is saved in a string:

var = 'select... from ... where...'.

There is any way to execute that select? ("exec var." or similar??)

thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 05:17 PM

    Hi,

    create the select statement in a generated subroutine and pass the values for select.

    Search for " Dynamic select: in the forum...

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 29, 2008 at 11:00 PM

    Hello Illie

    Would it not be possible to use a simple dynamic SELECT, e.g.:

    DATA:
      ldo_data   TYPE REF TO data.
    
    FIELD-SYMBOLS:
      <lt_itab>  TYPE TABLE.
    
    
    CREATE DATA ldo_data TYPE TABLE OF (ld_tabname).
    ASSIGN ldo_data->* TO <lt_itab>.
    
    SELECT * from (ld_tabname) INTO TABLE <lt_itab>
       WHERE (ld_clause_string).
    

    Regards

    Uwe

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.