‎2007 Sep 17 8:21 AM
Hi guys,
I have multiple record in an internal table
for that i have to loop only once
ie only first record i have to loop rest i dont want to loop.
How this can be done?
Regards
senthil
‎2007 Sep 17 8:30 AM
data:BEGIN OF itab OCCURS 0,
z2 type i,
END OF ITAB.
ITAB-z2 = 1.
APPEND ITAB.
ITAB-z2 = 5.
APPEND itab.
loop at itab.
if sy-tabix = 1.
WRITE / itab-z2.
else.
exit.
endif.
ENDLOOP.
‎2007 Sep 17 8:25 AM
What is your actual requirement ? Please let us know. so that we can help you. What do you want to fetch from the internal table ?
‎2007 Sep 17 8:25 AM
Hi!
Clear lv_mblnr.
LOOP AT gt_main INTO wa_main.
IF wa_main-mblnr = lv_mblnr.
CONTINUE.
ELSE.
MOVE wa_main-mblnr TO lv_mblnr.
ENDIF.
other codings
ENDLOOP.
Regards
Tamá
‎2007 Sep 17 8:26 AM
Hi Senthil
Pleae check
Read table ... with index 1 ...
Regards,
Arun
‎2007 Sep 17 8:27 AM
Hi Senthil..
If you want to Read only single record then use the READ TABLE statement.
For 1st Record :
READ TABLE <ITAB> INTO <WA> INDEX 1.
if sy-subrc = 0.
endif.
For reading a single record based on some condition:
READ TABLE <ITAB> INTO <wA> WITH KEY MATNR = P_MATNR.
if sy-subrc = 0.
endif.
REWARD IF HELPFUL.
‎2007 Sep 17 8:28 AM
Hi Senthil,
If reading a single record is the case. I think you can also use SELECT SINGLE *
Regards,
Sai
‎2007 Sep 17 8:30 AM
data:BEGIN OF itab OCCURS 0,
z2 type i,
END OF ITAB.
ITAB-z2 = 1.
APPEND ITAB.
ITAB-z2 = 5.
APPEND itab.
loop at itab.
if sy-tabix = 1.
WRITE / itab-z2.
else.
exit.
endif.
ENDLOOP.