Skip to Content
author's profile photo Former Member
Former Member

how to join two tables?

can anyone tell me the code "how to create a report to display material number and sales order using two tables MARA and VBAP?"

points will be rewarded for correct answer.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 25, 2007 at 05:03 AM

    To display material number and sales order using two tables MARA and VBAP

    u can get like this.

    DATA:matnr like mara-matnr.

    select aMATNR INTO matnr from mara AS a INNER JOIN vbap as b on amatnr = b~matnr

    endselect.

    Reward Points if useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 25, 2007 at 05:27 AM

    Hi Ashwini,

    Just a suggestion, since you are new to ABAP, i feel you can obtain the results using SQVI. Here you can insert the tables you want, join the fields & in the layout mode, select the fields you want to be displayed & also select the respective input fields.

    For your report, i feel a Join between MARC-VBAP would be better, as you will be able to get the report for a specific plant. The reason for suggestion is, MARA table contains all materials & not specific to a plant & if you run the report, it will take a very long time.

    Hope i was able to provide you with some inputs.

    Regards,

    Vivek

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 25, 2007 at 07:17 AM

    Hi,

    Assume that you have 2 tables Mara and Makt

    First fire select query on Mara Table.

    i.e select matnr from mara into table it_mara

    Now fire query on Makt table

    Select matnr maktx from Makt into table it_makt

    for all entries in it_mara

    where matnr = it_mara-matnr.

    here we have joined tables using the For All Entries....

    Regards,

    DS

    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.