Calculating Lead time.... Help......

We have two field in qals
QALS: Lot created     (ENSTEHDAT)
            Time                (ENTSTEZEIT)
Similarly we have two field in QAVE
QAVE: UD Code Date
            Time            (VEZEITERF)
I need to calculate the lead time
i.e.
Lead time = (Lot Created date & time - Date of UD & Time - Holidays as per factory calendar) / 24:00:00 hrs.
How to proceed????

hi Uttamagarwal,
Please check the below sample Code. You need to do declare the Appropriate Variable and ITAB.
"as NSTomar  said , First use the FM to get the Date and Time difference
call function 'SD_DATETIME_DIFFERENCE'
  exporting
    date1                  =  enstehdat  "Lots Created Date
    time1                  =  entstezeit " Lots Created Time
    date2                  =  vaedatum  " UD Change Date
    time2                  =  vezeitaen  " UD Change TIme
importing
   datediff               =  date_diff
   timediff               =  time_diff
*   EARLIEST               =
* EXCEPTIONS
*   INVALID_DATETIME       = 1
*   OTHERS                 = 2
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
* then Please use the below  FM To get the Number of Holidays
* between the Lots Created date and UD Changed date
call function 'HOLIDAY_GET'
EXPORTING
*   HOLIDAY_CALENDAR                 = ' '
   FACTORY_CALENDAR                 = fac_cal   " Pass the Factory calendar here 
   DATE_FROM                        =  enstehdat      " Lots Created Date
   DATE_TO                          =   vaedatum       " Ud Changed date
* IMPORTING
*   YEAR_OF_VALID_FROM               =
*   YEAR_OF_VALID_TO                 =
*   RETURNCODE                       =
  tables
    holidays                         = it_holidays
* EXCEPTIONS
*   FACTORY_CALENDAR_NOT_FOUND       = 1
*   HOLIDAY_CALENDAR_NOT_FOUND       = 2
*   DATE_HAS_INVALID_FORMAT          = 3
*   DATE_INCONSISTENCY               = 4
*   OTHERS                           = 5
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
"Check the Number of Entries in it_holidays which is equal to Number of Holidays
describe_table it_holidays lv_count.
if you want to find the date difference i.e., Lead Date
Lead date = date_diff + lv_count
if you want to find the time difference i.e., Lead Time
Lead Time = ( ( date_diff + lv_count ) * 24 ) +  time_diff
Edited by: Rob Burbank on Aug 5, 2010 9:26 AM

