07-12-2007 3:49 PM
Hi all,
i'm trying to create a nested loop with two dynamic tables.
However, i cannot yet.
for example;
<table1> has two fields : kunnr and menge, then
<table2> has three fields : kunnr, matnr and menge.
The field kunnr is key field for those two tables.
and the loop will seem like below :
loop at <table1> assigning <line1>.
....loop at <table2> assigning <line2> [where kunnr = <table1>kunnr].
......bla... bla.. bla...
....endloop.
endloop.
However, i could not handle to use this where condition.
Any solution offered will be appreciated.
Thnkx....
07-12-2007 3:58 PM
Hi
U can't use the condition in this situation, so u need read all records of second table and check if the condition is sutisfated:
FIELD-SYMBOLS: <KUNNR1> TYPE ANY,
<KUNNR2> TYPE ANY.
LOOP AT <TABLE1> ASSIGNING <LINE1>.
ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <LINE1> TO <KUNNR1>.
LOOP AT <TABLE2> ASSIGNING <LINE2>.
ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <LINE2> TO <KUNNR2>.
CHECK <KUNNR1> = <KUNNR2>.
BLA BLA BLA
ENDLOOP.
ENDLOOP.
Max
02-19-2008 1:43 PM