‎2009 May 07 12:41 PM
Hi,
I am appending records into one internal table from various tables. The tables might not have the same structure as the internal table.
types: begin of price_list,
matnr type a746-matnr,
field1 type a746-field1,
field2 type a746-field2,
field3 type a745-field3,
field4 type a733-field4,
end of price_list.
data: i_price_list type table of price_list.
select matnr field1 field2
from a746
appending table i_price_list
where ...
select matnr field3 "I want the field3 to go in the 4th column of the internal table.
from a745
appending table i_price_list
where ....
I will not be able to give into corresponding fields due to some restrictions of the query. I want to avoid loops as they create a huge overhead. Can anyone suggest me how do I go about it
‎2009 May 07 12:45 PM
Hello,
Try this statement.
APPEND LINES OF internal table1 TO internal table2.
‎2009 May 07 12:49 PM
I have 10 pricing tables, if I use 10 internal tables to collect that data and then into a final internal table, then I will have serious performance issues, as I will have to loop at every table and move the fields. I would rather like to know if I can do it directly using the select statement. In MS SQL we can give
select field1, 0, field2
from table_name
In this case the column1 and column3 have values, where as the column2 has 0.
Is something similar possible in abap?
‎2009 May 07 1:25 PM
U can do in this way..[no such way as u specified]
select field1 field2 into table tab where..... >here tab is new internal table.
and then
loop over tab into wa
wa_1-field1 = wa_field1. here wa_1 and tab1 are ur table and work areas...
wa_1-field2 = wa_field2.
append wa_1 to tab1.
endloop
Select into new internal table and loop over this internal table and append where required to ur table..
Edited by: Veeranji Reddy on May 7, 2009 5:56 PM
‎2009 May 07 12:47 PM
‎2009 May 07 12:52 PM
Hi,
You can select in one internal table and update the destination table with LOOP-ENDLOOP.
This willease burden on database but more processing at application server.
Regards
Shital
‎2009 May 07 1:33 PM
Use addition
APPENDING CORRESPONDING FIELDS OF TABLE itabin SELECT.
‎2009 May 07 1:37 PM
HI,
Try using
INTO CORRESPONDING FIELDS OF
i.e select .......... from table into corresponding fields of i_table.
Hope this will solve.
Thanks and regards
Suraj
‎2009 May 07 1:39 PM
Hi,
use the following code...
types: begin of price_list,
matnr type a746-matnr,
field1 type a746-field1,
field2 type a746-field2,
field3 type a745-field3,
field4 type a733-field4,
end of price_list.
data: i_price_list type table of price_list.
select matnr field1 field2
from a746
appending table i_price_list
where ...
select matnr field3 "I want the field3 to go in the 4th column of the internal table.
from a745
appending corresponding fields of table i_price_list
where ....Regards,
Siddarth
‎2009 May 07 2:38 PM
If possible try an Outer Join
select tableA~matnr
tableA~fieldx
tableB~fieldy
tableC~fieldz
into table i_price_list
from tableA left outer join tableB on ( tableA... = tableB...)
left outer join tableB on ( tableA... = tableC...)
where ...
‎2009 May 07 3:16 PM
I am planning to give a blank field of the tables. Especially mara~lvorm in the columns that I will want as blanks since this field is being filtered as blank in the where clause. The columns that might be left empty are all char type so I dont feel it will be an issue here. Thanks a lot everybody.