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

abap code

Former Member
0 Likes
416

Hi folks,

I need some help in the abap code. I have some records in a database table A and I need to validate the records in the table with the records in an internal table based on the employeeid. if there are records in the internal table then continueotherwise insert the record from the table into the itab and append it.

My approach:

I first read all the records fromt he database table into the internal table,

select * from A into corresponding fields of itab_A where vpid = empnum and endda = v_enddate and begda = v_startdate.

if sy-subrc = 0.

append itab_A.

endif.

Now, I want to validate the records in itab_A with another itab_B. itab_B has some records that are common with itab_A in that case justcontinue otherwise insert the record in itab_B

also itab_A and itab_B have different table structure with few common fields.

my question is how to validte between two internal tables?

Thanks,

Sk

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
385
select * from A into corresponding fields of  TABLE itab_A 
         where vpid = empnum 
            and endda = v_enddate 
            and begda = v_startdate.

Loop at itab_a.

read table itab_b with key vpid = itab_a-vpid.
if sy-subrc  <> 0.
move-corresponding itab_a to itab_b.
append itab_B.
endif.

endloop.



Regards,

Rich Heilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
386
select * from A into corresponding fields of  TABLE itab_A 
         where vpid = empnum 
            and endda = v_enddate 
            and begda = v_startdate.

Loop at itab_a.

read table itab_b with key vpid = itab_a-vpid.
if sy-subrc  <> 0.
move-corresponding itab_a to itab_b.
append itab_B.
endif.

endloop.



Regards,

Rich Heilman

Read only

0 Likes
385

thanks Rich. It worked. Full points to you.

SK