2007 Jul 31 7:56 AM
Hello Experts please solve this
select mblnr into table itab1
from mkpf
where budat in s_budat
and vgart = 'WE'.
select mblnr into table itab2
from mkpf
where budat in s_budat
and vgart = 'WO'.
I modified the above query as
select mblnr into table itab1
from mkpf
where budat in s_budat
and ( vgart = 'WE'or vgart = 'WO').
Now please tell me how to modify the below query because we have to select data only from itab1 entrieswhere vgart= we only.But in above we selected vgart = 'wo' into itab1.
select mblnr matnr bwart menge into table lt_menge
from mseg
for all entries in itab1.
where mblnr = lt_we-mblnr
and matnr = it_temp-matnr
and werks = p_werks
and bwart in ('501', '502').
Hi,
best way use only one query as :
select a~mblnr a~mjahr b~matnr b~bwart b~menge
from mkpf as a inner join mseg as b
into table itab_mseg
on a~mblnr = b~mblnr and a~mjahr = b~mjahr
where a~budat in s_budat and
(a~vgart = 'WE' or a~vgart = 'WO') and
and b~werks = p_werks
and b~bwart in ('501', '502').
this is most optimised format i think ...
in for all entries u can not give criteria on internal table.
Jogdand M B
*Reward pts if helpful
Message was edited by:
Jogdand M B
2007 Jul 31 8:03 AM
Hi Shiva,
You need to create another internal table with the same type of itab1 and move the data corresponding to WE and use that for querying MSEG.
Regards,
Atish
2007 Jul 31 8:08 AM
loop at itab1 where vgart = 'WE'.
move itab1 to itab2.
append itab2.
endloop.
now use itab2 in the for all entries.
Regards
Gopi
2007 Jul 31 8:14 AM
select mblnr into table itab1 from mkpf where budat in s_budat
and vgart = 'WE'.
select mblnr into table itab2 from mkpf where budat in s_budat
and vgart = 'WO'.
I modified the above query as
select mblnr into table itab1 from mkpf
where budat in s_budat
and vgart in ('WE' , 'WO').
Now please tell me how to modify the below query because we have to select data only from itab1 entrieswhere vgart= we only.But in above we selected vgart = 'wo' into itab1.
decleare another internal table move it.
itab3
itab3 = itab2.
select mblnr matnr bwart menge into table lt_menge
from mseg for all entries in itab1.
where mblnr = lt_we-mblnr
and matnr = it_temp-matnr
and werks = p_werks
and bwart in ('501', '502').
2007 Jul 31 8:22 AM
Hi,
best way use only one query as :
select a~mblnr a~mjahr b~matnr b~bwart b~menge
from mkpf as a inner join mseg as b
into table itab_mseg
on a~mblnr = b~mblnr and a~mjahr = b~mjahr
where a~budat in s_budat and
(a~vgart = 'WE' or a~vgart = 'WO') and
and b~werks = p_werks
and b~bwart in ('501', '502').
this is most optimised format i think ...
in for all entries u can not give criteria on internal table.
Jogdand M B
*Reward pts if helpful
Message was edited by:
Jogdand M B
2007 Jul 31 8:43 AM
Hi Shiva,
This is very simple
> Hello Experts please solve this
>
<b>Don't use this. Select both of them in the same table as you did but with some correction.</b>
> select mblnr into table itab1
> from mkpf
> where budat in s_budat
> and vgart = 'WE'.
> select mblnr into table itab2
> from mkpf
> where budat in s_budat
> and vgart = 'WO'.
>
> I modified the above query as
select mblnr VGART into table itab1
from mkpf
where budat in s_budat
and VGART in ( 'WE' , 'WO' )<b> modified the line</b>
> and ( vgart = 'WE'or vgart = 'WO').
> Now please tell me how to modify the below query
> because we have to select data only from itab1
> entrieswhere vgart= we only.But in above we selected
> vgart = 'wo' into itab1.
For this what you can do is simpler now.
Create another table itab2 with field MBLNR and VGART.
Write
Loop at itab1 where VGART = 'WE'.
MOVE itab2 = itab1.
APPEND itab2.
Endloop.
> select mblnr matnr bwart menge into table lt_menge
> from mseg
> for all entries in itab1.
> where mblnr = lt_we-mblnr
> and matnr = it_temp-matnr
> and werks = p_werks
> and bwart in ('501', '502').
Now you can re-write this as :
select mblnr matnr bwart menge into table lt_menge
from mseg
for all entries in ITAB2
where mblnr = ITAB2-mblnr
and matnr = it_temp-matnr
and werks = p_werks
and bwart in ('501', '502').
<b>hope the above solves your issue</b>
Regards
Nishant
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |