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

help on System fields.

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Dec 13, 2005 at 02:31 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2005 at 02:32 PM

    where tfill gives current number of entries in internal table

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2005 at 02:41 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2005 at 02:27 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 13, 2005 at 02:31 PM

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

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

    regards

    vijay

    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.