Application Development and Automation 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: 
Read only

match data between two table

Former Member
0 Likes
647

Hi,

i develop report for annexure base on customer, material and posting date.

i have used mseg, mkpf, afpo, makt , kna1,resb, lips tables.

my customer and material fields in mseg table and posting date fields in mkpf then how i match data between two tables.

my Code.

select * from mseg into corresponding fields of table it_mseg where kunnr = cust

and matnr = mat and bwart = '501'.

loop at it_mseg.

endloop.

SELECT * FROM MKPF as a JOIN mseg as b ON amblnr = bmblnr and amjahr = bmjahr

into corresponding fields of table it_mseg

WHERE Budat = DATE .

loop at it_mkpf.

endloop.

Thanks in Advance.

Sam.

3 REPLIES 3
Read only

Former Member
0 Likes
549

Hi,

You can directly put the MBLNR into both MSEG and MKPF.

Regards,

Vivek

Read only

Former Member
0 Likes
549

Hi

Try this


SELECT * FROM MKPF as a INNER JOIN mseg as b ON a~mblnr = b~mblnr and a~mjahr = b~mjahr
into corresponding fields of table it_mseg_mkpf
WHERE a~budat = date 
AND    b~matnr = mat
AND   b~bwart  = '501'.

loop at it_mkpf.
endloop.

Pushpraj

Read only

Former Member
0 Likes
549

Hi sam,

U can use two types of select statements..

Try this...

Select mblnr matnr kunnr from mseg into table itab where

If itab is not initial.

Select budat from mkpf into jtab for all entries in itab where mblnr = itab-mblnr and budat = date..

endif.

or

Select amatnr akunnr bbudat from mseg as a innerjoin mkpf as b on amblnr = b~mblnr into table itab where budat = date.