05-22-2006 11:04 AM
Dear all,
Please do let me know how to refresh/initialize 'sy-tabix' for every new document in a loop statement.
Thanx in advance.
Alok.
05-22-2006 11:08 AM
Hi
I can't understand your request, what does "Initialize sy-tabix" mean?
That system variable has the index of the current record while looping an internal table, so what do you really need to do?
Max
05-22-2006 11:10 AM
why do you need to refresh or initialize system variables.
more over most system varialble do not change
05-22-2006 11:10 AM
Move the content of sy-yabix into a local varaibel lv_tabix and clear this lv_tabix in side the loop.
loop at itab.
lv_tabix = sy-tabix.
clear lv_tabix.
Use lv_tabix in place of sy-tabix
endloop.
05-22-2006 11:11 AM
HI
GOOD
Read TABLE and Modify
read table t_vbap
with key ps_psp_pnr = t_tab-pspnr binary search.
t_vbap-kunnr = w_kunnr.
modify table t_vbap index sy-tabix.
sy-tabix is the index number of the currently processed row for an internal table.
you can initialize the sy-tabix using if loop.
THANKS
MRUTYUN
05-22-2006 11:13 AM
Never try to refresh or initialize system variable. It shall always lead to errors in the programs. For this I have an alternative way below.
Please declare a variable for e.g
data: <b>l_count</b> type sy-tabix.
Inside loop you can write the code like this:
say for eg. you need to refresh l_count for every new material.
Loop at itab.
on change of itab-material.
clear : l_count.
endon.
l_count = l_count + 1.
......
endloop.
Hope this clarifies your issue.
Lakshminarayanan
05-22-2006 11:13 AM
LOOP AT IT_VBRK.
CTAB = SY-TABIX.
LOOP AT IT_T001 WHERE BUKRS = IT_VBRK-BUKRS.
IF SY-SUBRC = 0.
IT_VBRK-BUTXT = IT_T001-BUTXT.
MODIFY IT_VBRK INDEX CTAB.
CLEAR CTAB.
ENDIF.
ENDLOOP.
ENDLOOP.
Check the code above which helps u on Sy-TABIX
05-22-2006 11:16 AM
Hi,
what do you mean by refresh/initialize?
please be more clear..
data: l_index type sy-tabix.
Loop at itab.
l_index = sy-tabix.
.......
.....
clear l_index.
endloop.
Regards
vijay
05-22-2006 11:25 AM