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

selecting first few records

hi,

i want to select first few records and do the next process and the rest of the records with another process. how to select say first 5 records from an internal table.

Thanks in advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

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

    Hi Arun,

    Check this code ,

    DATA : begin of itab occurs 0 ,

    a type char1,

    b type i ,

    end of itab ,

    begin of jtab occurs 0 ,

    a type char1,

    b type i ,

    end of jtab ,

    • Getting details

    lin1 type i ,

    lin2 type i ,

    final type i .

    itab-a = 'a' .

    itab-b = '1' .

    append itab .

    itab-a = 'a' .

    itab-b = '2' .

    append itab .

    itab-a = 'a' .

    itab-b = '3' .

    append itab .

    itab-a = 'b' .

    itab-b = '1' .

    append itab .

    jtab] = itab[ .

    DESCRIBE TABLE ITAB lines lin1.

    DELETE JTAB WHERE a = 'a' .

    DESCRIBE TABLE JTAB lines lin2 .

    • Required Data

    final = lin1 - lin2 .

    write : 'number of records =' , final .

    hope it helps...

    or try this:

    try like this :

    itab_buff[ ] = itab[ ].

    delete itab_buff where kunnr NE '10000'.

    Data: lv_lines type i.

    Describe table itab_buff lines lv_lines.

    kindly reward if found helpful.

    cheers,

    Hema.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 03:05 PM

    Hello,

    Loop through the internal table and check sy-tabix > 5 and do the call to the process.

    Thanks,

    Venu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 03:18 PM

    hi

    good

    you can use SELECT UPTO 5 ROWS.

    THANKS

    mrutyun^

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 03:09 PM

    SELECT ... UP TO 5 ROWS.

    Press F1 on SELECT.

    Rob

    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.