Application Development 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: 

Internal table

Former Member
0 Kudos
105

Hi frnds,

please clear my doubts in internal table... i having int table pernr email name .

first i am filling the table with the pernr and email.

and i need to select the name from some other table and want to fill the column 'name' in the internal table,

if am selecting it the table is filled with the name but the email and the pernr is deleted how to retain it as it is and also the name also should be there adjacent to the correct pernr.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
78

Hi,

Suppose your internal table is itab and is filled with records containing pernr and email.

Now..

Loop at itab.

Itab-name = v_name. " this is the name that you want to populate.

modify itab transporting name.

endloop.

Regards,

Satya.

6 REPLIES 6

vinod_vemuru2
Active Contributor
0 Kudos
78

Hi Karthikeyan,

Why can't U use JOIN for this.

eg: If u r getting pernr and mail from DBT1 and name from DBT2 then JOIN these two tables so that u will get the data in a single step.

SELECT apernr amail b~name

INTO TABLE itab FROm DBT1 AS a INNER JOIN DBT2 AS b

ON Give conditions here(Between DBT1 and DBT2)

WHERE Give if conditions u have here.

Now u have all the details in itab.

If u are populating itab not from the select then do like this.

LOOP AT pernrtab INTO wa.

READ nametab INTO wa1 WITH KEY CONDITIONS.

wa-name = wa1-name.

MODIFY pernrtab FROM wa.

ENDLOOP.

Thanks,

Vinod.

0 Kudos
78

Using joins for the hr infotypes causes performance issue.

i got the sol

thanks

Former Member
0 Kudos
79

Hi,

Suppose your internal table is itab and is filled with records containing pernr and email.

Now..

Loop at itab.

Itab-name = v_name. " this is the name that you want to populate.

modify itab transporting name.

endloop.

Regards,

Satya.

Former Member
0 Kudos
78

hi check this...

tables:pa0002 .

types:begin of ty_itab ,

pernr like pa0002-pernr,

vorna like pa0002-vorna,

end of ty_itab ,

begin of ty_itab1 ,

pernr like pa0002-pernr,

subty like pa0105-subty,

usrid_long like pa0105-usrid_long,

end of ty_itab1,

begin of ty_final ,

pernr like pa0002-pernr,

vorna like pa0002-vorna,

usrid_long like pa0105-usrid_long,

end of ty_final.

data: itab type standard table of ty_itab with header line,

itab1 type standard table of ty_itab1 with header line,

final type standard table of ty_final with header line.

select-options:s_pernr for pa0002-pernr .

select pernr

vorna

from pa0002 into table itab

where pernr in s_pernr .

select pernr

subty

usrid_long

from pa0105

into table itab1

for all entries in itab

where pernr = itab-pernr.

delete adjacent duplicates from itab comparing pernr.

loop at itab .

final-pernr = itab-pernr.

final-vorna = itab-vorna.

loop at itab1 where pernr = itab-pernr

and subty = 10 .

final-usrid_long = itab1-usrid_long.

endloop.

append final.

endloop.

loop at final.

write:/ final-pernr,

final-vorna,

final-usrid_long.

endloop.

regards,

venkat

Former Member
0 Kudos
78

ANSWERED

Former Member
0 Kudos
78

Hi again,

Probably you are not modifying the internal table correctly.

this is what you need to do :

lets assume ur itab has 3 fields

pernr

name

email

u've selected the pernr n email in an itab

1. loop at itab into work area.

2. select the name for the pernr into a variable ( you can select the names before the loop into another internal table with fields pernr and name, in that case read the itab with names with key pernr = work area -pernr )

3. move the name to the name of the work are

modify the itab form work area transporting name.

4. endloop.

regards,

Advait