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: 

Comparing the values of fields in 2 tables

Former Member
0 Kudos

Hi,

This is my requirement:

SELECT ALL FROM MARC INTO I_MARC BASED ON THE VENDOR THAT THE PERSON ENTERED on the selection screen.

BASED ON THE VENDORS MATERIAL, LOOK IN MARA AND SEE WHICH HAVE ZZtype1 = ‘m’

Thanks,

John

3 REPLIES 3

Former Member
0 Kudos

hi,

SELECT ALL FROM MARC INTO I_MARC where ernam in vendor.

here vendor is on selection screen.

2) BASED ON THE VENDORS MATERIAL, LOOK IN MARA AND SEE WHICH HAVE ZZtype1 = ‘m’

select * into iitab wher matnr in vmaterial and zztype1 = 'm'.

here vmaterial is an selcetion screen field

reward if useful

ravi

Former Member
0 Kudos

Hi

Vendor will not be there in MARC table or MARA table

So take the vendor and he supplied the materials from Purchase order item table and for them we fetch the data from MARC and MARA.

Data: itab like marc occurs 0 with header line,

itab2 like mara occurs 0 with header line,

begin of itab1 occurs 0,

lifnr like lfa1-lifnr,

matnr like mara-matnr,

werks like ekpo-werks,

end of itab1.

select-options s_lifnr for lfa1-lifnr.

select lifnr matnr werks from ekpo into table itab1 where lifnr in s_lifnr.

if not itab1[] is initial.

select * from marc into table itab for all entries in itab1

where matnr = itab1-matnr and werks = itab1-werks.

endif.

if not itab[] is intital.

select * from mara into table itab2 for all entries in itab

where matnr = itab-matnr and zztype1 = 'M'.

endif.

use the table Itab and Itab2 and display the data

Reward Points if useful

regards

Anji

former_member186741
Active Contributor
0 Kudos

try something like this:

*... get the material data via joins to the EINA vendor info records..

SELECT *

INTO CORRESPONDING FIELDS OF TABLE it_your_input

FROM eina

JOIN mara ON maramatnr = einamatnr

JOIN marc

ON marcmatnr = einamatnr

WHERE eina~lifnr IN s_lifnr

AND mara~lZZtype1 = ‘m’ "or is it 'M'?

.