Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

doubt in internal table

Former Member
0 Likes
724

Hi,

I have internal table with 30 records, but i need 1st record only. how to remove the remaining records. otherwise i want separate out the 1st record. plz give me the code how to do this.

gowri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
708

Hi Gowri,

Use

read table itab index 1.

it will work fine.

Reward point if helpfull.

Srimanta

8 REPLIES 8
Read only

Former Member
0 Likes
708

Hi

loop at itab into wa from index 1.

write wa.

endloop.

Thanks

Vasudha

Message was edited by:

Vasudha L

Read only

Former Member
0 Likes
708

Hi Gowri,

use up to 1 row in your select query.

Reward points if it helps,

Satish

Read only

Former Member
0 Likes
709

Hi Gowri,

Use

read table itab index 1.

it will work fine.

Reward point if helpfull.

Srimanta

Read only

0 Likes
708

Hi,

If you want to keep the first record of your internal table then do this way.

data: wa like itab.

read table itab into wa index 1.

if sy-subrc = 0.

clear itab.

refresh itab.

move wa to itab.

append itab.

endif.

Read only

Former Member
0 Likes
708

hi,

Try this if it works for u

loop at itab.
  if not sy-tabix eq 1.
    DELETE ITAB INDEX SY-TABIX.
  endif.
endloop.

Read only

Former Member
0 Likes
708

<b>read table itab index 1.</b>

Read only

Former Member
0 Likes
708

Hi Gowri,

You solve your problem by writing the following code for your internal table.

loop at itab.

delete itab index 2.

endloop.

Reward if useful.

Regards,

Shilpi

Read only

Former Member
0 Likes
708

loop at itab.

if sy-tabix ne 1.

DELETE ITAB INDEX SY-TABIX.

endif.

endloop.

try this code

reward if useful.