Original GI date should display closest day when Saturday and Sunday comes

Hi Guys,
I am getting Original GI Date as After deducting Transit time from Original Delivery Date.
But i want to fullfill  the below requiremnt also.
the Original GI Date should be then the working day defined in the calendar of the shipping point. Thus if the calculation gives  Original GI Date to be Sunday 4.3.2012 then it should changed to the closest previous working date which is Friday 2.3.2012 (calendar 'YT').
Any one help me how to execute the above requiremnt.
regards
reddy.

Hi,
Pass your GI date to below given FM, it will return you the day of the week.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = GI_DATE
IMPORTING
DAY = day_of_week_num
EXCEPTIONS
OTHERS = 8.
the value returned by this FM in day_of_week_num will be between 1 to 7, 1 representing Monday and 6 = Saturday and 7 = sunday.
Now if your working days are from monday to friday then simply check the value returned by this FM is it is 6 then you can subtract 1 for last friday or add 2 for next monday and in the same fashion if value returned is 7 then subtract 2 for last friday and add 1 for next monday in GI date.
For adding and subtracting value from GI date you can use FM RP_CALC_DATE_IN_INTERVAL.  And if you need to check some settings related to Factory calander then you can use FM DATE_CONVERT_TO_FACTORYDATE.
Regards,
Durgesh.

