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

Fill fields in itab?

Former Member
0 Likes
1,535

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,453

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

9 REPLIES 9
Read only

Former Member
0 Likes
1,453

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

Read only

Former Member
0 Likes
1,453

hi, after filling all ur fields from view, then use modify statement .that is the best way i think so.

regards

karthik

Read only

sachinjakkaria
Active Participant
0 Likes
1,453

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

Read only

former_member189629
Active Contributor
0 Likes
1,453

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

Read only

Former Member
0 Likes
1,454

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

Read only

Former Member
0 Likes
1,453

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

Read only

Former Member
0 Likes
1,453

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

Read only

paruchuri_nagesh
Active Contributor
0 Likes
1,453

hi

subbu

how ru

i think u will catch me

cheers

Read only

Former Member
0 Likes
1,453

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