VL10h - 1 month default delivery date range

Dear Sirs,
I am using VL10h to create deliveries from Sales Order. But, The default date range it takes is only 1 month. Would you please suggest me to increase the date range?
The message I am getting is-
Latest deliv. creation date (04.12.2009) further in future than allowed (30 days)
Message no. V50R014
Diagnosis
Maximum future delivery time frame was exceeded.
System Response
In your system, the maximum delivery creation time frame is limited to 30 days in the future. However, you want to deliver until 04.12.2009, which the system does not allow.
Procedure
Choose a smaller interval for delivery.
Procedure for System Administration
You can set the number of days in the future the delivery is limited to in Customizing in Create deliveries profiles 0101, which is assigned to the current list profile "Sales Order and Purchase Order Items".
regards,
rahul

Dear Rahul
To avoid the error message V50R014 you have to change the value of the
field "Maximum delivery period in the future"  (transaction VL10CUC).  Alternatively, maintain the delivery creation profile in transaction VL10H for the field "Maximum delivery period in the future".
Hope this helps.
Regards
Tonia

Similar Messages

  • Assign Month within a date range (by most days in a given month)

    I have a begin and end date, sample data as such
    select to_date('01-13-12','mm-dd-yy') from_dt,
    to_date('02-23-12','mm-dd-yy') to_dt
    from dual
    union all
    select to_date('03-15-2012','mm-dd-yy') from_dt,
    to_date('04-16-2012','mm-dd-yy') to_dt
    from dual
    union all
    select to_date('05-13-2012','mm-dd-yy') from_dt,
    to_date('07-23-2012','mm-dd-yy') to_dt
    from dual
    How do I assign a month by the most days in a month within that date range? Sometimes the date range might have the exact same amount of days in a month (like 3/15/2012 has 16 days and 4/16/2012 has 16 days). In this case, I want the earlier month (march).
    So from the sample data:
    01/13/2012, 02/23/2012, February
    03/15/2012, 04/16/2012, March
    05/13/2012, 07/23/2012, June
    Thanks
    Edited by: user4422426 on Mar 1, 2012 5:15 PM

    Hi,
    Here's one way:
    WITH     cntr          AS
         SELECT     LEVEL - 1     AS n
         FROM     (
                   SELECT      1 + MAX (to_dt - from_dt)     AS max_day_cnt
                   FROM     table_x
         CONNECT BY     LEVEL     <= max_day_cnt
    ,     got_r_num     AS
         SELECT     x.from_dt, x.to_dt
         ,     TRUNC (x.from_dt + c.n, 'MONTH')     AS month
         ,     count (*)                    AS cnt
         ,     ROW_NUMBER () OVER ( PARTITION BY  from_dt, to_dt
                             ORDER BY        COUNT (*)     DESC
                             ,             TRUNC (x.from_dt + c.n, 'MONTH')
                           )     AS r_num
         FROM       cntr     c
         JOIN       table_x  x  ON  c.n  <= x.to_dt - x.from_dt
         GROUP BY  x.from_dt, x.to_dt
         ,       TRUNC (x.from_dt + c.n, 'MONTH')
    SELECT     from_dt, to_dt
    ,     TO_CHAR (month, 'Mon YYYY')     AS mon
    ,     cnt
    FROM     got_r_num
    WHERE     r_num     = 1
    ;Thanks for posting code to create the same data. Please test your code before you post it: you got the order of arguments to TO_DATE reversed.

  • How to calculate a week & Month in given date range (not for sele-options)

    Hi ,
      I have defined 2 date parameters in sel-screen (Plz remember that date variable are not a SELECT-OPTIONS).  Now i want ot display week nos & monts in output.
          Ex: date1: 20080101 & date2: 20080229. then
                    weeks : 1, 2, 3,---9.
                    months: jan-08, feb-08.
    Plz help me with block of code or any FM.
    Regards,

    Hi Srikanth,
            The FM HR_99S_INTERVAL_BETWEEN_DATES   is doesn't existing, but there is a fm HR_MX_INTERVAL_BETWEEN_DATES but it returns no of Years & Days.
           But i found some FM which r returns no of months for given date range. but my requirement is, want to display the month no bw 1 to 12. (ex: dat1=15-03-2008 & dat2= 01-06-2008 then in month fields 03,04,05 & 06. ).
    Plz help me on this.
    -Regards.

  • Default delivery date in sales order

    Hi guys
    A strange problem: I have two sales organisation (sales org.channeldivision) we will call A and B and two sales order documen type (C and D).
    Both the document type have as default delivery date the today date.
    I created a order using A and C combination: the default delivery date appear to be 01.01.1990 always.
    I created with A and D it is ok (today date).
    I created with B and C it is ok
    I created with B and D it is ok.
    I precise: no customer or material has been already assigned to order.
    How it is possible? Other values, a part from default flag over the document type, can change the delivery date over the sales order?
    thanks
    Davide

    Found: it is the sales org. factory date, but only because the document type C has a lead time value. When no lead time exist, like for document type D, the system take the today date correctly.
    Thanks.
    ciao
    Davide

  • Set Dynamic Default Delivery Date in ME21n

    Hi!
    Under personal settings in ME21n, it is possible set a default delivery date. However, as I see it one can only set a fixed date like 2011-08.-12, which would quite useless in a couple of weeks. Is there any way to set this date dynamically as it is possible in normal selection variants.
    I am grateful for all input.

    yes this field is pretty useless, except for hundreds of items within one PO.
    usually delivery dates are defined by the requisitioners  and not by a default value of a buyer.

  • Multi-month, year, and date-range views

    My apologies for wasting everyone's time if I've missed something really obvious here, but am I correct in concluding that there is no way to generate anything beyond a static one-month view in iCal? No multi-month view? No year view? No "view date range"? At this stage of the game, how is it possible that something so elemental could be omitted from this program?
    At this point I'm reduced to exporting each month to a pdf file and then arranging them as tiles on the screen. But there has to be a better way.
    Short of a new version from Apple, are there any plug-ins that would do this? Does anyone have any other work-arounds? Thanks in advance.

    A quick search of the forums shows that this is a HIGHLY sought after feature (including by me). We all need to use the feed back link (below) to let Apple know this. In my experience with the tech support folks, they seem to have NO idea about what these forums say. In the past I have actually had them log in to these forums and search the issue I was calling them about and they have been blown away when they see the hundreds / thousands of posts with the very same thing they're discussing with me. So, as the wise man says .. "you don't ask, you don't get!" Use the form and let them know...
    http://www.apple.com/feedback/ical.html

  • Count days in a month for a date range

    i am trying to find no. of days between 2 Date Ranges for a list of Ids. i used the logic in the below link:
    count days of the month
    My query is giving duplicates since, I have list of Ids.
    Doctor_ID     Patient_ID     ARRIVE_DT_TM     DISCH_DT_TM
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15
    25391509     42972298     2/4/2013 22:45     3/8/2013 22:03
    746779     42972331     1/4/2013 23:00     3/26/2013 21:50
    763305     42972338     3/4/2013 22:19     3/6/2013 19:35
    763305     42972411     11/4/2013 22:32     3/29/2013 17:30
    I am looking for query to give me for Patient_ID = 42972229
    MONTH     COUNT_DAYS
    201210     14
    201211     30
    201212     31
    201301     31
    201302     28
    201303     14
    I am running the following code and it loops through the months and gives duplicates when I remove where Patient_id IN (42972229)
    select
    Doctor_ID
    , Patient_ID
    , AR_DTTM
    , DSC_DTTM
    , TO_CHAR(ADD_MONTHS(TRUNC(date1, 'MONTH'), LEVEL - 1), 'YYYY MM') MONTHS_BET
    , (LEAST(date2, ADD_MONTHS(TRUNC(date1, 'MONTH') - 1, LEVEL)) - GREATEST(date1, ADD_MONTHS(TRUNC(date1, 'MONTH'), LEVEL - 1)))+ 1 AS DAYSCOUNT
    from (select
    Doctor_ID
    , Patient_ID
    , ARRIVE_DT_TM AR_DTTM
    , DISCH_DT_TM DSC_DTTM
    ,TRUNC(ARRIVE_DT_TM,'DDD') AS date1
    ,TRUNC(DISCH_DT_TM,'DDD') AS date2
    from temp where Patient_id IN (42972229)
    CONNECT BY LEVEL <= MONTHS_BETWEEN(TRUNC(date2, 'MONTH'), TRUNC(date1, 'MONTH')) + 1
    Please help!

    Hi,
    ASTRA_007 wrote:
    Results I would like to see are:
    Doctor_ID     Patient_ID     ARRIVE_DT_TM     DISCH_DT_TM     Month     CountofDays
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2012 10     14
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2012 11     30
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2012 12     31
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2013 01     31
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2013 02     28
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2013 03     14
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15     2013 01     25
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15     2013 02     28
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15     2013 03     15
    and so on...So each row represents a patient-month, and you want to display several columns from the temp table on each output row. In that case, include all those columns in both the SELECT and GROUP BY clauses, like this:
    WITH     universe     AS
         SELECT     *
         FROM     temp
    --     WHERE     patient_id     IN (42972229)
    ,     date_range     AS
         SELECT     TRUNC (MIN (arrive_dt_tm))     AS first_date
         ,     TRUNC (MAX (disch_dt_tm))     AS last_date
         FROM     universe
    ,     all_dates     AS
         SELECT     first_date + LEVEL - 1     AS a_date
         FROM     date_range
         CONNECT BY     LEVEL     <= (last_date + 1) - first_date
    SELECT    u.doctor_id
    ,       u.patient_id
    ,       u.arrive_dt_tm
    ,       u.disch_dt_tm
    ,       TO_CHAR ( TRUNC (a.a_date, 'MONTH')
                  , 'YYYY MM'
                )          AS month
    ,       COUNT (*)          AS count_days
    FROM       all_dates  a
    JOIN       universe   u  ON  a.a_date  BETWEEN  TRUNC (u.arrive_dt_tm)
                                         AND      u.disch_dt_tm
    GROUP BY  u.doctor_id
    ,       u.patient_id
    ,       u.arrive_dt_tm
    ,       u.disch_dt_tm
    ,         TRUNC (a.a_date, 'MONTH')
    ORDER BY  u.patient_id
    ,       TRUNC (a.a_date, 'MONTH')
    ;Output from your sample data (with no filtering):
    `DOCTOR_ID PATIENT_ID ARRIVE_DT_TM     DISCH_DT_TM      MONTH   COUNT_DAYS
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2012 10         14
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2012 11         30
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2012 12         31
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2013 01         31
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2013 02         28
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2013 03         14
        763305   42972232 1/7/2013 20:27   3/15/2013 19:15  2013 01         25
        763305   42972232 1/7/2013 20:27   3/15/2013 19:15  2013 02         28
        763305   42972232 1/7/2013 20:27   3/15/2013 19:15  2013 03         15
      25391509   42972298 2/4/2013 22:45   3/8/2013 22:3    2013 02         25
      25391509   42972298 2/4/2013 22:45   3/8/2013 22:3    2013 03          8
        746779   42972331 1/4/2013 23:0    3/26/2013 21:50  2013 01         28
        746779   42972331 1/4/2013 23:0    3/26/2013 21:50  2013 02         28
        746779   42972331 1/4/2013 23:0    3/26/2013 21:50  2013 03         26
        763305   42972338 3/4/2013 22:19   3/6/2013 19:35   2013 03          3
    In the end the objective is to count the no. of days in each month between the arrival and discharge dates by Physician and for his/her patients.Then is the output above really what you want? Say you're interested in physician 763305. That physician had 18-patient days in March, 2013, but the output doesn't make it clear.
    I ran your query, it works great but I have a long list of patients for whom I have to run these counts.the query above includes all patient_ids.
    That's a separate problem, to be solved in the first sub-query, universe. The rest of the query will be unchanged.
    How will you know which patients to include? If you can derive the list from temp itself, just use a WHERE clause in universe. If you need to look at other tables, join them in universe, or use them in sub-queries in universe, or both.
    For exmple, if you decide that the list of patient_ids has no pattern, and that you'll need to store their ids in a separate table (perhaps a global temporary table), then universe might be:
    WITH     universe     AS
         SELECT     t.*     -- or list columns needed
         FROM     temp                        t
         JOIN     patient_ids_to_include  p 
                      ON  p.patient_id = t.patient_id
    ) ...The rest of the query can be the same as above.
    If a same patient is admitted again then Patient_ID will be different no matter when readmitted.Are you saying that patient_id identifies a visit, not a patient, and that the same person is assigned a different patient_id every time that person is admitted?
    For
    INSERT INTO temp (doctor_id, patient_id, arrive_dt_tm, disch_dt_tm)
    VALUES ( 755722
    , 42972229
    , TO_DATE ('03/14/2013 23:00', 'MM/DD/YYYY HH24:MI')
    , TO_DATE ('04/01/2013 12:00', 'MM/DD/YYYY HH24:MI')
    First the Patient ID will be different from the earlier admission. Second the results will show like:
    Doctor_ID     Patient_ID     ARRIVE_DT_TM     DISCH_DT_TM     Month     CountofDays
    755722     42972229     3/14/2013 23:00     4/1/2013 12:00     2012 03     14
    755722     42972229     3/14/2013 23:00     4/1/2013 12:00     2012 04     1Are you saying that temp.patient_id is unique, and so the situation is impossible?
    Edited by: Frank Kulash on May 7, 2013 10:23 AM

  • Function to list the month from a date range?

    I would like to know what the function is that would take a look at a date range, and extract the month name
    Here is how I would like it to come out:

    Hello
    The following sample tables are along your original scheme using month name to filter the data.
    2014 (excerpt)
    A1  month
    A2  =MONTHNAME(MONTH(B2))
    A3  =MONTHNAME(MONTH(B3))
    A4  =MONTHNAME(MONTH(B4))
    B1  date
    B2  2013-01-15
    B3  2013-01-20
    B4  2013-01-27
    C1  category
    C2  A
    C3  B
    C4  C
    D1  amount
    D2  100
    D3  50
    D4  20
    January
    A1  category
    A2  A
    A3  B
    A4  C
    A5  D
    A6  E
    A7  F
    A8  G
    A9  H
    B1  totals
    B2  =SUMIFS(2014::D,2014::A,C$1,2014::C,A2)
    B3  =SUMIFS(2014::D,2014::A,C$1,2014::C,A3)
    B4  =SUMIFS(2014::D,2014::A,C$1,2014::C,A4)
    B5  =SUMIFS(2014::D,2014::A,C$1,2014::C,A5)
    B6  =SUMIFS(2014::D,2014::A,C$1,2014::C,A6)
    B7  =SUMIFS(2014::D,2014::A,C$1,2014::C,A7)
    B8  =SUMIFS(2014::D,2014::A,C$1,2014::C,A8)
    B9  =SUMIFS(2014::D,2014::A,C$1,2014::C,A9)
    C1  January
    C2 
    C3 
    C4 
    C5 
    C6 
    C7 
    C8 
    C9 
    Notes.
    Formula in January::B2 can be filled down across B2:B9.
    The target month name is defined in January::C1.
    February table is the same as January table except for the value in C1.
    And the following sample tables are using date per se instead of month name to filter the data. In this scheme, you don't need month column in source table but the retrieving formulae in destination table become more complex.
    2014 (excerpt)
    A1  date
    A2  2013-01-15
    A3  2013-01-20
    A4  2013-01-27
    B1  category
    B2  A
    B3  B
    B4  C
    C1  amount
    C2  100
    C3  50
    C4  20
    January
    A1  category
    A2  A
    A3  B
    A4  C
    A5  D
    A6  E
    A7  F
    A8  G
    A9  H
    B1  totals
    B2  =SUMIFS(2014::C,2014::B,A2,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B3  =SUMIFS(2014::C,2014::B,A3,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B4  =SUMIFS(2014::C,2014::B,A4,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B5  =SUMIFS(2014::C,2014::B,A5,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B6  =SUMIFS(2014::C,2014::B,A6,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B7  =SUMIFS(2014::C,2014::B,A7,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B8  =SUMIFS(2014::C,2014::B,A8,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    B9  =SUMIFS(2014::C,2014::B,A9,2014::A,">="&EOMONTH(C$1,-1)+1,2014::A,"<="&EOMONTH(C$1,0))
    C1  2013-01-01
    C2 
    C3 
    C4 
    C5 
    C6 
    C7 
    C8 
    C9 
    Notes.
    Formula in January::B2 can be filled down across January::B2:B9.
    The target month is defined in January::C1, which can be any date in target month, e.g., 2013-01-01, 2013-01-20, etc. The formulae in B will retrieve data with date in range: 2013-01-01 <= [date] <= 2013-01-31.
    February table is the same as January table except for the value in C1.
    Tables are built in Numbers v2.
    Hope this may help,
    H
    EDIT: Replaced the last table with the correct one. (Formulae in B are correct)

  • List Months between a date range

    Hi, I'm trying to list the months between a given date range in an ABAP report to generate a MIS report(ALV).. Say I have 2 date ranges, 01.01.2006 to 01.04.2006.. I want to list
    Jan 2006
    Feb 2006
    Mar 2006
    Apr 2006.. Any FM in SAP to get this OP..

    hi vivek,
    use this function module to get months beween two dates
    1. MONTHS_BETWEEN_TWO_DATES   or
    2. MONTHS_BETWEEN_TWO_DATES_NEW
    please reward the point if you are satisfied with answer
    thanks,
    john.

  • Default Delivery Date on Shopping Cart

    Hi
    We have a requirement to have delivery date in future (current date + n days) on the shopping cart line items. I have searched and found a BADI BBP_CHANGE_DEFAULT to handle this requirement. I have implemented the method CHANGE_DEFAULT_DELIV_DATE to make the delviery date in future. Now this works fine when we create SC with "Describe Requirement" or "Create from old SC/template".
    However when we try to create SC from the catalog the default date remains as current date? I have debugged the code but it seems to be ignoring the date calculated from BADI. Is there any other BADI or different logic for SC created from service catalogs?
    Regards
    Manish.

    Hi,
    Use BADI BBP_DOC_CHANGE_BADI.
    and this sample code:
        LOOP AT it_item ASSIGNING <sc_item>.
          lv_delivery_date = sy-datum.
          lv_delivery_date = lv_delivery_date + ls_sc_item-leadtime.
            WHILE lv_working_day_flag IS NOT INITIAL.
              CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
                EXPORTING
                  date                 = lv_delivery_date
                  factory_calendar_id  = 'AA'
                IMPORTING
                  workingday_indicator = lv_working_day_ind.
              IF sy-subrc EQ 0.
                IF lv_working_day_ind NE space.
                  lv_delivery_date = lv_delivery_date + 1.
                ELSE.
                  CLEAR lv_working_day_flag.
                ENDIF.
              ENDIF.
            ENDWHILE.
            <sc_item>-deliv_date = lv_delivery_date.
          APPEND <sc_item> TO et_item.
        ENDLOOP.
    In this code I add lead time to delivery date and check if this date is a working day (factory calendar eq AA).
    If yes - it is my delivery date, if not - I add to date one day and recheck.
    Regards,
    Marcin

  • Shopping Cart default delivery date

    Hi,
    SAP SRM system takes by default  current date as a delivery date in the Shopping cart line item.
    Can any one suggest, whether we can set the same as next working day by default  i.e.. If S/C raised on Friday then defau Delivery date should be on Monday? If yes , how ?
    Regards
    NAP

    Create a PR as like shopping cart in ecc and refer the contract and see the PO delivery date
    PR- PO - what is delivery date.
    update me or cross check
    I think in ECC it definetly works fine as we expected .
    You are correct . i just testing
    SC PO did not behave what we exected
    PR  PO behaves what we expected.
    no comments as of now.
    can you order as direct this material w.r.t vendor list (refer here backend contract) and uppdate PO delivery date in SRM the results here
    Muthu

  • Finding the number of weeks or months in a Date range

    I have a couple of text boxes that a user inputs a start date and an end date. What I want to know is there a way to tell the number of months or the the number of days in this date range?
    For example:
    Start Date = 02/12/2004
    End Date = 03/12/2004
    The number of weeks = 4 //May not be accurate, just showing an example.
    The number of months = 2

    For month, I would define it as the dates that fall in the actual calendar month. If my start date input from the user is 1/21/04, then I want to define a time period of 1/21/04 through 1/31/04 to be included in the first month. I know that it is not an actual month, but I am trying to make graphs based on monthly performance.
    For weeks, I want the days to run Sunday through Saturday. If the first date starts on a Wednesday, then I want my first week to include days only Wednesday through Saturday.

  • Force default delivery date in sales order

    Dear all,
    does exist a specific SAP setting to automatically compile the delivery date in the sales order document?
    I always need to set this date as:   GetDate() + 30 days
    Regards
        Emanuele

    Hi Emanuele,
    Save the following query within SAP B1:
    SELECT getdate() + 30
    You will then need to apply a formatted search to the Due Date field of the Sales Order, link it to your saved query and have it autorefresh when the Customer/supplier No. field changes
    Regards,
    Adrian

  • Get months from a date range comparing event date

    Hi All,
    Below is the data
    CREATE TABLE #Coverage(
    EmployeeID INT,
    EmployeeName VARCHAR(20),
    CoverageName VARCHAR(50),
    CoverageAmount Decimal,
    CoveredBy VARCHAR(20),
    EventDate DATETIME,
    CoverageStartDate DATETIME,
    CoverageEndDate DATETIME
    INSERT INTO #coverage VALUES (8,'Lara','Employee + Children',213.60,'EmployeeContribution','2013-10-01','2013-10-01','2014-05-31'),
    (8,'LAra','Employee + Children', 606.31 ,'CompanyContribution' ,'2013-10-01','2013-10-01','2014-05-31'),
    (8,'LAra','Employee Only' ,0.00 ,'EmployeeContribution' ,NULL ,'2013-06-01','2014-05-31'),
    (8,'LAra','Employee Only' ,431.55 ,'CompanyContribution' ,NULL ,'2013-06-01','2014-05-31'),
    (8,'LAra','Employee Only' ,81.42 ,'EmployeeContribution' ,NULL ,'2012-06-01','2013-05-31'),
    (8,'LAra','Employee Only' ,420.93 ,'CompanyContribution' ,NULL ,'2012-06-01','2013-05-31')
    SELECT * FROM #Coverage
    drop table #coverage
    and expected out put for the year 2013
    EmployeeID
    EmployeeName
    CoverageName
    CoverageAmount
    CoveredBy
    Month
    Year
    8
    Lara
    Employee Only
    81
    Employee Contibution
    1
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    1
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    2
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    2
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    3
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    3
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    4
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    4
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    5
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    5
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    6
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    6
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    7
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    7
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    8
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    8
    2013
    8
    Lara
    Employee Only
    81
    Employee Contibution
    9
    2013
    8
    Lara
    Employee Only
    421
    Company Contribution
    9
    2013
    8
    Lara
    Employee +Children
    214
    Employee Contibution
    10
    2013
    8
    Lara
    Employee +Children
    606
    Company Contribution
    10
    2013
    8
    Lara
    Employee +Children
    214
    Employee Contibution
    11
    2013
    8
    Lara
    Employee +Children
    606
    Company Contribution
    11
    2013
    8
    Lara
    Employee +Children
    214
    Employee Contibution
    12
    2013
    8
    Lara
    Employee +Children
    606
    Company Contribution
    12
    2013
    Can any one help me out with this.
    Thanks!

    This gives your resultset.
    I've added the cte to give a newenddate because your dataset doesn't close off the previous one in all cases and gave duplicates - you can remove this if it is a mistake in the data. Also you would need to add the employee to the partition to run on multiple
    employees.
    declare
    @Coverage TABLE (
    EmployeeID
    INT,
    EmployeeName
    VARCHAR(20),
    CoverageName
    VARCHAR(50),
    CoverageAmount
    Decimal,
    CoveredBy
    VARCHAR(20),
    EventDate
    DATETIME,
    CoverageStartDate
    DATETIME,
    CoverageEndDate
    DATETIME
    INSERT
    INTO @Coverage
    VALUES (8,'Lara','Employee + Children',213.60,'EmployeeContribution','2013-10-01','2013-10-01','2014-05-31'),
    (8,'LAra','Employee
    + Children',  606.31
    ,'CompanyContribution'    
    ,'2013-10-01','2013-10-01','2014-05-31'),
    (8,'LAra','Employee
    Only'               
    ,0.00  ,'EmployeeContribution'   
    ,NULL  ,'2013-06-01','2014-05-31'),
    (8,'LAra','Employee
    Only'               
    ,431.55      
    ,'CompanyContribution'    
    ,NULL  ,'2013-06-01','2014-05-31'),
    (8,'LAra','Employee
    Only'               
    ,81.42 ,'EmployeeContribution'   
    ,NULL  ,'2012-06-01','2013-05-31'),
    (8,'LAra','Employee
    Only'               
    ,420.93      
    ,'CompanyContribution'    
    ,NULL  ,'2012-06-01','2013-05-31')
    SELECT
    * FROM
    @Coverage
    ;with
    ctee1 as
    select
    *, seq
    = row_number()
    over (partition
    by coveredby
    order by coveragestartdate)
    from
    @Coverage
    ,ctee
    as
    select
    c1.*,
    newenddte = coalesce(c2.coveragestartdate-1,
    c1.coverageenddate)
    from
    ctee1 c1
    left
    join ctee1
    c2
    on
    c1.coveredby
    = c2.coveredby
    and
    c1.seq
    = c2.seq-1
    cte1 as
    select
    dtestrt =
    convert(datetime,'20130101'),
    dteend =
    convert(datetime,'20131201')
    ,cte
    as
    select
    dtestrt =
    cte1.dtestrt,
    dteend =
    dateadd(mm,1,cte1.dtestrt)-1,
    mth =
    month(cte1.dtestrt),
    yr =
    year(cte1.dtestrt)
    from cte1
    union
    all
    select
    dtestrt =
    dateadd(mm,1,cte.dtestrt),
    dteend =
    dateadd(mm,2,cte.dtestrt)-1,
    mth =
    month(dateadd(mm,1,cte.dtestrt)),
    yr =
    year(dateadd(mm,1,cte.dtestrt))
    from cte,
    cte1 where
    cte.dtestrt
    < cte1.dteend-1
    select
    c.EmployeeID,
    c.EmployeeName,
    c.CoverageName,
    c.CoverageAmount,
    c.CoveredBy,
    cte.mth,
    cte.yr,
    cte.dtestrt,
    cte.dteend
    from
    cte
    join
    ctee c
    on
    cte.dtestrt
    <= c.newenddte 
    and cte.dteend
    >= c.CoverageStartDate
    order
    by c.EmployeeID,
    cte.dtestrt

  • Two Delivery dates in Sale Order against one item

    Dear All
    I need two delivery dates in sale order. one is default at the time of creation sale order. second i need actual delivery date which will be confirmed by production planning department after analysis the order whether material can be ready on that delivery date or it need to change. Actual delivery date may vary from original delivery date and both need to preserve in system. kindly provide solution. best regards.
    Manjit

    You need to select the Availability & Transfer of Req. check box in Schedule Line Configuration.It will transfer the req. to PP.So while creating the sale order , schedule Lines will be confirmed as per the Available Stock.
    System will give you the Default Delivery Date as the Date added after Lead Time in days in the Configuration.Else system will give the Current Date.
    Best regards,
    Ankur

Maybe you are looking for

  • Using G5 as a server

    We have a dual 1.8 G5 tower and need a server for our little 2-mac prepress department. Can someone tell me if it's viable and a good choice to use this machine as a server? I'm very Mac Savvy but not so knowledgable about Servers and Networks and do

  • Transfer files from older mac to new laptop

    Is the firewire on my powermac g5 compatible with a thunderbolt port on a new macbook air to transfer files?

  • Burning photos to DVD

    Help! Trying to burn 664 photos from iPhoto 6 to a DVD 2x ASDA disc I keep getting the message '+The burn to the MATSHITA DVD-R UJ-846 drive failed. The burn failed because of a medium write error.+' Does anyone know what might be the problem? Elizab

  • How to maintain SAP Release status in table COTPL

    Hi All, We have upgraded our system from ECC EHP4 TO ECC EHP 5. Now our SAP Release is 702 but in table COTPL still the SAP Release status is 701 becuase of which there is error in some of our sap jobs. Request you all to help us. How we can maintain

  • Same object size (front panel) with different screen resolution

    Hi everybody, I realised an application, and I try to instal it on various computer. The probleme is that they haven't the same screen resolution, so the front panel is not the same on each computer. It is possible to build an application which have