Similar Messages

  • Mail Escalation only on working days i.e except saturday and sunday

    Hi Experts,
    I have a scenario that mail should be escalated to 5 levels.
    First Level condition----
    > complaint date + 2days.
    Second level condition if 1st is not satisfied Compalint date + 4 days.
    next is complaint date + 6 days.
    Problem is when saturday or sunday comes then complaint should not be escalted iam doing this also by getting out of program but iam unable to trigger that complaint which was caught on sat and sunday....
    Small Hint shall be highly appreciated and rewarded..
    Regards,
    Bohra

    Hi,
    You can do this by changing the Day Types Selection Rules.
    Time Management->Work Schedules->Day Types->Define Selection Rules
    Rule - <same as existing>
    D.Ty.Wkdy - <same as existing>
    D.typ.Sat - 1111
    D.typ.Sun - 2222
    Thanks.
    Edited by: Ilyas Shaik Md on Jan 16, 2012 10:13 PM
    Edited by: Ilyas Shaik Md on Jan 16, 2012 10:13 PM

  • Identifying Saturday and Sunday from calender dates

    Hi all,
    i have a table with all the date of year from 200 to till date.
    now i want to identify all those dates from this table which are saturdays and sundays,
    how can i do this?
    please advice...
    thanks.

    Depends on what the nls_territory parameter is set to:
    alter session set nls_territory='UNITED KINGDOM';
    select to_char(sysdate, 'd', 'nls_date_language=american') monday,
           to_char(sysdate -1, 'd', 'nls_date_language=american') sunday
    from dual;
    M S
    1 7
    alter session set nls_territory='AMERICA'
    select to_char(sysdate, 'd', 'nls_date_language=american') monday,
           to_char(sysdate -1, 'd', 'nls_date_language=american') sunday
    from dual;
    M S
    2 1Edited by: Boneist on 06-Jul-2009 12:01
    BluShadow is too fast for me!

  • How to get the data for last 3rd business day and also include saturday and sunday if its a wednesday?

    Hi All,
    I have a simple query which is below:-
    Declare @reportdate date
    set @reportdate= (DATEADD(dd,-5,getdate()))
    select * from dbo.Table
    where date IN (@reportdate)
    I need this query to pull the data for the last 3rd business day .So lets say today is monday then i need the data for last week wednesday which is 3 business days back from monday, if today is a tuesday it would be for last thursday ( as 3 business days for
    tuesday would be thursday). But if today is wednesday then i need to be last 3rd business day which is last friday and i also need to get the data for saturday and sunday.
    Can someone please help me how cani change my filter to do this?
    Please let me know if i am still unclear.
    Thanks

    Hi SqlDev12,
    Based on my understanding on your requirement, you can reference the below sample.
    CREATE TABLE BusinessTable
    Bdate DATE,
    Wd VARCHAR(10)
    ;WITH Cte(DT,WD) AS
    SELECT CAST('20150401' AS DATE),DATENAME(WEEKDAY,CAST('20150401' AS DATE))
    UNION ALL
    SELECT DATEADD(DAY,1,DT),DATENAME(WEEKDAY,DATEADD(DAY,1,DT)) FROM Cte
    WHERE DT<GETDATE()
    INSERT INTO BusinessTable SELECT * FROM Cte
    SELECT * FROM BusinessTable
    SET DATEFIRST 7 -- Set Sunday as the first day of a week
    DECLARE @givenDay DATE ='20150415' --Wednesday
    SELECT * FROM BusinessTable
    WHERE Bdate BETWEEN
    --For Monday and Sunday, select last wednesday
    (CASE WHEN DATEPART(WEEKDAY,@givenDay) IN(1,2) THEN DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay)-1,0))
    --For Tuesday and Wednesday, last week's Thursday and Friday
    WHEN DATEPART(WEEKDAY,@givenDay) IN(3,4) THEN DATEADD(DAY,-5,@givenDay)
    --For Thursday and Friday, current week's Monday and Tuesday
    WHEN DATEPART(WEEKDAY,@givenDay) IN(5,6) THEN DATEADD(DAY,-3,@givenDay)
    --For Saturday, current week's Wednesday
    ELSE DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay),0)) END)
    AND
    (CASE WHEN DATEPART(WEEKDAY,@givenDay) IN(1,2) THEN DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay)-1,0))
    WHEN DATEPART(WEEKDAY,@givenDay) IN(3) THEN DATEADD(DAY,-5,@givenDay)
    WHEN DATEPART(WEEKDAY,@givenDay) IN(4) THEN DATEADD(DAY,-3,@givenDay)
    WHEN DATEPART(WEEKDAY,@givenDay) IN(5,6) THEN DATEADD(DAY,-3,@givenDay)
    ELSE DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay),0)) END)
    DROP TABLE BusinessTable
    If you have any feedback on our support, you can click
    here.
    Eric Zhang
    TechNet Community Support

  • Product Delivered Status Date should be there in Standard Search and Result screen of Service Order. Product Delivered Time should be Available in Result screen and In Result screen there should be facility to filter on basis of Time

    Hi team,
    Product Delivered Status Date should be there in Standard Search and Result screen of Service Order. Product Delivered Time should be Available in Result screen and In Result screen there should be facility to filter on basis of Time.
    How to add this in search result screen.configuration is it possible? or any changes in development.
    Compnent - BT116S_SRVO
    Thanks
    Kalpana

    Hi Kalpana
    Please reread my comment. I said to try and populate "Requested End" Date.
    Make sure the date profile assigned to the transaction includes this Date Type.
    If you can populate this either manually or programmatically the solution should be quite forward.
    If you cannot do this, only then should you look at making any significant sort of enhancement.
    Regards
    Arden

  • Schedule line delivery date on saturday  and sunday its confirm for monday

    HI Experts
    in cash sales process or normal OR also  when i create sales order monday its work fine system take todays (current date) as delivery date and i can do delivery on same date
    but if i create sales order on saturday system take coming monday as delivery date and give goods confirmation on monday date  but iif i change manually system allow me to change the date for saturday and i can do delivery but i want it system should take delivery date as saturday (same date only )
    because in my client there is no holiday all 365 as working day
    in VOV8 its blank no lead time
    factory calendor and logistic i define as all 7 days as working day
    and sales org and plant i assign calendor
    Please guide me where i miss and how can i solve this issue
    thanks in advance

    Hi,
        Check "OVLY" and "OVLZ" and If the sceduling is active for he shipping point /sales document type.  Check "OVXD" and see If the Loading time/ Pick/pack time is determined from it. If they are getting determined from shipping point check the shipping point calender in "SCAL" .If it has saturday and sunday as holidays ,then you may have to change them. And check If the customer has goods recieving hours assigned to him (In customer master unloading point). If he has only 5 working days and If he accepts only goods at 8 am in the morining then system would propose like this.Kindly please let me know If you need any more Information on this.
    Regards
    Ram Pedarla

  • Plan order is considering saturday and sunday as working day.

    Hi All,
    I have a problem where saturday and sunday is being conidered as working day when a plan order is created (Either manually or Automatically). But in calender assigned to this plant, saturday and sunday is assigned as holiday.
    But when we convert the same plan order which has Saturday as Order start, the Basic start date of production order is moved to Firday.
    EG. Plan order - XXXXXX has order finish date as 22-Aug-2011. Inhouse lead time is 2 days. So system takes 20-Aug-2011 as order srat date in plan order.
    But when same Plan order is converted to Production order, then the Basic order start date is moved to 18-Aug-2011 and it says that 20-Aug-2011 and 21-Aug-2011 is maked as holiday in calender.
    Can some one please suggest why is plan order considering Saturday and Sunday as working day.

    Hi,
    Check the factory calendor assigned to plant which is referenced in plan order and teh factory calendor assigned to work center which is used in elad time scheduling in production order.. are they same? 
    Check how they ahve maintined..?

  • Get a saturday and sunday dates

    HI,
    i need a days which are sunday and saturday, when i given a range of period i want to get days which are saturday and sunday within that range.
    if any fm just suggest me.
    Tahnks a lot.

    Hi,
    Please find below an example on how to get the Weekend in shorttext, the dates and the total of weekend for the input date. I used only the FM ''DAY_ATTRIBUTES_GET'' . Please reward if you found useful. Thanks
    REPORT zastest.
    Data Declaration
    TABLES : scal.
    DATA : itab TYPE TABLE OF casdayattr,
           wa_itab LIKE LINE OF itab.
    DATA : l_line TYPE i,
           l_wkend TYPE i.
    Selection Screen
    SELECT-OPTIONS p_date FOR scal-date.
    START-OF-SELECTION.
      CLEAR : l_wkend.
      CALL FUNCTION 'DAY_ATTRIBUTES_GET'
       EXPORTING
      FACTORY_CALENDAR                 = ' '
      HOLIDAY_CALENDAR                 = ' '
         date_from                        = p_date-low
         date_to                          = p_date-high
         language                         = sy-langu
      NON_ISO                          = ' '
    IMPORTING
      YEAR_OF_VALID_FROM               =
      YEAR_OF_VALID_TO                 =
      RETURNCODE                       =
        TABLES
          day_attributes                   = itab
       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.
        CASE sy-subrc.
          WHEN '3'.
            WRITE : 'Date has Invalid Format'.
          when '4'.
            WRITE : 'Date Inconsistency'.
          WHEN '5'.
            WRITE : 'Other exceptions'.
        ENDCASE.
      ELSE.
        DESCRIBE TABLE itab LINES l_line.
        IF l_line GT 0.
          LOOP AT itab INTO wa_itab.
            WRITE : / wa_itab-day_string.
            CASE wa_itab-weekday.
              WHEN '6'.  l_wkend = l_wkend + 1.
              WHEN '7'.  l_wkend = l_wkend + 1.
              WHEN OTHERS.
            ENDCASE.
          ENDLOOP.
          WRITE : / 'l_wkend - ', l_wkend.
        ENDIF.
      ENDIF.
    END-OF-SELECTION.
    Regards,
    Loo

  • Billing date is for Monday for the orders created on Saturday and Sunday

    Hi Friends,
    I have an issue,that for the orders that are created on weekdays, the Billing date is for the same day.
    But for the orders that are created on Saturday and Sunday,the Billing date is being determined automatically for Monday.
    The goods are service material and ther is no delivery being created for these goods.Still the requested delivery date is being determined for Monday for the weekend orders.
    Any idea where i can check these settings or which program or userexit can be looked into for this.
    Thanks in advance...
    Sultan Khan

    Hi,
    How about using BBP_DOC_CHANGE_BADI ?
    Regards,
    Masa

  • Calculate the number of days in a year excluding Saturday and Sunday

    Hi All,
    I need to get the number of days in a year excluding Saturday and Sunday for HR module and then subtract the public holidays.
    Can some let me know how this needs to be done while loading data from one infocube to another.
    Is there any Function module for the same so that i can write any start routines.
    And also is there any table available for Tcode-SCAL with which i can write any start routines.
    Kindly help me as soon as possible.
    Regards,
    Kumar

    Hi Harish
    Refer to the screenshot for Import and Export parameters
    Code
    FUNCTION ZBI_FM_GET_HOLIDAYS .
    *"*"Local Interface:
    *"  IMPORTING
    *"    VALUE(DATE_FROM) TYPE  SCAL-DATE DEFAULT SY-DATUM
    *"    VALUE(DATE_TO) TYPE  SCAL-DATE DEFAULT SY-DATUM
    *"    VALUE(FACT_CAL) TYPE  SCAL-FCALID DEFAULT SPACE
    *"    VALUE(ONLYFACT_DAYS) TYPE  CHAR1 OPTIONAL
    *"  EXPORTING
    *"    REFERENCE(HOLIDAYS) TYPE  I
    *"  TABLES
    *"      DAY_ATTRIBUTES STRUCTURE  CASDAYATTR
    *"  EXCEPTIONS
    *"      FACTORY_CALENDAR_NOT_FOUND
    *"      HOLIDAY_CALENDAR_NOT_FOUND
    *"      DATE_HAS_INVALID_FORMAT
    *"      DATE_INCONSISTENCY
    DATA: LT_DAY_ATTRIBUTES TYPE TABLE OF  CASDAYATTR WITH HEADER LINE.
    DATA: LV_LINES TYPE SY-SUBRC.
    DATA: DATE1 LIKE DATE_FROM,
    DATE2 LIKE DATE_TO.
    *if from date is gt to date then interchange the dates and multiply the result with -1.
    IF DATE_FROM GT DATE_TO.
    DATE2 = DATE_FROM.
    DATE1 = DATE_TO.
    ELSE.
    DATE1 = DATE_FROM.
    DATE2 = DATE_TO.
    ENDIF.
    CALL FUNCTION 'DAY_ATTRIBUTES_GET'
    EXPORTING
    FACTORY_CALENDAR                = FACT_CAL
    *  HOLIDAY_CALENDAR                = ' '
    DATE_FROM                        = DATE1
    DATE_TO                          = DATE2
    LANGUAGE                        = SY-LANGU
    * IMPORTING
    *  YEAR_OF_VALID_FROM              =
    *  YEAR_OF_VALID_TO                =
    *  RETURNCODE                      =
    TABLES
    DAY_ATTRIBUTES                  = LT_DAY_ATTRIBUTES
    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.
    IF ONLYFACT_DAYS = 'X'.
    DELETE LT_DAY_ATTRIBUTES WHERE FREEDAY EQ SPACE.
    ELSE.
    DELETE LT_DAY_ATTRIBUTES WHERE WEEKDAY LT 6.
    ENDIF.
    DESCRIBE TABLE LT_DAY_ATTRIBUTES LINES LV_LINES.
    HOLIDAYS =  LV_LINES.
    *    IF DATE_FROM GT DATE_TO.
    *      HOLIDAYS = HOLIDAYS * -1.
    *    ENDIF.
    ELSEIF SY-SUBRC = 1.
    RAISE FACTORY_CALENDAR_NOT_FOUND.
    ELSEIF SY-SUBRC = 2.
    RAISE HOLIDAY_CALENDAR_NOT_FOUND.
    ELSEIF SY-SUBRC = 3.
    RAISE DATE_HAS_INVALID_FORMAT.
    ELSEIF SY-SUBRC = 4.
    RAISE DATE_INCONSISTENCY.
    ENDIF.
    ENDFUNCTION.

  • Date Parameters displaying a day prior on Report Layout

    Hi,
    I am currently creating some reports using Oracle BI Publisher 11.1.1.6.2.
    The reports in question have a Start Date from Parameter and an End Date To Parameter.
    I also display the values for the parameters in the Report Layout which appears to display the values entered correctly in the Interactive Viewer, but looking at other outputs (i.e. HTML, Excel, PDF etc.) the value in the parameter field in the layout always displays a day prior to what has been entered.
    Has anyone come across this?
    Thanks in advance.

    This is an example of code:
    <?xdofx:substr(season_start_date,6,2)?>
    This would take the month out of the repository variable: season_start_date, in the format MM.
    (MM is on the 6th position, with a length of 2.)

  • While displaying date its displaying 1 Day  behind

    Hi All,
    I am saving date using ,
    <t:inputCalendar renderAsPopup="true" value="#{Bean.startDate}" />
    After saving I am retriving date & displaying as,
    <h:outputText value="#{beanVar.startDate}"/>
    But its displaying 1 day behind.
    Do i need to use converter while displaying
    Thanks.

    Hello Gurus,
    I am new to GRC, I have to create a background job for RA&R daily  Management Reports. I have created a background job by going to Risk Analysis>user level->Risk level>Critical>Report Format>Management summary>clicking on Background>setting the backgorund job for daily.
    But the background is failing to display the report. I ran in the foreground and it works fine.
    Please let me know if I am doing anything wrong in the steps..
    Thank you!
    Regard's,
    SA

  • Display gradient, humming when dimmed, and random shut downs

    On the iMac alum. intel 20" display.
    3 problems after 2 days from purchase, and from reading the recent threads, I'm not the only one. I've been a hardcore apple user for the past 10 years, and i have never been so disappointed. After reading that the gradient effect is common among most of new Alum. iMacs, i am left with a very ill feeling in my stomach. Taking it back to the Apple Store tomorrow. I've read other posts were people have returned up to 3 machines, all come back with the same problem. Should i just get a refund now, or try another replacement?
    cy
    Message was edited by: Cyberhawk

    Bought a brand new iMac 24" 3.06GHz 4GB MEM 1TB HD 2 weeks ago.
    Soft hum, but enough to go nuts.
    Returned it, and today got a new one.
    Same story.
    I've read about this hum on different fora and ppl try to locate the problem.
    But I noticed putting the system 2 feet from a wall actually solves the problem. Now that's great if your desk is in the middle of the room, but not the case here.
    So this one's going back as well and I don't want another one.
    I have a white 20" and a recent aluminum 20" model both are DEAD SILENT. No hum, no squeeck, nothing...
    I think it's a serious flaw of the 24". At first I thought this new 3.06GHz processor needed some serious cooling but seems the 2.8GHz suffers the same problem.
    If you install iStat Pro from www.islayer.com one can read the fan speeds.
    1198-1200 rpm all the time and according to others it's same on both 2.8 and 3.06 models.
    So I think Apple missed something here or they all have their pc's @ least 2 feet from a wall.

  • Number of a day of an year without saturday and sunday

    Hi,
    How can I get the number of the day of an year?
    How can I remove, from this number the saturday and the sunday? Should I check day by day?
    Thanks, bye bye.

    Or you can function NEXT_DAY, some math and table dual:
    to_char(to_date(6,'j'),'Day') is NLS independent way of representing Sunday and to_char(to_date(5,'j'),'Day') is NLS independent way of representing Saturday.
    NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day')) is first sunday >= start_date. NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) is last Sunday <= end_date. Therefore:
    (NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 is number of Sunday's between start_date and end_date. Same way:
    (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1 As a result, number of weekdays between start_date and end_date is:
    end_date - start_date + 1 -((NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 +
    (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1) or
    end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 -
    (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 or:
    SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) /
           7 - (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7
    FROM DUAL; Now:
    WITH t AS (
               SELECT  to_char(to_date(6,'j'),'Day') sunday,
                       to_char(to_date(5,'j'),'Day') saturday,
                       DATE '2009-01-01'             start_date,
                       DATE '2009-12-31'             end_date
                 FROM  dual
    SELECT  end_date - start_date - 1 -(NEXT_DAY(end_date - 7,sunday) - NEXT_DAY(DATE '2009-01-01' - 1,sunday)) /
            7 - (NEXT_DAY(end_date - 7,saturday) - NEXT_DAY(start_date - 1,saturday)) / 7
      FROM  t
    END_DATE-DATE'2009-01-01'-1-(NEXT_DAY(END_DATE-7,SUNDAY)-NEXT_DAY(DATE'2009-01-0
                                                                                 261
    SQL> SY.

  • How do I take a date string, add "X" days to it, and display a new date?

    I have a date listed in a text string. I would like to convert it to a time stamp, and take a variable number of days, converted to seconds, added to the date, and displayed as a correct date. Example: 9/1/2011 adding 35 days is 10/6/2011. The trick seems to be getting it correct for every month and year combination. How can I accomplish this? I was thinking along the lines of time stamps, but any method that works consistently would be fine.
    Thank you!
    Solved!
    Go to Solution.

    You are right, use timestamps, they will take care of the working out the correct date for you.
    Interpret your string as a timestamp.
    Add your offset (use a numeric add, and consider using units on your variable)
    Reinterpret your datestamp as a string.
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

Maybe you are looking for

  • Voice memos no longer syncing (AGAIN) w/ 5.1 update

    For years there have been tremendous problems when trying to move voice memos from the iPhone to a computer. Usually iTunes would not recognize any voice memos without a bunch of work-arounds, like checking/unchecking boxes consolidating the library,

  • Db LInk in report, Reflected  to speed.

    Hi, I have created classical report and in report i used dblinks in three columns.When i used dblink in report It created worst speed of my report. It take too long time to run the report. I created edit link on my report using code. procedure "Inv_i

  • Campus / Enterprise VLAN Security Integration

    Ji Jeal   One of the things that always bothers me about (including the many different ways of) deploying guest wireless is the need to have a VLAN that contains untrusted guest traffic on the same switches that carry trusted corporate traffic. Given

  • Can't load to iTunes Store

    When i try to connect to iTunes store the following message appears: *We could not complete your iTunes Store request. An unknown error occurred* (-50). There was an error in the iTunes Store. Please try again later.

  • Setup for Macbook Pro & XP desktop with one monitor (Cintiq21UX from WACOM)

    Is there a way to use the Cintiq 21UX as a monitor for both my my new Macbook Pro laptop & a Windows XP desktop? I would rather not have to change cables and have heard about a KVM switch from IOGEAR that might give this functionality. Ideally, I wou