10-14-2005 5:49 AM
Dear All,
Please can anyone tell me how to catch Kbetr field from konp based on mwskz in EKPO.
Regards
Mave
10-14-2005 5:58 AM
hi,
try with this
ekpo-ebeln = ekko-ebeln
konp-KNUMH = ekko-knumv
ekpo-mwskz = konp-MWSK1
cheers,
sasi
10-14-2005 6:27 AM
10-14-2005 6:28 AM
HI Mave,
Actualy you can join like this
from ekpo and A016 get knumh
on ekpo-ebeln = A016-ebeln where mwskz = '<your value>'.
now using this value of knumh get kbetr from Konp.
The Ideal join condition (but it will not work since A016 is pooled table, you can't join)
select single Kbetr into lv_kbetr from
EKPO as a inner join A016 as b on aEBELN = bEVRTN
inner join KONP as c on bKNUMH = cKNUMH
where a~mwskz = 'aa'.
So you do like this-->
data: begin of lt_ebeln occurs 0,
lv_ebeln like ekpo-ebeln,
end of lt_ebeln.
data: begin of lt_knumh occurs 0,
lv_knumh like A016-knumh,
end of lt_knumh.
data: begin of lt_kbetr occurs 0,
lv_kbetr like konp-kbetr,
end of lt_kbetr.
select ebeln into table lt_ebeln from ekpo
where mwskz = '<your value>'.
loop at lt_ebeln.
select single knumh from A016 into lt_knumh
where EVRTN eq lt_ebeln.
append lt_knumh.
endloop.
loop at lt_knumh.
select single Kbetr from konp into lt_kbetr
where knumh = lt_knumh.
append lt_kbetr .
endloop.
Reward point if it helps you.
10-14-2005 6:37 AM
10-14-2005 6:39 AM
Here is a more compact and effecient one.
data: begin of lt_ebeln occurs 0,
lv_ebeln like ekpo-ebeln,
end of lt_ebeln.
data: begin of lt_knumh occurs 0,
lv_knumh like A016-knumh,
end of lt_knumh.
data: begin of lt_kbetr occurs 0,
lv_kbetr like konp-kbetr,
end of lt_kbetr.
select ebeln into table lt_ebeln from ekpo
where mwskz = 'ur value'.
select knumh from A016 into table lt_knumh
for all entries in lt_ebeln
where EVRTN eq lt_ebeln-lv_ebeln.
select Kbetr from konp into table lt_kbetr
for all entries in lt_knumh
where knumh = lt_knumh-lv_knumh.
loop at lt_kbetr.
write:/ lt_kbetr-lv_kbetr.
endloop.