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

help on System fields.

Former Member
0 Likes
674

Hi all,

I have always confusion when to use which system fields(tabix, index, tfill).

í created one program first i used sy-tabix instead of sy-index.Then it doesnt work.

Please clarify me with examples.

that code is.


FORM delimiting.

  DO.
* assigns the next field in the current header to <f>.
    ASSIGN COMPONENT sy-index OF STRUCTURE i_itab TO <f>.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.

    IF sy-index = 1.
      excel_string = <f>.
    ELSE.
      CONCATENATE excel_string <delim> <f> INTO excel_string.
    ENDIF.
  ENDDO.

ENDFORM.                    " delimiting

Thanks and regards

Chandu.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
650

Use SY-index when working with DO loops. Use SY-TABIX when working with LOOP or READ statements. Just remember that sy-<b>TAB</b>ix is used for internal tables tables.

Regards,

Rich Heilman

5 REPLIES 5
Read only

Former Member
0 Likes
650

hi,

sy-tabix is used in loop and endloop for internal tables.

sy-index is used for do and enddo and other loops like while

Read only

Former Member
0 Likes
650

in case of Do loops we usually go for sy-index,

in loop and endloops or read statements we use sy-tabix..

regards

vijay

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
651

Use SY-index when working with DO loops. Use SY-TABIX when working with LOOP or READ statements. Just remember that sy-<b>TAB</b>ix is used for internal tables tables.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
650

where tfill gives current number of entries in internal table

Read only

Former Member
0 Likes
650

Hi,

Sy-index specifies about the current loop pass which is same as ur example.

Sy-tabix stores the current line index of the table.

loop at it_mara.

< ur logic >

modify table it_mara index sy_tabix.

endloop.

Sy-tfill tells abt the current number of lines in the internal table.

describe table it_mara lines sy-tfill.

if sy-tfill = 0.

<ur code if table is initial>

endif.

Regards,

Neelima.