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

How to read table?

Former Member
0 Likes
881

Hi Expets,

I want to read a table inside a LOOP ... ENDLOOP.

But I am not able to do it because while reading I need to take workarea. Kindly suggest a way of reading a table inside a LOOP .. ENDLOOP so that I can read all the contents of the table.

The above mentioned logic I need to implement in BADI.

Thanks,

Vinay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
833

Hi Experts,

I am using the below logic whether it works or not please let me know:-

LOOP AT LIT_STBP INTO LW_STBP1.

IF LW_STBP1-STUFE = 1.

CLEAR LW_STBP2.

LOOP AT LIT_TEMP_STBP INTO LW_STBP2

WHERE VWEGX = LW_STBP1-WEGXX.

IF SY-SUBRC = 0.

DELETE LIT_STBP.

ENDIF.

ENDLOOP.

ENDIF.

ENDLOOP.

Thanks,

Vinay.

Hi Experts,

I am using the below logic whether it works or not please let me know:-

LOOP AT LIT_STBP INTO LW_STBP1.

IF LW_STBP1-STUFE = 1.

CLEAR LW_STBP2.

LOOP AT LIT_TEMP_STBP INTO LW_STBP2

WHERE VWEGX = LW_STBP1-WEGXX.

IF SY-SUBRC = 0.

DELETE LIT_STBP.

ENDIF.

ENDLOOP.

ENDIF.

ENDLOOP.

Thanks,

Vinay.

6 REPLIES 6
Read only

Former Member
0 Likes
833

Try this,

DATA: ITAB TYPE STANDARD TABLE OF MARA.

WA_ITAB TYPE ITAB.

DATA: ITAB1 TYPE STANDARD TABLE OF MAKT

WA_ITAB TYPE ITAB1.

LOOP AT ITAB INTO WA_ITAB

CLEAR WA_ITAB1

READ TABLE ITAB1 INTO WA_ITAB1 WITH KEY

ENDLOOP.

Thanks,

SKJ

Read only

Former Member
0 Likes
833

Check this sample.

data ind  type i.
loop.
ind = ind + 1.
read table it_data index ind.
if sy-subrc ne 0.
exit.
endif.
endloop.

Read only

former_member156446
Active Contributor
0 Likes
833

loop at itab.

read table itab index sy-tabix. " every single record will be read here

if sy-subrc eq 0.
 logic....
endif.

endloop.
Read only

Former Member
0 Likes
834

Hi Experts,

I am using the below logic whether it works or not please let me know:-

LOOP AT LIT_STBP INTO LW_STBP1.

IF LW_STBP1-STUFE = 1.

CLEAR LW_STBP2.

LOOP AT LIT_TEMP_STBP INTO LW_STBP2

WHERE VWEGX = LW_STBP1-WEGXX.

IF SY-SUBRC = 0.

DELETE LIT_STBP.

ENDIF.

ENDLOOP.

ENDIF.

ENDLOOP.

Thanks,

Vinay.

Read only

0 Likes
833

no need of sy-subrc check in side loop.

LOOP AT LIT_STBP INTO LW_STBP1.
IF LW_STBP1-STUFE = 1.
CLEAR LW_STBP2.
LOOP AT LIT_TEMP_STBP INTO LW_STBP2
WHERE VWEGX = LW_STBP1-WEGXX.

DELETE LIT_STBP.
ENDLOOP.
ENDIF.
ENDLOOP.

Read only

Former Member
0 Likes
833

thanks vijay,

I got some solution with ur answer.