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

How to define Range Tables dynamically

Hi,

How can I define ranges dynamic for further using in the Select Statement?

Cause my Code is like this; But It comes to Short-Dump

lt_typnr is Range Table.

IF typnr IS SUPPLIED.

CONCATENATE 'TYPNR IN' lt_typnr INTO

source_line separated by space.

APPEND source_line TO where_tab.

ENDIF.

SELECT * FROM ZTYP_TABLE

INTO CORRESPONDING FIELDS OF TABLE lt_header

WHERE (where_tab).

Greetings

Besi

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2005 at 02:16 PM

    In case Anand's solution does not work, if the range table is empty, it will have no impact on the selection. So you could code:

    IF typnr IS SUPPLIED.
    ELSE.
      REFRESH lt_typnr[].
    ENDIF.
    
    SELECT * FROM ZTYP_TABLE
      INTO CORRESPONDING FIELDS OF TABLE lt_header
      WHERE typnr IN lt_typnr.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 10, 2005 at 10:41 AM

    Hi besi,

    using sel_opt's is'nt possible in a dynamic wheretab

    ->

    1) so you've to dissolve your sel_opt

    2) or you've to use GENERATE SUBROUTINE POOL (F1)

    regards Andreas

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 10, 2005 at 10:47 AM

    That's not fit to your question, but have a look at the function module :

    FREE_SELECTIONS_INIT

    FREE_SELECTIONS_DIALOG

    FREE_SELECTIONS_RANGE_2_WHERE

    Regards

    Frédéric.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2005 at 10:54 AM

    Hi Besi,

    Could you please see if this one works?

    IF typnr IS SUPPLIED.

    CONCATENATE 'TYPNR IN'

    'LT_TYPNR'

    INTO source_line separated by space.

    APPEND source_line TO where_tab.

    ENDIF.

    The value LT_TYPNR has to be supplied as a <i>literal</i>.

    Here in your case, you have given it as a variable. Hence the dump.

    Please reward the points and close the thread if this solution is satisfactory.

    Regards,

    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 16, 2005 at 03:01 PM

    Hi Developers,

    I was on Vacation. Sorry for lately Points.

    Thank You for all

    Bye

    Besi

    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.