Skip to Content

Use Inner Join for 7 tables.

Dear experts,

How to use INNER JOIN to get data from from 7 different tables. The conflict here is i want to select all fields from ONE table ONLY. The remaining tables I only want to select few fields.

Example:

MARA- all fields are required.

MAKT- only MAKTX is required

MARC- only EKGRP.

and etc.

all the tables has the same primary key.

this can be achieved using FOR ALL ENTRIES IN but is it possible to use INNER JOIN.

Examples with codes are much appreciated.

Thanks,

Alvin

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Apr 08, 2016 at 08:36 PM

    Why could you possibly need ALL the fields from MARA? I'm really having trouble imagining a business scenario where this could be required...

    (No to mention SELECT * is an even bigger no-no in HANA, from what I've heard.)

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 06, 2016 at 09:11 AM

    all the tables has the same primary key.

    No every table in your list doesn't share same primary keys, they all share primary keys of MARA but there are other key SPRAS for MAKT, So if you don't select some missing key or force thise as single value in WHERE critera, you will get some duplicate-looking" records.

    You could explicily write every field in the SELECT mara~matnr ... marc ekgrp statement (*) or keep with '*' and use a INTO CORRESPONDING option, but beware of fields with same name in multiple table.

    Regards,

    Raymond

    (*) You could consider build the field list programmaticaly in a standard internal table - SELECT (it_fields) FROM...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 06, 2016 at 09:22 AM

    Hello,

    Try using the view MLVS --> Mat. Master View on MARA,MARC,MLGN,MAKT,MARM,T141,T141T.


    Thanks,

    K Prabhu Kiran

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.