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

Internal Table Entry

Former Member
0 Likes
758

Hi

Prob: I want to insert a record into an Internal Table.

But the values of the fields of Internal Table are scattered in different tables.

The situation is like that I cannot use a join condition or for all entries here.

Query: Advise me how can I retrieve values and enter them to Internal Table fields in compliance with SELECT statements for different tables.

Thx

10 REPLIES 10
Read only

Former Member
0 Likes
735

hi,

use for all entries

For ex:-

SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart

dmbtr mwart hwbas aufnr projk shkzg kokrs

FROM bseg

INTO TABLE it_bseg

FOR ALL ENTRIES IN it_bkpf

WHERE bukrs EQ it_bkpf-bukrs AND

belnr EQ it_bkpf-belnr AND

gjahr EQ it_bkpf-gjahr.

Reward if useful

Regards

Read only

0 Likes
735

Sorry.. This is not possible in my requirement

Read only

Former Member
0 Likes
735

Hi, Santo.

I think we can select values from different tables into a work area, may be use many 'select' statements, then append or insert this work area to the internal table.

Regards,

feng.

Read only

Former Member
0 Likes
735

use

loop at internaltablename into wa.

modify finalinternaltable from wa.

endloop.

Read only

Former Member
0 Likes
735

use data extract to get the fields....

each row will fetch the fields in different tables ...

Read only

Former Member
0 Likes
735

Hi,

Loop the internal table and fetch data from the tables for each record and modify the table.

Loop at itab.

select f1 into itab-f1

from Zxxx

where f2 = itab-f2.

modify itab transporting f1.

endloop.

Hope this helps you.

Read only

Former Member
0 Likes
735

Hi,

Use subqueries.

Regards,

Renjith Michael.

Read only

Vijay
Active Contributor
0 Likes
735

hi,

you can select fields from one table into an internal table and then can use

FOR ALL ENTRIES IN to fetch the data from another database table based on the field in the internal table.

for ex....

select A B C from db_table

into it_tab.

select X Y Z from db_table2

into it_tab2

for all entries in it_tab

where x = it_tab-A.

IF u have to fetch the fields from db_table based on the fields from more then one table then u can use range and fetch based on both range and for all entries in.

for ex.

select X Y Z from db_table2

into it_tab2

for all entries in it_tab

where x = it_tab-A and

y in r_range.

regards

vijay

reward points if helpfull

Read only

RoySayak
Active Participant
0 Likes
735

Hi Santo,

You can try it...

SELECT f1 f2 f3 f4 f5

FROM main1 INTO TABLE it_main1

WHERE f1 IN <S1>.

SORT it_main1 BY f1.

IF it_main1[] IS NOT INITIAL.

SELECT a1 a2 a3 a4 a5

FROM table1 INTO TABLE it_table1

FOR ALL ENTRIES IN it_main1

WHERE a1 = it_main1-f1.

SELECT ******

******

******

SELECT******

*****

******

ENDIF.

LOOP AT it_table1 INTO wa_table1.

READ TABLE it_main1 INTO wa_main1 WITH KEY f1 = wa_table1-a1.

wa_final-x1 = wa_table1-a1.

wa_final-x2 = wa_table1-a2.

wa_final-x3 = wa_main1-f2.

wa_final-x4 = wa_main1-f3.

wa_final-x5 = wa_main1-f5.

wa_final-x6 = wa_table2-p1.

wa_final-x7 = wa_table2-p6.

.

.

.

APPEND wa_final TO it_final.

ENDLOOP.

Regards,

Sayak... ..."reward if it is helpful"

Read only

Former Member
0 Likes
735

Not Solved the problem!