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

Joining internal table data for output

Former Member
0 Likes
948

Hi Experts,

I have a problem with 2 internal tables.

I have an internal table with some 7 records with the project details with some fields..

like proj num,proj year.....etc

and

2nd internal table with only 3 records and structure is

Proj Number (Only 1 field).

I need to display the 2nd internal table proj number details with 1 st internal table structure for only 3 records which are part of 7 records.

which statement can i use ?

please let me know.

regards

vishnu

Moderator message: subject corrected (at least I tried), please use a more meaningful one next time!

Edited by: Thomas Zloch on Mar 8, 2010 12:42 PM

10 REPLIES 10
Read only

Former Member
0 Likes
918

How about reading the forum rules and using a meaningful subject line first?

Read only

venkat_o
Active Contributor
0 Likes
918

Hi <li>Use meaningful subject <li>Try this way .


LOOP AT 2nd_itab.
 LOOP AT 1st_itab where proj_no = 2nd_itab-proj_no.

 ENDLOOP.
ENDLOOP.
Thanks Venkat.O

Read only

Former Member
0 Likes
918

Hi,

Try this,

LOOP AT 2nd Internal.

Read 1st Internal Table with key where projnumber = 2ndinternaltable-projnumber.

if sy-subrc eq 0.

Modify the records or append it to the new internal table ( of required Structure)

clear: itab2,itab1.

endif

Endloop.

Regards,

Sathish.

Read only

0 Likes
918

I used the same code but it is throwing an error saying that "PSPID is not expected" in where condition.

Loop at t_out into wa_out.

Read TABLE t_proj with table key where pspid = wa_out-pspid.

modify t_proj index sy-tabix.

if sy-subrc = '0'.

  • Message

endif.

endloop.

Read only

Former Member
0 Likes
918

hi...

try this statement

select proj.no ...... .... from it_tab1into it_tab

for all entries in it_tab2 where proj.no = it_tab2-proj.no.

where it_tab1 and it_tab2 are your internal tables and it_tab have same structure like it_tab.

Regards,

Lokeswari.

Read only

0 Likes
918

Hi Lokeshwari,

You have missed the names..

Please let me know what it refers to ..

thanks for response.

regards

vishnu

Read only

0 Likes
918

hi!

Declare Work area for the table t_proj and try.

Read TABLE t_proj into wa_prog with  key where pspid = wa_out-pspid.

Read only

0 Likes
918

hi...

Those are your first internal table fields.

Regards,

Lokeswari.

Read only

Former Member
0 Likes
918

Hi,

Loop at the 2nd internal table into work area.

read the 1st internal table into work area where proj num = wasecond table-projnum( frm 2nd internal table)

now this will read only those records wher project number from 2nd matches those in the first , This is how you can get only records for the 3 project numbers which are in the 2nd internal table.

Read only

Former Member
0 Likes
918

I got resolution.