Skip to Content
avatar image
Former Member

Query -> Get data from the same table and field two times on a single line

I have prepared a query showing the bill of material. At each line each component will be a new line and I want to have the description of the material at the top (the master material composed of the component ones) and also the description of the component materials on the same line. This means that I should be able to use MAKT table 2 times on a single line of the query. I have used the query tool with SQ01 and SQ02 tcodes. How can I get the the description of the material at the top and also the description of the component material on a single line?

Thanks in advance for the answers.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 22, 2012 at 03:00 PM

    Yasar,

    Any time you wish to use a table twice in an SQ01 query, you have to create an alias.

    SQ02 > select the infoset, 'change' > go to Join definitions.

    Select 'Alias' button. Create. Select your table name (such as MAKT) and define an alias, such as 'COMP_MAKT' for component descriptions.

    Now you can insert the Alias table into your infoset just like it was a regular table, and use standard join method to join COMP_MAKT to your component material number.

    Best regards,

    DB49

    Add comment
    10|10000 characters needed characters exceeded