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 problem

Former Member
0 Likes
855

Hi Guy's,

Please help me Friends!!

Based on the reqirement i did coding like this:

Loop at P0001 into wa_p0001.

Read table it_t001p into wa_t001p with key werks = wa_p0001-werks

BTRTL = wa_p0001- BTRTL.

If sy-subrc = 0.

***Problem

Loop at it_zhrlight into wa_light where MOlga = wa_t001p-molga

And r_from >= wa_p0001-pernr

And r_to <= wa_p0001-pernr.

Move pernr to output1 .

Exit.

Endloop.

Endif.

Endloop.

wa_light doesn't contain any entries.

But it_zhrlight contain the values... in where condition ineed to check r_from >= wa_p0001-pernr*

r_to <= wa_p0001-pernr.*

Plese guid me where i wrorte the mistake.

Thanks & Regards,

Sai.

7 REPLIES 7
Read only

Former Member
0 Likes
822

Hi,

Does it have entries which correspond to the criteria: wa_t001p-molga?

Otherwise it can not be initial.

Best regards,

Guido Koopmann

Read only

Former Member
0 Likes
822

Hi,

What about teh variable 'wa_t001p-molga'

Where does it get data from?

Regards,

Ankur Parab

Read only

Sm1tje
Active Contributor
0 Likes
822

1. how are r_from and r_to defined.

2. Are these r_from and r_to part of the internal table, or are these some sort of range?

Read only

Former Member
0 Likes
822

Hi Sai,

Instead of looping you can :

Read table it_zhrlight into wa_light where MOlga = wa_t001p-molga

And r_from >= wa_p0001-pernr

And r_to <= wa_p0001-pernr.

Also you are moving field pernr to which field of output1???????

Read only

0 Likes
822
*Move pernr to output1 .*

where are u passing value to pernr?

and what is the type of both of these pernr and output1??

and if :

Loop at it_zhrlight into wa_light where MOlga = wa_t001p-molga
And r_from >= wa_p0001-pernr
And r_to <= wa_p0001-pernr.

is ur problem

then check the declaration for r_from and r_to with wa_p0001-pernr.

put a break point in the starting of loop and check the values.

Edited by: soumya prakash mishra on May 25, 2009 2:23 PM

Read only

Former Member
0 Likes
822

>

> Hi Guy's,

>

> Please help me Friends!!

> Based on the reqirement i did coding like this:

>

> Loop at P0001 into wa_p0001.

> Read table it_t001p into wa_t001p with key werks = wa_p0001-werks

> BTRTL = wa_p0001- BTRTL.

> If sy-subrc = 0.

> ***Problem

> Loop at it_zhrlight into wa_light where MOlga = wa_t001p-molga

> And r_from >= wa_p0001-pernr

> And r_to <= wa_p0001-pernr.

> Move pernr to output1 .

> Exit.

> Endloop.

> Endif.

> Endloop.

>

> wa_light doesn't contain any entries.

> But it_zhrlight contain the values... in where condition ineed to check r_from >= wa_p0001-pernr*

> r_to <= wa_p0001-pernr.*

>

> Plese guid me where i wrorte the mistake.

>

> Thanks & Regards,

> Sai.

Hi

1. Entries avaialable in  it_zhrlight  internal table are satisfiying the where condition.
2. use GE, LE &  EQ instead of >= , =<.
3. Work Area  wa_light is like line of it_zhrlight.

Read only

Former Member
0 Likes
822

Hi Sai,

R the work area wa_light and the internal table it_zhrlight have the same structure(fields in the same order).

If it is not then the w/a will not get the values

Regards,

Manjunath