‎2006 Mar 16 2:07 PM
A common scenario ->
1. Running an sql query , i get 5 values in an internal table itab1.
2. Running another sql query,i get another 5 values in internal table itab2. I need to enter the corresponding fields of internal table itab1 into itab2.
3. the same scenario will continue for 4 internal tables.
and finally my data will be displayed for the 4rth table..
I want to know how will bw the flow of my code....
kindly help me with relevant logic and how do i take up with the program.
thanks
‎2006 Mar 16 2:17 PM
ur query can be something like ths:
loop at table1.
loop at table2 where key = table1-key.
move-corresponding table1 to t_final.
move-corresponding table2 to t_final.
endloop.
endloop.
Hope it helps,
Regards,
Bikash
‎2006 Mar 16 2:27 PM
Hi Pradipta,
In case of two tables:
Suppose you want to move the value of field3 and field4 from internal table 1 into internal table 2.
First your internal table 2 should have the fields which you want to move from internal table 1.
itab1 - field1, field2, field3, field4
itab2 - field2, field3, field4, field5, field6
Loop at itab2.
Read table itab1 with key field2 = itab2-field2.
itab2-field3 = itab1-field3.
itab2-field4 = itab1-field4.
modify itab2 transporting field3 field4.
(This will modify the values for field3 and field4 only)
endloop.
Hope it helps.
Regards,
Neeraj Gupta
‎2006 Mar 17 7:25 AM
kindly provide solution :
SELECT ABLEINH ANLAGE FROM EANLH
INTO CORRESPONDING FIELDS OF TABLE IT_ITAB1
WHERE EANLH~ABLEINH IN S_MRU.
next i need to count that the number of installations 'anlage' for a particular ableinh and store the same in the same internal table IT_ITAB1 .... how do i do it ?
thx..
‎2006 Mar 17 7:37 AM
hi,
create another itab with the same fields and another extra field to store the 'count'. copy all the contents to another temp. itab. delete adjacent duplicates comapring ableinh.
then,
loop at it_itab1_temp.
loop at it_itab1 where ableinh = it.._temp-ableinh.
keep a counter.
endloop.
append the fields to ur 'count itab.
endloop.
regards,
Madan..
‎2006 Mar 17 8:58 AM
types: begin of t_itab,
ableinh like eanlh-ableinh,
count1 type i,
end of t_itab.
data: it_itab1 type standard table of t_itab.
SELECT ABLEINH count(ANLAGE) FROM EANLH
INTO TABLE IT_ITAB1
WHERE EANLH~ABLEINH IN S_MRU group by ABLEINH.