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: 

Reports - Inner Joins

Former Member
0 Kudos

Dear Friends,

I need to prepare a classic report based on the following parameters :

I would like to know, how to join these three tables using Inner Joins - MARA, MARC, MSTA.

I should be able to view the fields from these tables.

I tried out with the common fields from these tables, viz. MARA - MATNR - MARC, MARC - WERKS - MSTA.

I would appreciate, if anyone replies me with the select statement using the above mentioned tables using Inner Joins statement with any common fields .

Thanking you in anticipation.

4 REPLIES 4

Former Member
0 Kudos

Demo program is available.

demo_select_inner_join

I suggest you also consider using the dictionary.

I found database view MA06V as an example.

You can use these examples and add a join to MSTA from MARA.

Let us know how it goes.

0 Kudos

hi,

Let me check and I'll get back.

Former Member
0 Kudos

Dear dinesh kumar

1. We can join the three tables with matnr field.

2. WERKS has to be provided from the program - (plant).

ie. For which plant, data is required.

3. Due to MSTA table, you may get multiple records

for same MATNR. bcos of maintenance records

by different departments in MSTA Table.

If it helps, pls give points.

*----


REPORT abc.

data : begin of itab occurs 0,

matnr like mara-matnr,

"---- Other Fields

end of itab.

data : matnr like mara-matnr.

data : werks like marc-werks.

*----


Query

select a~matnr

into table itab

from mara as a

inner join marc as b

on amatnr = bmatnr

inner join msta as c

on amatnr = cmatnr

*----


Required Conditions From Program

where a~matnr = matnr

and b~werks = werks.

Thanks & Regards,

Amit Mittal.

Former Member
0 Kudos

Hi friends,

I really donot feel this is something that was needed to be posted on the forum, was it?

The query could be formed using the ABAP f1 help too. Also the requirements were best known by dinesh.

All he had to do was try out a few options which best suited his requirements.

Same about reply like 'Let me check and Ill get back'.

Regards,

Amit Trivedi.