‎2008 Jun 04 10:39 AM
Hi i need to select matnr from mara passing werks,mmsta and from mvke passing vkorg,vtweg and from marc passing mstae.
werks,mmsta,vkorg,vtweg,mstae are in selection screen.
Kindly help me. results will be rewarded.
‎2008 Jun 04 10:46 AM
use parameters or select options for all the fields depending on ur requirement and then use select statement
‎2008 Jun 04 11:51 AM
Hi,
One way is to put a select query with join on these tables passing the respective fields in where clause of these tables.
But I feel that better idea would be to write select query, then filtering the data and then getting data from other table using for All Entries Clause.
One more option is that you look for some SAP Standard joins. May be there is a join for these tables given by SAP. That would fetch the data faster.
Try these options. You should get the results.
regards,
Lalit Kabra
‎2008 Jun 05 4:44 AM
Another way of doing this is to form a database view and write a select query if the data record you are pulling comes under the inner join of these tables.
‎2008 Jun 05 5:30 AM
Hi vincent,
Check this
Select fi
f2
f3
inti itab_marc
from table marc
where werks eq pa_werks
mmsta eq pa_mmsta
vkorg
vtveg
likewise.
if itab_mac[] not initial.
select werks
mmsta
into itab2
from marc
for all entries in itab1
where clause
endif.
then iif itab2[] not initial.
select matnr
into itab3
from mara
for all enrties in itab2
where
clause
endif,
u try this way also, check the syntax and use accordingly
cheers
Mohinder
endif
‎2008 Jun 05 5:47 AM
Hi.. Need clear info to answer compeltely..
You have mention Fields in Selection-Screen. & which Selection Screen Parameters to retrieve from the Database..
But what are the output fields from the Respective tables, Was not Clear.. or you want the Corresponding MATNR alone.. to be check against these tables mentioned by you..
Here is a Sample Code with the given information....
Selection Screen :
werks,mmsta,vkorg,vtweg,mstae are in selection screen.
Consider all the Selection Screen Field are SELECT-OPTIONS
First Select Query :
1) select matnr from mara passing s_werks, s_mmsta
SELECT matnr FROM MARA INTO TABLE it_mara
WHERE matnr IN s_werks
AND mmsta IN s_mmsta.
Assu: it_mara contains only matnr field.
2) and from mvke passing svkorg, svtweg
3) and from marc passing s_mstae.
Reward Maximum Points for Useful Answers