Skip to Content
avatar image
Former Member

Moving DATA from Internal Table to Ranges

Hi All,

I have an Internal table and a range variable both contain one field. Internal table is having only one table. I am populating the table data from a select query. Now I want to transfer the data to a range field. The internal table is having thousands of records so I want to do this <b>without LOOP</b>. Can anybody suggest the efficient way to achieve this?

Any help would be appreciated.

Thanks so much.

Jignesh.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 18, 2006 at 03:33 PM

    I'm not sure of this...just guessing...You're saying that you internal table have just one field, right? And form example, you have the following records...

    A001

    A002

    A003

    B001

    B002

    And so on...

    In your range you could do this...

    READ TABLE T_TABLE INDEX 1.

    RANGE_TABLE-LOW = T_TABLE-FIELD.

    DESCRIBE T_TABLE LINES L_LINES.

    READ TABLE T_TABLE INDEX L_LINES.

    RANGE_TABLE-HIGH = T_TABLE-FIELD.

    RANGE_TABLE-OPTION = "BT".

    Now your range goes from A001 to the end of you internal table records -:)

    Greetings,

    Blag.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Yeah... I am using SUBMIT for crating a batch job thread. But I dont have to use MEMORY ID too for this since in production its having some issues. 😔

      Thanks for your help....

      Jignesh

  • avatar image
    Former Member
    Apr 18, 2006 at 03:44 PM

    If you use a range table with thousands of entries in a select statement, it will likely dump.

    Rob

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 18, 2006 at 03:30 PM

    NO way of doing it without a loop condition.

    One way is to sort the internal table and take the first record in the ranges-low and the last record in the range-high parameter. and use 'BT' in the option.

    But this doesn't ensure correct fetching of records.

    For eg let your internal table has 1 to 100 records with some records missing (say 20, 30 etc).

    your ranges can be filled like 1 to 100.

    But it will fetch all the records in between 1 and 100 (including 20 and 30 also).

    So there is o other way but to use loop statement.

    REgards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 18, 2006 at 03:32 PM

    Hi ,

    This is not possible.

    The internal table structure is different from the

    ranges.

    U said internal table has only one field.

    But ranges has

    SIGN

    OPTION

    LOW

    HIGH

    Atleast 3 fields need to be filled.

    U need to loop the IT and fill the ranges.

    Loop at IT.

    r_ranges-sign = 'I'.

    r_ranges-option = 'EQ'.

    r_ranges-low = it-field.

    append r_ranges.

    endloop.

    There is no other way.

    Regards,

    GSR.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 18, 2006 at 03:36 PM

    There is one way where u can do without loop.

    sort table itab by vbeln posnr.

    read table itab index 1.

    ranges-low = itab-vbeln.

    clear itab.

    describe table itab lines w_line.

    read table itab index w_line.

    ranges-high = itab-vbeln.

    ranges-sign = 'I'.

    ranges-option = 'BT'.

    append ranges.

    This is surely help u.

    Reward points if it helps.

    Cheers,

    Hasmath

    Add comment
    10|10000 characters needed characters exceeded