‎2008 Apr 18 11:48 AM
In selection screen i have purchase organisation as select option..
Based on this purchase organisation i have to write a query with all the plants that is associated wid purchase organisation Can u pls tell me how 2 do??
Ekorg(PO)-T001w.
Select..........
from Marc where werks in........
how shud i get werks for the PO into select query.
Points will b rewarded....
‎2008 Apr 18 12:27 PM
Hi,
See below eg:
tables: t001w.
select-options: s_ekorg for t001w-ekorg.
data: begin of it_t001w occurs 0,
werks type t001w-werks,
ekorg type t001w-ekorg,
end of it_t001w.
select werks ekorg from t001w into table it_t001w
where ekorg in s_ekorg.
if not it_t001w[] is initial.
select * from marc into table <itab>
for all entries of it_t001w
where werks = it_t001w-werks.
endif.
Regards
Ganesh
‎2008 Apr 18 12:27 PM
Hi,
See below eg:
tables: t001w.
select-options: s_ekorg for t001w-ekorg.
data: begin of it_t001w occurs 0,
werks type t001w-werks,
ekorg type t001w-ekorg,
end of it_t001w.
select werks ekorg from t001w into table it_t001w
where ekorg in s_ekorg.
if not it_t001w[] is initial.
select * from marc into table <itab>
for all entries of it_t001w
where werks = it_t001w-werks.
endif.
Regards
Ganesh
‎2008 Apr 18 12:44 PM
Hi,
If you face in problem in 1st Eg.
You try this, it is working I teted.
EG:
tables: t001w.
select-options: s_ekorg for t001w-ekorg.
data: begin of it_t001w occurs 0,
werks type t001w-werks,
ekorg type t001w-ekorg,
end of it_t001w.
data: begin of itab occurs 0,
matnr type marc-matnr,
werks type t001w-werks,
end of itab.
select werks ekorg from t001w into table it_t001w
where ekorg in s_ekorg.
sort it_t001w by werks.
if not it_t001w[] is initial.
select matnr werks from marc into table itab
for all entries in it_t001w
where werks = it_t001w-werks.
endif.
Regards
Ganesh