‎2006 Aug 04 12:33 PM
hi friends,
Could u please send me details how can we write this Query
Once the Batch is selected. Select the process order(AFPO-AUFNR) from the table AFPO where the batch number(CHARG) selected from MSEG equals the batch number(CHARG) from AFPO. Select the total amount(AFKO-GAMNG) where the procress order(AFKO-AUFNR) equals the procress order selected from AFPO.
Regards
srinu
‎2006 Aug 04 1:48 PM
Hi srinu,
try this code.
data:begin of itab1 occurs 0,
CHARG like MSEG-CHARG,
end of itab1.
data:begin of itab2 occurs 0,
aufnr like afpo-aufnr,
charg like afpo-charg,
end of itab2.
data:begin of itab3 occurs 0,
GAMNG like afko-gamng,
aufnr like afko-aufnr,
end of itab3.
select charg from mseg into table itab1.
select aufnr charg from afpo into table itab2
for all entries in itab1
where charg = itab1-charg.
select GAMNG aufnr from afko into table itab3
for all entries in itab2
where aufnr = itab2-aufnr.
Please reward me if it helps you.
Thanks,
Sowjanya
‎2006 Aug 04 1:07 PM
SELECT AAUFNR, BCHARG, BMATNR, AGMANG
INTO ITAB
FROM AFKO AS A INNER JOIN AFPO AS B
ON AAUFNR = BAUFNR
WHERE B~CHARG = P_CHARG.
Regards
Anurag
‎2006 Aug 04 1:14 PM
select *
from mseg
into table it_mseg
where
<your where condition>.
if not_it_mseg[] is initial.
select aufnr
charg
from afpo
into it_afpo
for all entries in it_mseg
where charg = it_mseg-charg.
if not it_afpo[] is initial.
select aufnr
gamng
from afko
into table it_afko
for all entries in it_afpo
where aufnr = it_afpo-aufnr.
endif.
endif.
Regards,
ravi
‎2006 Aug 04 1:36 PM
Hello Srinu,
Firstly u have to select unique batch number from MSEG as same batch may be split. Once u have found the batch connect it to the table AFPO. For each unique record found in AFPO select header table AFKO and get collect the qty in field GAMNG.
‎2006 Aug 04 1:48 PM
Hi srinu,
try this code.
data:begin of itab1 occurs 0,
CHARG like MSEG-CHARG,
end of itab1.
data:begin of itab2 occurs 0,
aufnr like afpo-aufnr,
charg like afpo-charg,
end of itab2.
data:begin of itab3 occurs 0,
GAMNG like afko-gamng,
aufnr like afko-aufnr,
end of itab3.
select charg from mseg into table itab1.
select aufnr charg from afpo into table itab2
for all entries in itab1
where charg = itab1-charg.
select GAMNG aufnr from afko into table itab3
for all entries in itab2
where aufnr = itab2-aufnr.
Please reward me if it helps you.
Thanks,
Sowjanya