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

Loop

Former Member
0 Likes
1,059

Hallo

TYPES: BEGIN OF ty_vbak,

vbeln TYPE vbak-vbeln,

END OF ty_vbak.

DATA: tes(15) TYPE c,

lt_vbak TYPE TABLE OF ty_vbak,

wa_vbak LIKE LINE OF lt_vbak.

LOOP AT lt_vbak INTO wa_vbak.

wa_vbak-vbeln = 100 + 1.

IF wa_vbak-vbeln = 1000.

EXIT.

ENDIF.

ENDLOOP.

In the above code the program dont enter in loop. can somebody tell where is my mistake.

thanks.

10 REPLIES 10
Read only

Former Member
0 Likes
1,038

hi,

in order to get in to the loop, check whether the internal table is intial or not.

If internal table has records, only then it will get into the loop..

hope it is clear..

Rgds.,

subash

Read only

tarangini_katta
Active Contributor
0 Likes
1,038

HI ahmed,

I dont' see any select statement from u r code.

Check u r internla table has records or is it empty.

IF it is empty it wont get into loop.

Thanks

Read only

Former Member
0 Likes
1,038

hI

Is there any data in internal table lt_vbak ? There is no SELECT statement .

Regards

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
1,038

Your internal table is empty.

Read only

jyotheswar_p2
Active Participant
0 Likes
1,038

hi

There is no data lt_vbak table to loop.SO append some values to the table and try again then it will defnetly enter into the loop.

regards

Jyotheswar.

Read only

former_member15255
Active Participant
0 Likes
1,038

Hello,

As there is no data in the Internal Table " lt_vbak" it will not get in to the Loop

regards

Suresh

Read only

Former Member
0 Likes
1,038

Hi Waseem,

First check whether ur internal table lt_vbak is having any data or not. Bcoz in the code that u hv posted I do not see any select query populating the internal table.

Regards,

Arnab

Read only

Former Member
0 Likes
1,038

Have you populated the table lt_vbak ?

Check the data in lt_vbak by debugging.

Regards,

Nitin.

Read only

kanishakgupta1
Contributor
0 Likes
1,038

u have not used the select query

Read only

Former Member
0 Likes
1,038

hi,

this is yuor code.

> TYPES: BEGIN OF ty_vbak,

> vbeln TYPE vbak-vbeln,

> END OF ty_vbak.

>

> DATA: tes(15) TYPE c,

> lt_vbak TYPE TABLE OF ty_vbak,

> wa_vbak LIKE LINE OF lt_vbak.

> LOOP AT lt_vbak INTO wa_vbak.

> wa_vbak-vbeln = 100 + 1.

> IF wa_vbak-vbeln = 1000.

> EXIT.

> ENDIF.

> ENDLOOP.

write it like this.


TYPES: BEGIN OF ty_vbak,
      vbeln TYPE vbak-vbeln,
       END OF ty_vbak.
 
 DATA: tes(15) TYPE c,
       lt_vbak TYPE STANDARD TABLE OF ty_vbak,
       wa_vbak type ty_vbak.
 LOOP AT lt_vbak INTO wa_vbak.
   wa_vbak-vbeln = 100 + 1.
   IF wa_vbak-vbeln = 1000.
     EXIT.
   ENDIF.
 ENDLOOP.

hope this helps

Regards

Ritesh Jha