Automate

 View Only
  • 1.  Query to retrieve any non matching data from two tables

    Posted 04-28-2025 04:00

    Hi guys

    I'm looking to develop a query script which looks at both the Product Hierarchy fields in the Basic Data 1 (MARA-PRDHA) and Sales Org 2 (MVKE-PRODH)  material master views to ensure they match BUT, want the query to ONLY retrieve any potential mismatches. Does anyone know of a way to do this rather than download both fields for all materials then filter it manually in excel?



    ------------------------------
    Andrew Lewis
    Global Master Data Analyst
    QuidelOrtho
    Wales
    United Kingdom
    www.QuidelOrtho.com
    ------------------------------


  • 2.  RE: Query to retrieve any non matching data from two tables

    Employee
    Posted 04-29-2025 10:50

    hmm, its a nice use case but I don't see a way to create a join or a criteria to accomplish a comparison between 2 fields across tables. 

    It would be easier in straight SQL but not through the Query options in Studio. 



    ------------------------------
    Jayasri Varyani
    SE
    Precisely Software Inc.
    ------------------------------



  • 3.  RE: Query to retrieve any non matching data from two tables

    Employee
    Posted 05-01-2025 13:49
    Edited by Sigrid Kok 05-01-2025 14:08

    Hi Andrew

    As Jayasri mentions, we don't have the ability to compare fields in Studio Query. 

    Here are a few thoughts:

    (1) Create a query that matches those two tables on Material Number and Hierarchy, with a left outer join.

    Then use search criteria to say that Product Hierarchy in MARA is not blank (you may not need this but I do in my demo system) , and then say Sales org is null - which means there wasn't a match on Material and Product hierarchy, i.e. they don't match

    You'd get results something like this:

    You can always download the list of suspect materials and then use a 2nd query to pull in what is in Basic & Sales using an IN operator, pointing the the list of materials.

    (2) you can compare fields in SQL via SQVI or SQ01 or a tcode like that.  If you grant permissions to that SAP Query to the Studio users you create in SAP, you can find it and run it from Studio via the Infosets option.  

    Feel free to open a request in the Ideas portal for this feature - it would be great to have.

    Best Regards,

    Sigrid



    ------------------------------
    Sigrid Kok
    *Precisely Software Inc.
    ------------------------------



  • 4.  RE: Query to retrieve any non matching data from two tables

    Posted 06-19-2025 06:57

    Thanks Sigrid

    What I'm ideally looking to create is like what you have suggested by I need to see ALL of the Product Hierarchy's in both MARA and MVKE whether they're blank or populated and also if the Sales Views haven't been created then the value should be blank so that it leads to further investigations as to why. Could you suggest to me how I can do that? I'll keep playing around until I can find a solution that works.

    Thanks



    ------------------------------
    Andrew Lewis
    Global Master Data Analyst
    QuidelOrtho
    Wales
    United Kingdom
    www.QuidelOrtho.com
    ------------------------------



  • 5.  RE: Query to retrieve any non matching data from two tables

    Employee
    Posted 06-19-2025 14:31

    Hi Andrew

    The same query I suggested with a left outer join will work for your purposes.  Just remove the conditions on sales org is null and product hierarchy is not null.

    The key is the left outer join on MVKE - so it will include all materials, and if sales data exists, it will be pulled in.  If no sales data exists, it will still be included.

    Hope that helps,

    Sigrid



    ------------------------------
    Sigrid Kok
    *Precisely Software Inc.
    ------------------------------



  • 6.  RE: Query to retrieve any non matching data from two tables

    Posted 06-20-2025 04:06
    Edited by Andrew Lewis 06-20-2025 04:45

    Hi Sigrid

    Thanks very much for the quick response.

    I have added the left outer join as suggested and it's working perfectly. Tanks you so much for your support.

    Andy
    ------------------------------
    Andrew Lewis
    Global Master Data Analyst
    QuidelOrtho
    Wales
    United Kingdom
    www.QuidelOrtho.com
    ------------------------------



  • 7.  RE: Query to retrieve any non matching data from two tables

    This message was posted by a user wishing to remain anonymous
    Posted 06-23-2025 10:15
    This post was removed