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

how to convert internal table into range?

Hi experts...

I have one internal table which contains 4 fields.

I want to use one of the fields into select statement(like: kunnr in s_kunnr.).

I dont want to make loop internal table, since it is taking lot of time.

any suggestions pls....

reward guaranteed.

Kaki

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 08:51 AM

    hi,

    define one range like s_range1

    range1-sign = 'I'

    range1-option = 'EQ'

    loop at itab

    rangel-low = itab-field1

    append range1

    endloop

    select ............field1 in range1

    cheers,

    sasi

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Its very simple,

      RANGES: r_zzvtref FOR zzvvscpos-zzvtref,

      r_zziodetnr FOR zzvvscpos-zziodetnr.

      READ TABLE it_io_sel INTO wa_io_sel INDEX 1.

      r_zzvtref-sign = 'I'.

      r_zzvtref-option = 'BT'.

      r_zzvtref-low = wa_io_sel-insobject.

      DESCRIBE TABLE it_io_sel LINES l_lines.

      READ TABLE it_io_sel INTO wa_io_sel INDEX l_lines.

      r_zzvtref-high = wa_io_sel-insobject.

      APPEND r_zzvtref.

      SORT it_io_sel BY zziodetnr.

      READ TABLE it_io_sel INTO wa_io_sel INDEX 1.

      r_zziodetnr-sign = 'I'.

      r_zziodetnr-option = 'BT'.

      r_zziodetnr-low = wa_io_sel-zziodetnr.

      DESCRIBE TABLE it_io_sel LINES l_lines.

      READ TABLE it_io_sel INTO wa_io_sel INDEX l_lines.

      r_zziodetnr-high = wa_io_sel-zziodetnr.

      APPEND r_zziodetnr.

      Before appending the ranges make sure u have soretd your internal table by the required field

      Now use this ranges in the select's where condition.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 08:51 AM

    Hi,

    You mean to use a field of internal table for select statement and in aloop you want to get data.if it so you can use for all entries insted of looping.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 08:52 AM

    Hi

    I don't think it's possibile because the value of value fields (low and high) of the range should be different.

    So you should try to load the range when you load your internal table.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 08:53 AM

    u will have to use loop internal table

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 20, 2005 at 09:05 AM

    Hi Kaki,

    You can use select statement with 'for all entries'. This prevents the loop but at the same time selects based on all values of that field in the table.

    eg

    BEGIN OF i_tab OCCURS 0,

    field1 like ..

    field4 like ..

    END OF i_tab,

    -


    SELECT field list

    FROM tablenme

    INTO CORRESPONDING FIELDS OF TABLE i_data

    FOR ALL ENTRIES IN i_tab

    WHERE field1 EQ i_tab-field1.

    -


    Here field1 will the field you want as your range field.

    Thanks.

    Susmitha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 09:06 AM

    if u don't want to use loop try this

    SELECT * FROM .... INTO ....

    FOR ALL ENTRIES IN itab

    WHERE ...

    ENDSELECT.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 20, 2005 at 10:03 AM

    Define ranges as

    Ranges s-Range for vbak-vtweg

    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.