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

Compare Master Data with Data in a Table.

Former Member
0 Likes
457

Hi ABAP Experts!!

I posted the same thread twice in BI general, but was not able to get replies.

Could anyone help out me with this problem..

We have loaded some data into a Master Data Object (YMETADATA) in Development system.

Now, the same data can be present in a View RSDVCHA.

Our aim is to write a ABAP program, which would read a record from the View (RSDVCHA) and look into Master Data records and show whether it is present in the master data or not?

Do we have any built-in code to compare by such criteria??

Has anyone written such type of code earlier, If so, please do help me out in writing this code?

Thanks in advance,

Anjum.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
339

hi,

tables:
  YMETADATA,
  RSDVCHA.

*internal table declarations
data:
  t_ymetadata type table of ymetadata.

data:
  t_rsdvcha type table of t_rsdvcha.
  
*populating records into internal tables

 select * from ymetadata into table t_ymetadata.
 
 
 select * from rsdvcha into table t_rsdvcha.
 
*checking if records are present or not. 
 loop at t_ymetadata into ymetadata.

*here fieldname is which you want to compare with the field of rsdvcha.
   read table t_rsdvcha into rsdvcha with key fieldname = ymetadata-fieldname.
   if sy-subrc eq 0.
     write:/ ymetadata-fieldname, ' is present in rsdvcha'.
   else.
     write:/ ymetadata-fieldname, 'record does not exist in rsdvcha'.
   endif.
   
 endloop.

Regards

Anup.

1 REPLY 1
Read only

Former Member
0 Likes
340

hi,

tables:
  YMETADATA,
  RSDVCHA.

*internal table declarations
data:
  t_ymetadata type table of ymetadata.

data:
  t_rsdvcha type table of t_rsdvcha.
  
*populating records into internal tables

 select * from ymetadata into table t_ymetadata.
 
 
 select * from rsdvcha into table t_rsdvcha.
 
*checking if records are present or not. 
 loop at t_ymetadata into ymetadata.

*here fieldname is which you want to compare with the field of rsdvcha.
   read table t_rsdvcha into rsdvcha with key fieldname = ymetadata-fieldname.
   if sy-subrc eq 0.
     write:/ ymetadata-fieldname, ' is present in rsdvcha'.
   else.
     write:/ ymetadata-fieldname, 'record does not exist in rsdvcha'.
   endif.
   
 endloop.

Regards

Anup.