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: 

Comparing fields of a table in two systems

Former Member
0 Kudos

Hi All,

I have a requirement where in I need to get the contents of a table from a different SAP environment dynamically and then compare the field values of that table with the fields of the table in my current system. I was able to get the data using READ_RFC_TABLE function module. The output of this Function module is of type char512.  But, I need to compare the data field by field. How do I compare this? How do I split the data obtained?

For example, I have two systems A and B. I need to compare the fields F1,F2,F3  in both systems A and B and display the data. If there is any mismatch in the data in any of the fields, I should display a message saying "Conflict".

Appreciate your help to understand how this can be implemented.

Thanks,

Pavan

7 REPLIES 7

0 Kudos

Hi,

write your own rfc function module and design the export or table parameter exactly the way you need.

Once you get the data the comparision is not a big problem.

BG

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

You can get the table contents from table dynamically and then compare the table data in the current system.

Incase if the client is only different(for comparison), you can simply use  CLIENT SPECIFIED to get the data from other client.

0 Kudos

Hi Jayanthi,

Here it is a different SAP system. SO Client Specified cannot be used. I was able to get the table contents from the remote system but I need to split the data into different fields for comparison. I tried splitting the contents based on Space and it did not split appropriately. So, any idea as to how the data can be compared?

Thanks,

Pavan

VijayaKrishnaG
Active Contributor
0 Kudos

Hi Pavan,

If you want all the three fields be matched, Instead of splitting the line item in RFC table, better concatenate the three fields of table in your system.

Loop your Internal table in your system and concatenate the three field that you wish to compare (as you mentioned f1 f2 and f3) into a string. Now compare this string with the line items of the table you got from the function module, using of-set as per the field lengths of three fields in both the tables.

Thanks & Regards,

Vijay

0 Kudos

Hi Vijay,

For a single table, we can do it the way as suggested by you as we will be aware of the fields, . But in this case,  I will be reading the table dynamically. So, I will not be aware of the number of fields.  Can you please suggest?

Thanks,

Pavan

ThomasZloch
Active Contributor
0 Kudos

Standard report RSCMPADJ does just that, it uses function modules in group SCT1. It looks all pretty complex, but maybe you can analyse it and "borrow" some ideas for your own logic.

Alternatively, maybe it is sufficient to SUBMIT this standard report and retrieve the list output from memory for further processing.

Thomas

Former Member
0 Kudos

Like Thomas said,

I'm trying the same thing as you get two tables from different systems and compare them i even have to make them equal, but studying RSCMPADJ it's a good way to start or using the transaction that this program uses that is SCMP on of it. Also the FM of SCT1 are very helpful to compare and retrieve the data, but the code and the way it does all of this it's very complex though.