2007 Sep 17 11:22 AM
Hi,
I have 26 columns in itab. I should fill 19 of them from a view. After 19 columns filled, I should fill remaining columns from different database tables. what is the best way now I should follow?
Regards,
Subbu
2007 Sep 17 11:28 AM
select data from corresponding tables into internal tables.
(check out table for your view you cant have select query on view i guess)
loop internal table with 19 fields
use move corresponding to get 19 fields.
inside the loop use read table for other database tables.
after completely populating your work are append it to internal table.
reward points if helpful
2007 Sep 17 11:26 AM
hi
when moving, use the corresponding option.
if the types are different, then u have to do it manually, there is no other option
Regards,
Prasant
*reward if useful
2007 Sep 17 11:27 AM
hi, after filling all ur fields from view, then use modify statement .that is the best way i think so.
regards
karthik
2007 Sep 17 11:27 AM
Hi.
After fetching data from view.
Use select query with " for all entries in itab " for fetching data from other table into second internal table.
And after move second table data to ur original table by using modify.
hope it helps.
/sachinkumar
2007 Sep 17 11:28 AM
Hi Subba Reddy,
You can fill in the first 19 by using the addition INTO CORRESPONDING FIELDS of itab and do an APPEND.
For the remaining, READ the table line with a specific key to identify the exact line to be populated, move the values into the itab's respective fields and use MODIFY ITAB INDEX SY-TABIX (sy-tabix in this case is the index of a successful read).
Reward if helpful,
Karthik
2007 Sep 17 11:28 AM
select data from corresponding tables into internal tables.
(check out table for your view you cant have select query on view i guess)
loop internal table with 19 fields
use move corresponding to get 19 fields.
inside the loop use read table for other database tables.
after completely populating your work are append it to internal table.
reward points if helpful
2007 Sep 17 11:29 AM
Hi Subba
you can see which table that join each other in your view (T-code : SE11 )and you know another table for other fields (19-26 ) .
If there are relationship between that tables , you can select data from that tables with condition that you would like.
Regards
Wiboon
2007 Sep 17 11:30 AM
HI make 3 itabs.
1st with 19.
2nd with 7
and 3rd with 26.
first select 19 fields from into itab 1.
then fill 7 fileds into itab2.
then loop at itab 1 and move to itab 3.
use appned.
now loop at itab2 and move fields to itab3 use modify.
hope it helps
reward if helpful
vivekanand
2007 Sep 17 11:32 AM
2007 Sep 17 11:38 AM
Hi,
Following is one of the best way for your scenario.
Since the 19 columns for ITAB are filled from the same view, execute the query on this view first and fill 19 columns.
The remaining seven columns may get filled either from a single DB table or different tables.
In such cases identify whether the same key field combination is possible for all the Internal tables(for eg: ITAB and other tables). If possible use the ITAB as reference and select the other fields from respective tables by doing a select FOR ALL ENTRIES based on ITAB.
Next step is to fill the rermaining 7 columns for each records in ITAB.
Loop at ITAB.
Read table itab1 into wa_itab1 with key f1 = itab-fi f2 = itab-fj....BINARY SEARCH.
itab-f20 = wa_itab1-f20.
.................
Follow the read on all the internal tables from which the remaining field values are to be fetched.
Modify itab.
ENDLOOP.
By this way ,selecting from different DB tables will not hamper the program execution.
Hope this helps ....
Regards,
Dilli