SAP Community Log-in Update

In a few months, SAP Community will switch to SAP Universal ID as the only option to login. Donât wait, create your SAP Universal ID now! If you have multiple accounts, use the Consolidation Tool to merge your content.

Dec 29, 2014 at 11:37 PM
# Time not calculating when more than one employee per order

I am calculating the time taken to complete a production order. I use this formula to get the time. The CR is grouped by Order#, Dept, Empid, and work code. Work codes are calculated according to a set (begin and end) and we have a list of all endings so we know which are a set.

This formula is working for a total of time per order but only where there is one employee on an order, but there can be more than 1. It does the last employee on the order.

shared numbervar OrderTime:=OrderTime;

if OrderTime>0 then

cstr(int(OrderTime/60)) & ":" & right( "00" & cstr(OrderTime mod 60),2);

---

order time is done in this formula which is done for each set of work codes.

shared numbervar OrderTime:=OrderTime;

shared numbervar StTime:= StTime;

shared numbervar EdTime:= EdTime;

shared numbervar finalTime:= 0;

shared numbervar empTime:=empTime;

shared numbervar TotalWTime:=TotalWTime;

shared numbervar DeptTime:=DeptTime;

if StTime>0 and EdTime>0 and len(cstr(StTime))=6 and len(cstr(EdTime))=6 then

finalTime:= (tonumber( mid(totext(EdTime,0,""),1,1)) * 60 + tonumber( mid(totext(EdTime,0,""),2,2)) ) - (tonumber( mid(totext(StTime,0,""),1,1)) * 60 +

tonumber( mid(totext(StTime,0,""),2,2)) );

if StTime>0 and EdTime>0 and len(cstr(StTime))=7 and len(cstr(EdTime))=7 then

finalTime:= (tonumber( mid(totext(EdTime,0,""),1,2)) * 60 + tonumber( mid(totext(EdTime,0,""),3,2)) ) - (tonumber( mid(totext(StTime,0,""),1,2)) * 60 +

tonumber( mid(totext(StTime,0,""),3,2)) );

if StTime>0 and EdTime>0 and len(cstr(StTime))=6 and len(cstr(EdTime))=7 then

finalTime:= (tonumber( mid(totext(EdTime,0,""),1,2)) * 60 + tonumber( mid(totext(EdTime,0,""),3,2)) ) - (tonumber( mid(totext(StTime,0,""),1,1)) * 60 +

tonumber( mid(totext(StTime,0,""),2,2)) );

if StTime>0 and EdTime>0 and len(cstr(StTime))=7 and len(cstr(EdTime))=6 then

finalTime:= (tonumber( mid(totext(EdTime,0,""),1,1)) * 60 + tonumber( mid(totext(EdTime,0,""),2,2)) ) - (tonumber( mid(totext(StTime,0,""),1,2)) * 60 +

tonumber( mid(totext(StTime,0,""),3,2)) );

if StTime>0 and EdTime>0 then

OrderTime:= OrderTime + finalTime;

if finalTime>0 then

empTime:=empTime+finalTime;

if finalTime>0 then

TotalWTime:=TotalWTime+finalTime;

if finalTime>0 then

StTime:=0;

if finalTime>0 then

EdTime:=0;

if finalTime>0 then

DeptTime:=DeptTime+finalTime;

if finalTime>0 then

cstr(int(finalTime/60)) & ":" & right( "00" & cstr(finalTime mod 60),2);