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: 

data from two tables with no key fields

Former Member
0 Kudos

Hi Friends,

I want to retrieve data from mara and mseg tables,matnr from mara and menge from mseg but problem is there is no key fields

from these two tables how can i retrieve the data from these two tables?

regards,

bikash

3 REPLIES 3

former_member761936
Active Participant
0 Kudos

Hi,

To retrieve data from two table there is no need to have common key fields. In MSEG you have MATNR field which is key of MARA, so if you have MATNR in your selection you first get all material numbers of your selection and for those material numbers you get material document umbers , using for all entries of MATNR. If you material document number in your selection then get all material document number and get material details for that document number.

Hope this information will help you.

Regards,

Narendra.Soma

Former Member
0 Kudos

Hi,

You need to have a common field between 2 tables if you want to put a join between them.

Or otherwise,

Find the check table of the primary keys of the tables.

Try to find the common fields from one of the check tables of the primary keys.

Example,

If you want to join tables A and B.

Both tables don't contain common fields.

A has primary key fields X and Y.

go to check table of X or Y.

Let check table of X is C.

check any field in C which are exist in table B.

Join tables A and C.

Based on this pick the data from B.

Regards,

Prashant

Former Member
0 Kudos

Hi Bikash,

Both the tables have MATNR, yes it is not necessary that is should be a primary key. Yes in your case since the table MSEG will have number of entries, Primary key would ease the job but you can do it with out it too.

Selet the data from MARA first and then based on that selection you can retieve data from MSEG. As Narendra suggested 'For all entries' is good option to do so.

Regards.

Amuktha