Application Development 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: 

internal table

Former Member
0 Kudos

Hi All,

How to find current number of record in internal table which is being processed.

Loop IN_TABLE.

**trap the current record number in internal table

ENDLOOP.

Thanks,

Pratibha.

8 REPLIES 8

Former Member
0 Kudos

Use the variable SY-TABIX. You can look at the SY-INDEX to find the no. of the loop.

Regards,

Ravi

former_member628175
Active Participant
0 Kudos

Hi Pratibha ,

Use field SY-TABIX . This stores the current record number which is been processed .

Hope this helps .

Thanks ,

Shounak M.

Former Member
0 Kudos

Hi Pratibha,

<b> sy-tabix</b> is the system filed which gives the current record number in an internal table.

Regards!

Former Member
0 Kudos

Hi Pratibha,

<b>'SY-TABIX' </b>is the system field that holds the current number of record in internal table which is been processed.

Hope this helps you.

Cheers,

Anirban.

Former Member
0 Kudos

HI

GOOD

YOU CAN CHECK WITH SY-TABIX.

WHEN YOU DEBUG THE REPORT IN THE DEBUG MORE CLICK ON THE PARTICULAR ITAB IT WILL SHOW YOU THE FIELDS IT CONTAINS AND SY-TABIX VALUE LL BE DISPLAY DOWN ,OTHERWISE YOU CAN DIRECTLY USE IT IN YOUR REPORT.

THANKS

MRUTYUN

Former Member
0 Kudos

Hi Prathiba,

<b>SY-TABIX</b> hold the current index number of the record read in the LOOP pass. <b>SY-INDEX</b> has no effect in a LOOP...ENDLOOP statement. Only the system variable <b>SY-TABIX</b> is effected.

Consider this code.(Copy and execute you will come to kenow the role of SY-TABIX).


REPORT zztest.

DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.

START-OF-SELECTION.

  SELECT * FROM mara INTO TABLE it_mara UP TO 25 ROWS.

  WRITE : /3(20) 'MATERIAL',
           25(7) 'SY-TABIX',
           33(8) 'SY-INDEX'.


  SKIP 2.

  LOOP AT it_mara.

    WRITE : /3(20) it_mara-matnr,
             25(7) sy-tabix,
             33(7) sy-index.
  ENDLOOP.

Regards,

Arun Sambargi.

Former Member
0 Kudos

Hi.

you can use SY-TABIX to find the current number of record.

SY-TABIX will give the index of current record being processed.

0 Kudos

Hi,

As others have said, sy-tabix gives the current record of the itab when looping through it. Suppose I have an internal table with 10 records. On the first loop, sy-tabix gives you a value of 1 and on the second loop it gives you a value of 2 and so on. In SAP documentation it means:

Short text

Internal table, current line index

Definition

The number of the current line of the last internal table edited (when processing with the ABAP keywords LOOP, READ and APPEND).

Hope this helps.

P.S. Please award points for useful answers.