Similar Messages

  • Replenishment lead time & Scheduling Agreements - Please help

    Hi,
    I have a few questions & issues in regards to Replenishment lead time & Scheduling Agreements.
    1.     Where are stock requirements & Replenishment lead times configured?
    2.     What is a stock/requirements list?
    3.     What is Replenishment lead time in MD02/MD04?
    4.     Why do negative supply values appear under replenishment lead time in MD02/MD04?
    5.     What are the differences between MD02 & MD04?
    6.     How do you get to the following screen, since I canu2019t get here from MD02 or MD04 (missing buttons and Replenishment lead time information):
    http://i34.tinypic.com/9hl9hz.jpg
    Please help. This is very important.
    Thanks,
    Laura

    Hi Laura,
    The RLT can be set in the Masters Materials.MMR and Also in the Documnet Type Configuration.
    But as per SAP standard Procedure the Prority will be the document type.
    That means the RLT given in the Order document will overseed the RLT given in the MMR.
    Go to material master and select MRP3 view. There see what is maintained for "Strategy group". Now go to OVZG, select this Requirement Class and tick the field "Rq" against this.
    Now go to OVZH, select your Requirement Type and ensure that the above Requirement Class is assigned to your Requirement Type.
    Now create a sale order and check in MD04.
    Hope ethis helps u..
    Cheerzz..
    subbzz..

  • Different Lead times for supplier in MRP calculation

    Dear All,
    We have different suppliers for a material. Different suppliers have different lead times and Min.lot size. Our requirement is when we run MRP system should suggest Pld.Order quantity for the supplier and also take lead time accordingly. I have done splits for suppliers by using Quata arrangement but system is only taking planned delivery time from material master record.
    I also defined info records for the vendor and define lead time but still system is taking Pld delivery time from materials master.
    Please help
    Majid Ali khan.

    Hi,
    Go to OPPQ, enter your plant then click on External Procurement, there tick the check box Scheduling: Info Rec / Agreement.
    This will ensure that the PDT is read from info-record if it exists.
    Hope it clarifies.
    Regards,
    Vivek

  • Lead Time Calculation in SNP Heuristics

    Dear All,
          Please let me know how the lead times are determined in SNP heuristics?
    Ex: Distribution Center to Production Plant and
           Production Plant to Supplier.
    Thx,
    Ram.

    Hi,
    Please check the below link for help: [Scheduling|http://help.sap.com/saphelp_scm70/helpdata/EN/05/f8923945b12c4de10000000a114084/frameset.htm]
    Best Regards,
    Ada

  • How is lead time in working days calculated in 2LIS_05_QVUDN

    I was wondering if someone knows how lead time is being caclulated for 2LIS_05_QVUDN.  I've found the tables associated and the function module but I can't find the actual calculation
    Thanks

    Hello
    The lead time in working days works like this
    If you have 1 inspection lot for a material   -the time from  Lot creation to Usage decision given  is the lead time.
                                                              Lot created               Usage Decision made       Lead Time
    for eg Material X , inspection lot no   14/05/2008 10: 00          14/05/2008 14: 00            4 Hours
    it converts the hours in to days . =4/24= 0.16 days
    For total lead time individual lot's lead time sum is calculated
    Hope this clarifies your doubt
    Regards
    gajesh

  • Wrong lead times calculated between activities

    Hi expert,
    Client has following activity flow: 1 - 1A - 1B - 2. Relationship lead times: 1- 1a: 5day, 1a- 1b: 5day, 1b- 2a: 0day, 1- 2a: 1day.
    We have maintained relantionships as necessary. But lead times from activity 1 to activity 2 is still not calculated as 1 day. Lead time for actitivity 2 calculated after activity 1B.
    Please advise on solution.

    Hi expert,
    Client has following activity flow: 1 - 1A - 1B - 2. Relationship lead times: 1- 1a: 5day, 1a- 1b: 5day, 1b- 2a: 0day, 1- 2a: 1day.
    We have maintained relantionships as necessary. But lead times from activity 1 to activity 2 is still not calculated as 1 day. Lead time for actitivity 2 calculated after activity 1B.
    Please advise on solution.

  • Lead time calculation

    Dear Gurus,
                             I want to calculate lead time between purchase order and goods receipt.how to do that???
    Am having some doubts.
    Does the lead time links with
    Planned Delivery Time
    Goods Receipt Processing Time
    Purchasing Processing Time in material master. plz explain???

    Hi,
    If you create PR for a material, using MRP, then the planned delivery time would be picked up from the material master, please note that there is no source maintained yet in the PIR, so obviously that rules out planned delivery time of PIR and Vendor Master( even when u convert this P.R to P.O the planned delivery time will not change and will not be taken from the PIR)
    Now if you directly create a P.O then the planned delivery time of the PIR is picked up , please note this difference.
    I would recommend that you change the planned delivery time in the material, mnake it different from the planned delivery time of the PIR, and then run MRP, You will see that the planned delivery time in the PR would be based on the material planned delivery time.
    Even if you assign source and convert this P.O using ME59 the PDT will not change.
    Then you can try and create a P.O directly with the vendor, here you will notice that the PDT flows from the info record.
    Please let me know if this addresses your concern.
    Regarding your soure list issue, either you can remove the source list mandatory tick in MM or add the vendor whose PIR you are using into ME01, and it will definitely work.
    Regards
    Shailesh
    Edited by: Shailesh Rajan on Jun 30, 2011 7:51 PM

  • How is lead time calculated for QM notifications

    Can somebody please tell me what fields are used to calculate lead time?  It is field SUMDLZT in MCQMEL?  Is there documentation on how this is calcuated?

    MICK,
    Could you give more details on the same / explain a scenario for which you need this information.
    Since there has been no activity on this post for about a month , I will close this as answered , however if you still want this to be answered - mark it an unanswered and add more details to the same so that you can get more relevant answers.
    Arun

  • Lead time values are not appearing in the report for current year.

    Hi friends,
    Iam checking a report in production.  where lead time values are displayed as 0 for 1 key figure lead time3 (w/0 dim) . i found there is a formula for this it shows like NODIM ( 'Lead Time 3' ).and there is a value for cal.lead time
    how can i get values in the report.
    Thanks ,
    VRV.

    Hi,
    Although your question is not clear, I understood that the formula built on that KF is NODIM. Basically it means, units of measurement is not considered when calculating.
    Eg: 5 Minutes + 5 Kilograms = 10
    You please try to analyze your KF by the above logic. Then you would be able to figure out why the data is not appearing in the report..
    Assign if helps...
    Regards,
    Suman

  • Sales order is not taking shipping transit lead time into consideration

    Hi,
    We have following scenario -
    1. Sales order is created in AT organization.
    2. There is no onhand in any of the organizations including AT.
    3. The scheduled ship date for sales order comes as order creation date + item lead time = 15-Sep-2011.
    3. PO for sufficient quantity is available at UK org with need-by date as 01-Jun-2011.
    5. Post processing item lead time for this item is 1 day.
    4. intransit shipment is setup between UK and AT.
    5. Shipment Transit lead times are also set up at 3 days between locations of UK and AT.
    6. ASCP plan is run.
    7. Sales Order is unscheduled and rescheduled via API MSC_ATP_PUB, which takes the ATP details from UK (based on the sourcing rules). The sheduled ship date comes as 02-Jun-2011 (PO need-by date + 1 day of post processing).
    8. Expectation is that API should also take transit lead time into consideration while calculating the ATP dates and hence the Expectation is that scheduled ship date should come as 05-Jun-2011 (PO need-by date + Transit lead time + 1 day of post processing).
    Please let me know
    a. if this is standard functionality of oracle or not.
    b. if this is standard functionality then what setups are missing required for the same to be achieved.
    UAT is held up for this issue. Please help urgently.
    Regards.

    Oracle is supposed to take the in-transit time into consideration.
    Are you running a constrained plan or an unconstrained one?
    Make sure you defined the inter-org network as described in http://download.oracle.com/docs/cd/A60725_05/html/comnls/us/inv/shipne01.htm.
    or go to Inventory > Setup > Organization > Inter-Location Transit Times and enter it there.
    Sandeep Gandhi

  • Lead Time recalculation/update

    Hi,
    The requirement in my project is the following:
    I have a lead time for one material of 10 days. After two months I have recieved 2 PO's, one with 14 days and other with 12 days. The new lead time should be 13 days.
    There is any way to calculate this and update the material master?
    Thanks in advance,
    Guiza

    Guilherme,
    WPDTC is the TCode that you run to calculate the planned delivery time.  This transaction is available as of version 4.7.  Currently we are upgrading from 4.7 to ECC 6.0 and it still exists in 6.0.  There is a good description at this link in the SAP Help Library.
    [http://help.sap.com/saphelp_47x200/helpdata/EN/f3/41b53c4d36265ce10000000a114084/frameset.htm|http://help.sap.com/saphelp_47x200/helpdata/EN/f3/41b53c4d36265ce10000000a114084/frameset.htm]
    This program gives you a report of what the planned delivery times are in the info record, material master, vendor, and the calculated PDT based on documents and actual deliveries in the system.  You select the items you wish to change and click the Change Planned Delivery Time button.  You get a pop-up to verify you want to change the values.  Basically, this is a mass change tool for planned delivery time similar to physical inventory transaction MIBC - Set Cycle-Counting Indicator that calculates and changes the material master indicators.
    Hope this helps,
    Paul

  • Lead time reffering to open SO- - -***** URGENT ***

    Hello
    When we create a brand new PO, the materials due date should be automatically
    calculated using the  materials standard Lead Time.  For example, if we are to create a PO on 10/1/07 for a part that has standard Lead Time 65 days, the materials due date shouldbe automatically calculated as 10/1/07 + 65 days = 12/5/07 and the PO shouldshow that the part's statistical due date and delivery date is 12/5/07.However, recently SAP has been checking a pending sales order's furthest duedate and stretch the PO's due date to match the sales order's due date.  Forexample, in the previous example the PO's due date should be 12/5/07 but if there is a sales order that is not due till 3/7/08, SAP calculates that the part
    on this PO is not due till 3/6/08.  This new function is affecting our PO
    creation and its due date.  Could you advice so that POs automatically use a
    part's standard LT to calculate the part's due date instead of using SO's due
    date?
    I checked planned delivery time in MMR ,INFO RECS,VENDOR Checked the availability check and checking rules what could be the reason...?????
    Will AWARD FULL POINTS URGENT

    If you used a remove personal settings option from Windows or Firefox,you may well have permanently lost those bookmarks.
    * Undelete<br>If you did that then timely use of a file undelete utility and a good helping of luck are likely to be required to attempt recovery (probably best to stop using
    the computer entirely, until you have such utility).
    *Your Own Backups<br>You could have a backup system in place that backs up such files or the firefox profile, and you may be able to use that.
    * Synced to another machine<br> you may have the bookmarks synced on another machine, or even on an external server
    **see [[what is firefox sync?]]
    See also [[lost bookmarks]] but I am not sure any of that applies in this case, it is worth reading it though
    Normally

  • Lead Time in Item Master

    Hi
    Does Lead Time in Item Master respect weekends and only count working days?
    Meaning, for two weeks do I enter 10 or 14?
    Thanks
    Franz

    Hi Franz
    As far as I know, NO. You only have the option to include holidays in the MRP wizard itself which will then calculate against lead times. Best would be to test on a test database with both scenarios (with 10 or 14, and tick/untick holidays in MRP) and see what the results are.
    According to the Online Help the above is correct:
    Consider Holiday Table for Production Planning Factors in holidays and weekends in lead time calculation, as defined in the Holiday Details window. Holidays and weekends increase the lead time interval for MRP calculations.
    Consider Holiday Table for Purchase Planning Factors in holidays and weekends in lead time calculations, as defined in the Holiday Details window. Holidays and weekends increase the lead time interval for MRP calculations.
    Kind regards
    Peter Juby

  • Lead time for POs

    hello, I am new to this bog, but can anyone help me with a t-code for getting the lead time (planned delivery time) report i.e. how can we identify if a PO has materials with longer lead times for a set of purchasers/vendors ?

    We experienced such a problem ... using only BEx functionalitites means (at the end) using Virtual KF ...
    Considering the complexity calculation to be made this is a time consuming approach that has even an high response time (in terms on minutes ... depending on the amount of data)
    During Data Load create two more technical KFs to store intermediate values of the formula (X^2 and a counter ...): this because of the fact that BEx formulas work AFTER Aggregation.
    Hope it helps
    GFV

  • PO GRPO lead time

    Hi,
    If anyone can help me with a query it would be greatly appreciated.
    What I'm trying to get to is the average lead time from PO to GRPO at a number of levels.
    Here's an example of the code I've got for the first step:
    SELECT T0.[ItemCode] 'Item Code',
    AVG(DATEDIFF(DD,T1.[DocDate],T3.[ActDelDate])) 'Avg Lead Time SKU'
    FROM [dbo].[OITM]  T0
    INNER JOIN [dbo].[POR1]  T1 ON T0.ItemCode = T1.ItemCode
    INNER JOIN OPOR T2 ON T1.DocEntry = T2.DocEntry
    INNER JOIN PDN1 T3 ON T0.ItemCode = T3.ItemCode
    INNER JOIN OPDN T4 ON T3.DocEntry = T4.DocEntry
    WHERE T1.DocEntry = T3.BaseRef and T1.DocDate > cast(getdate()-180 as date)
    GROUP BY T0.[ItemCode]
    HAVING (COUNT(T1.[DocEntry]) > 10)
    So this calculates the average lead time from PO > GRPO for each Item where there has been at least 10 PO's made in the last 6 months.
    However, if there's not 10 PO's made in the last 6 months at Item level I want to extend the calculation to brand and then category, for instance.
    So, if less than 10 PO's made in the last 6 months at item level then calculate average lead time from PO > GRPO at brand level. If less than 10 PO's made in the last 6 months at brand level then calculate average lead time from PO > GRPO at category level.
    My question is what is the best way to achieve this? Is it a union between separate sub queries? can it be done within a case statement containing separate sub queries? I'm not sure of the best way to progress. If anyone can provide an example of how it might look it would be greatly appreciated.
    Thanks.

    Hello,
    What do you mean with brand level and category level?
    Which fields in SBO?
    Are you capable to make each query separated?
    in you query use this:
    WHERE T2.DocEntry = T3.BaseRef and T2.Linenum = T3.baseline and T3.basetype = 22 and  T1.DocDate > DATEADD(mm, -6, GETDATE())
    instead of this
    WHERE T1.DocEntry = T3.BaseRef and T1.DocDate > cast(getdate()-180 as date)
    because documents are linked on rows not on header.
    Hope you can make a begin with this.
    Regards Teun

Maybe you are looking for

  • How to get return values from task flow in af:region ?

    Hi! I'm working with a taskFlow that is rendered inside a popup using the "popup inside a region pattern" (http://www.oracle.com/technology/products/adf/patterns/popupregionpattern.pdf), but now this taskFlow has an input parameter and a return value

  • HT1535 How do you manually add music to a device's playlist in iTunes 11??? YOU CAN'T!!!

    I don't know what Apple was thinking with iTunes 11, this is the worst iTunes EVER. Year after year, Apple continues to ruin what used to be a great app. In iTunes 11, your devices no longer appear on the left along side your playlists. There's now a

  • Aperture 2 install - serial number problem

    Disclaimer: I'm pretty good on a pc. Absolutely terrible on Mac, never had so many problems with tech :/ So...I have my serial number from the back of the Aperture 2 "Installing your software" booklet. Checked that I'm entering "I's" not "1's." Got d

  • Cannot change PO's in SRM due to system copy/ logical system error

    Hi All- We are running SRM extended classic scenario.  We would like to change PO's that have been created in our production system, but copied to another environment.  We are trying to change these PO's in the copied system but are getting error mes

  • Using anything with a MIDI feature.

    I have an MBox 2 to record in my studio and recently bought a keyboard that has a MIDI feature. I'm using Record/Reason software and I want to use my keyboard to MIDI some features within this software. Do I need to download anything on the computer