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: 

How 2 get whole 1 record in one internal table ?

Former Member
0 Kudos

hello friends,

I have one internal table with 6 fields like-

vbeln posnr kunnr name1 username changed_dt

Now, I have already appeneded this table with 5 fields,

beln posnr kunnr name1

now there is some operation.

i got username and changed_dt in to another internal table.

Now i want to get vbeln which is related to username.

So how can i get 1 whole record ?

Please give me example

thanks in advance !!

n.master

1 ACCEPTED SOLUTION

Former Member
0 Kudos

sort itab1 by username.

loop at itab2.

read table itab1 with key username = itab2-username.

if sy-subrc EQ 0.

<< itab1-vbeln will contain value.. u can use it>>

endif.

endloop.

8 REPLIES 8

former_member200338
Active Contributor
0 Kudos

Hi,

Can you tell us how u got the username and changed_dt?

Regards,

Niyaz

0 Kudos

From another table CDPOS.

Former Member
0 Kudos

sort itab1 by username.

loop at itab2.

read table itab1 with key username = itab2-username.

if sy-subrc EQ 0.

<< itab1-vbeln will contain value.. u can use it>>

endif.

endloop.

Former Member
0 Kudos

The link between these 2 tables is USERNAME and CHANGED_DATE.

You can loop at one table. In the loop read another table with above keys, If the READ is successful, get the VBELN value and modify the internal table.

LOOP AT ITAB.

L_TABIX = SY-TABIX.

READ TABLE ITAB1 WITH KEY USERNAME = ITAB-USERNAME

CHANGED_DATE = ITAB-CHANGED_DATE.

IF SY-SUBRC EQ 0.

ITAB-VBELN = ITAB1-VBELN.

MODIFY ITAB INDEX L_TABIX TRANSPORTING VBELN.

ENDIF.

ENDLOOP.

Hope this helps.

ashish

JozsefSzikszai
Active Contributor
0 Kudos

hi Master

what is the connection between the two internal tables? If my understanding is right in one internal table you have beln posnr kunnr name1, and in the other one username change_dt.

ec

0 Kudos

yes eric !!

0 Kudos

if there is no direct link between itab1 and itab2 you have to go back to the database...

Former Member
0 Kudos

try below.. i don know if this is ur exact requirement.

sort itab2 by username.

loop at itab1.

read table itab2 with key username = itab1-username.

if sy-subrc EQ 0.

itab1-changed_dt = itab2-changed_dt.

modify itab1.

endif.

endloop.