Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate lead time between EKET-EINDT and EKBE-BUDAT

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

6 REPLIES 6

former_member181962
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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.

0 Kudos

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

0 Kudos

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