Skip to main content
Question

Understanding On Time Delivery Logic

  • March 24, 2023
  • 2 replies
  • 11 views

Hi, The logic for OTD is given as below in Process cockpit

 

WHEN PU_COUNT ( "EKPO" , "_CEL_P2P_ACTIVITIES"."ACTIVITY_EN" , "_CEL_P2P_ACTIVITIES"."ACTIVITY_EN" = 'Record Goods Receipt' ) > 0

AND DAYS_BETWEEN ( PU_MAX ( "EKPO" , "EKET"."EINDT" ) ,

PU_MAX ( "EKPO" , "EKBE"."CPUDT" , "EKBE"."VGABE" = '1' AND "EKBE"."SHKZG" = 'S' ) ) <= 10

AND DAYS_BETWEEN ( PU_MAX ( "EKPO" , "EKET"."EINDT" ) ,

PU_MAX ( "EKPO" , "EKBE"."CPUDT" , "EKBE"."VGABE" = '1' AND "EKBE"."SHKZG" = 'S' ) ) >= ( -1.0 * 10 )

 

two questions I have

1. why do we need days_between and PU_MAX when we can use DATEDIFF(DD, <DATE>, <DATE> ) field? -- Is it because only then it will calculate for all the cases?

  1. I don't understand the last part of > = ( -1.0 * 10 ) - what does this mean?

2 replies

andré.tafur
Level 8
Forum|alt.badge.img+15

Hi Sachin,

 

I agree with you on question 1, you can use both DAYS_BETWEEN and DATEDIFF function. Maybe they used DAYS_BETWEEN to make the code easier to understand. 

 

On the other hand, in question 1.1. the last part: "> = ( -1.0 * 10 )" I understand that it refers as a business rule to define that an delivery is "on time" if it arrives up to 10 days later as up to 10 days earlier, i.e. either not too late or not too early.

 

I hope this is helpful.

 


  • Author
  • Level 3
  • March 24, 2023

Hi Sachin,

 

I agree with you on question 1, you can use both DAYS_BETWEEN and DATEDIFF function. Maybe they used DAYS_BETWEEN to make the code easier to understand. 

 

On the other hand, in question 1.1. the last part: "> = ( -1.0 * 10 )" I understand that it refers as a business rule to define that an delivery is "on time" if it arrives up to 10 days later as up to 10 days earlier, i.e. either not too late or not too early.

 

I hope this is helpful.

 

Thanks much Andre!!