08-16-2006 1:19 PM
Hi all,
has anyone already implemented a logic for calculating
the lead time between delivery date (EKET-EINDT) and the
goods receipt date (EKBE-BUDAT).
The problem is that you cant link the good receipts to
the relevant schedule line.
Thank you very much for any help or abap codings...
Best regards
Frank
08-16-2006 1:34 PM
hi,
by using Goods Receipt no go to table EKBE
fetch PO and Item no and vgabe = 1.
<b>select ebeln
ebelp
from ekbe
into table it_ekbe
where belnr = GRnumber
and vgabe = '1'.</b>
then by using PO and its item you can fetch data from EKET.
Regards
Ashok P
08-16-2006 1:22 PM
YOu can link the Goods recept with the schedule line as follows.
Go to EKBE table and pass Goods receipt number to get the PO number and Item number.(EKBE-EBELN and EKBE-EBELP).
Pass these values to EKET table to get the schedule lines for that PO Line item.
1) select *
from ekbe
into it_ekbe
where belnr = <GR number>.
2) select *
from eket
into it_eket
for all entries in it_ekbe
where ebeln = it_ekbe-ebeln
and ebelp = it_ekbe-ebelp.
Regards,
Ravi
08-16-2006 1:34 PM
hi,
by using Goods Receipt no go to table EKBE
fetch PO and Item no and vgabe = 1.
<b>select ebeln
ebelp
from ekbe
into table it_ekbe
where belnr = GRnumber
and vgabe = '1'.</b>
then by using PO and its item you can fetch data from EKET.
Regards
Ashok P
08-17-2006 7:26 AM
Thank you all for your help,
but i still have the problem, that i have more than one schedule line. There you cant link the GR (EKBE) to the relevant schedule line (EKET). How can i implement the FIFO solution (FirstinFirstout)?
<b>Example:</b>
<u>EKET</u>
DocNr_Pos__ETENR__Quantity____EINDT
6700___10__1_______100________20060601
6700___10__2_______300________20060701
<u>EKBE</u>
DocNr_Pos__Nr__Quantity__Budat
6700___10__1_____200_____20060603
6700___10__2_____200_____20060702
<b>Result</b> should be:
DocNr_Pos_ETENR__Quantity__Deliverydate__ZBUDAT(from ekbe)
6700___10__1_______100________20060601___20060603
6700___10__2_______300________20060701___20060702
20060702 therefor because the the full quantity arrived at
this date.
Thank you again for any help, best regards
Frank
08-17-2006 9:08 AM
Hello Frank,
Basically you would need to use the FIFO logic to link it ...I have highlighted the logic for the same hopefully it would suffice your requirement.
1. Collect EKET information in an internal table
2. Collect EKBE information in another internal table.
3. FIFO logic.
sort ieket docnr posnr eindt.
Loop at IEKET.
move-corresponding ieket to ioutput.
lqty = IEKET-quantity
sort by docnr posnr budat.
loop at iekbe where docnr = ieket=docnr.
check iekbe-adjqty > 0.
if iekbe-quantity >= lqty.
move lqty to ioutput-qty.
move iekbe-budat to ioutput-zbudat.
iekbe-adjqty = iekbe-qty - lqty.
lqty = 0.
else.
move lqty to ioutput-qty.
move iekbe-budat to ioutput-zbudat.
iekbe-adjqty = 0.
lqty = lqty - iekbe-quantity.
endif.
modify iekbe.
append ioutput.
check lqty = 0.
exit.
endloop.
endloop.
08-18-2006 11:16 AM
Hi Anurag,
thanks a lot for your answer! i have now following coding:
-
LOOP AT l_t_eket.
MOVE-CORRESPONDING l_t_eket TO l_t_output.
l_v_menge = l_t_eket-menge.
LOOP AT l_t_ekbe WHERE ebeln = l_t_eket-ebeln AND
ebelp = l_t_eket-ebelp AND
zstatus is initial.
CHECK l_t_ekbe-menge > 0.
IF l_t_ekbe-menge >= l_v_menge.
MOVE l_v_menge TO l_t_output-menge.
MOVE l_t_ekbe-budat TO l_t_output-zbudat.
l_t_ekbe-menge = l_t_ekbe-menge - l_v_menge.
l_v_menge = 0.
if l_t_ekbe-menge = 0.
Move 'X' to l_t_ekbe-zstatus.
endif.
ELSE.
MOVE l_v_menge TO l_t_output-menge.
MOVE l_t_ekbe-budat TO l_t_output-zbudat.
l_v_menge = l_v_menge - l_t_ekbe-menge.
Move 'X' to l_t_ekbe-zstatus.
ENDIF.
MODIFY l_t_ekbe.
APPEND l_t_output.
CHECK l_v_menge = 0.
EXIT.
ENDLOOP.
ENDLOOP.
-
Is there also a possibility to recognize reversals/cancellations of CR.
Thank you very much for help, best regards
Frank
08-18-2006 11:27 AM
Do you mean to identify GR cancellation ?
I think you can check on the movement type to identify the same.
Regards
Anurag
Note : Please mark help answers !!
Message was edited by: Anurag Bankley