Calculate the Sunday date based on 0CALDAY

Hi All,
How to Calculate the Sunday date based on 0CALDAY
Thanks in advance
CPY

use customer exit where you can use this FM /OSP/GETDATE_WEEKDAY

Similar Messages

  • FM to get the previous sunday date based on current date(sy-datum)

    hi all,
    Is there any function module to get the previous sunday date based on current date(sy-datum)?
    Regards,
    Kapil Sharma
    Moderator Message: Basic date related questions are not allowed
    Edited by: Suhas Saha on Sep 19, 2011 11:39 AM

    Hi,
    There are function modules to find out the current day of the week depending on sy-datum. These are as below:
    1. DATE_COMPUTE_DAY - Returns a number indicating what day of the week the date falls on. e.g. Monday is returned as a 1, Tuesday as 2,...., Sunday as 7.
    2. RH_GET_DATE_DAYNAME  - Returns the day based on the date provided, e.g. Monday, Tuesday,..., Sunday.
    Using any of the above, if you can find out the current day, then you can calculate and compute the date of the previous Sunday.
    My observation is that using the first FM might make the calculation simpler.
    Hope this is of help to you.
    Regards,
    Shayeree

  • How to calculate Goods issue date based on the time of delivery

    Hi SAP Gurus,
    I seek your help/suggestion for the given scenario.
    The user requires calculating the GI date based on time of delivery.
    Based on the delivery priority (like Priority 1= Day 1, Priority 2= Day 2) maintained in customer master, the need is something like below-
    1st case= If Retail Customeru2019s delivery orders received before midday (Noon cut off) require to be dispatched on same working day (Day 1)
    Wholesaler customer delivery orders received before midday require to be dispatched by the next
    Working day (Day 2 Including day of receipt)
    2nd case= Retail customeru2019s delivery orders received after midday require to be dispatched by the next working day
    Wholesaler customer delivery orders received after midday require to be dispatched by on day 3
    Kindly suggest , how to proceed in this. I am new to SAP world so need ur help to tackle this.
    Thanks a lot in advance for the valuable inputs.

    What I proposed to do was,
    a. Create routes like 0 day route, 1 Day route, 2 day route etc.
    b. Route determination is based on the Shipping condition of the customer. Put in the shipping condition for the customer as 00 - immediate delivery. 01 - By Truck, 02 - By Rail, 03 - Ship etc
    c. Now, put in your route determination in such a way that routes change in the sales order with shipping condition (SC). Like, if the shipping condition is set to 00, then 0 day route comes up. Meaning immediate delivery, if SC is 01, then your normal route by truck picks up. etc.
    When the sales order is manually created, you know the time of creation. As route is one of the criteria, the material confirmation happens based on number of days you put in the route to reach the destination. Now that you have the material available for today's delivery, the delivery program can be run to create it, or it can be manually created.
    Now, when you configure the route you have to specify 'Transit duration in calendar days'.
    When you have the sales order created electronically (say thru EDI), then, you may have to ask them to send in shipping condition. Else, you have to modify the function module Idoc_input_orders in such a way that if the sales order creation time is < 12 PM, then put shipping condition as 00, else copy what ever is there in the customer.
    If you do not want to check the time manually when the user creates the sales order, then you may have to use the user exit MV45AFZZ (and I think you can use Save_order_prepare) to check the time and change the shipping condition. By this you will avoid extra coding in Idoc_input_orders and also need not bother if the user changed the route or not.
    Hope my explanation helps.
    Regards,
    Mukund S

  • FM to get previous sunday date based on current date(SY-DATUM)

    hi all,
    Is there any function module to get the previous sunday date based on current date(sy-datum)?
    Regards,
    Kapil Sharma

    Hi Kapil,
    You can follow the logic below:
    data:
    l_date like sy-datum, **TODAY
    l_date2 like sy-datum, **Previous Sunday
    data:
    l_daynr like HRVSCHED-DAYNR.
    *Get today's date
    l_date = sy-datum.
    *Gey today's day (Monday, Tuesday, etc.)
    CALL FUNCTION 'HRIQ_GET_DATE_DAYNAME'
    EXPORTING
    langu = 'EN'
    date = l_date
    IMPORTING
    daynr = l_daynr.
    CASE l_daynr.
    *If it is Monday
    WHEN 1.
    -Subtract 2 days for the previous Sunday
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 2
    IMPORTING
    ed_date = l_date2.
    *If it is Tuesday
    WHEN 2.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 3
    IMPORTING
    ed_date = l_date2.
    *If it is Wednesday
    WHEN 3.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 4
    IMPORTING
    ed_date = l_date2.
    *If it is Thursday
    WHEN 4.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 5
    IMPORTING
    ed_date = l_date2.
    *If it is Friday
    WHEN 5.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 6
    IMPORTING
    ed_date = l_date2.
    *If it is Saturday
    WHEN 6.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 7
    IMPORTING
    ed_date = l_date2.
    *If it is Sunday
    WHEN 7.
    CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
    EXPORTING
    id_date = l_date
    id-operator = '-'
    is_duration = 8
    IMPORTING
    ed_date = l_date2.
    ENDCASE.
    Regards,
    Dilek

  • How to calculate the 'real data of arrival' in PO item

    Hi,
    Confirmation control keys with control type u201CDAu201D are MRP relevant
    1.     = New field time of transportation in calendar days
    2.     = Confirmation control type u201CABu201D (order confirmation)
    3.     = Confirmation control type u201CLAu201D (shipping notification)
    4.     = Confirmation control type u201CDAu201D (Date of arrival)
    When data 1-3 has been changed = 4 will be calculated again.
    Program requirements to calculate the u201Creal data of arrivalu201D:
    1.     When 1 >0 days then create 4 directly after placement of 2 (2 can be placed manually or automatically)
    2.     4 must be calculated: AB delivery date 2 + calendar date amount 1 = arrival date 4 (MRP gets a confirmed delivery      date by vendor plus transportation time)
    3.     When changes in 1 then change 4 (add calendar days to arrival date DA)
    4.      When changes in 2 then change 4 = u201Cnewu201D delivery date 2 plus calendar days 1 = new arrival date 4
    5.     When 3 u201CLAu201D is entered (manually/automatically) then calculate: shipping date LA 3 plus calendar days 1 = new arrival date in 4
    6.     When 1 has been changed then calculate 4 new (Check is 2 existing then use 2, check is 2 + 3 existing then use 3)
    7.     When 2 or 3 has been changed quantity then also update quantity in 4
    8.     When 2 has been canceled then cancel 4, too
    9.     When 3 has an inbound delivery document no. in place then copy the same no. in the inbound delivery field 4 and in the new column in MRP (MD04, see MRP view below)
    i have a lot of confuseging in this lines of code,even where u write i don't know in BADI . we are implement in BADI only.
    if possiable give me code for this requriment. . this line of code in which method we write,please guide me.............

    SDN is not your code factory, please research yourself before posting, maybe ask whoever handed you this requirement?
    Thread locked.
    Thomas

  • Get the COI date based on I base number and component number

    Hi Experts,
    I have get the COI date based on the Ibase number and component.
    Please suggest me is there any FM available.
    Thnx,
    Sam.

    Hi Sam,
    You mean to say u want to get the associated person to that Partner.
    Which we define as Role type in CRM.
    Say a person ABC is having a team lead XYZ , then you can use the table BUT050 and give the relation ship type key value
    Partner ABC must be associated with Team Lead XYZ with some BP Role.
    Ask it from your fucntional and use a select query to get that Team Lead name.
    Hope this helps

  • Need to calculate the monthly amount based to the annaul salary

    Hi Expert,
    I need to calculate the monthly amount based to the annual salary.
    Some countries use a multiplier more than 12 to calculate the annual salary (e.g : 13,14 ...).
    My problem is to calculate the monthly increase.
    The increase amount is on the annual salary but for the monthly increase, normally, the system divides by the mutliplier.
    But some countries would like calculate these amount on 12 and not the real multiplier.
    So, could you please tell me there are user-exits or other to make this ???
    Thanks in advance,
    Virginie

    Hi Virginie,
    Check both feature PFREQ (Edit with transaction PE03) and user-exit corresponding to enhancement PARA0001.
    rgds,
    Carlos.

  • Payment terms should calculate Payment due date based on working days

    Hi Experts,
    As we know that standard SAP calculates Payment due date= base line date + number of days maintained in payment terms. In this payment days are considered as calendar days and not the working days.
    Example: If base line date is Thursday, payment terms says 3 days then payment due date is calculated as Sunday ( which is not a working day as per the factory calendar I use). The requirement is that payment date should be calculated as following Tuesday considering Satuarday and Sunday are not working days as per the calendar.
    Can you please suggest how can we achieve this?
    Thanks,
    Ravi

    You can not acheive from config pooint of view but you can use BADI and get the solution
    use BAdI MRM_PAYMENT_TERMS to set terms of payment
    You can use this Business Add-In to change the following fields for the 
    terms of payment in the invoice document header:                        
    o  ZFBDT: Base date for due date calculation                            
    o  ZBD1T: Discount days 1                                               
    o  ZBD1P: Discount percentage 1                                         
    o  ZBD2T: Discount days 2                                               
    o  ZBD2P: Discount percentage 2                                         
    o  ZBD3T: Deadline for net condition                                    
    o  ZLSPR: Key for payment block

  • System does not propose the delivery date based on factory calendar

    Hi,
    I am creating a sales order for a delivery date for this sat which is (2/22/09)
    I have maintained 2 separate calendars for
    1) shipping point
    2) for the route
    The route has a transit time of 1 day and the calendar has sat and sunday as non working.
    the Shipping point has a pick/pack time of 1 day and the calendar has sat and sunday as non working
    The material is available in the warehouse
    Now when i create this sales order i enter the delivery date as 2/22/09, the system does not propose me the delivery date of monday (i.e 2/23/09) It accepts the 2/22/09 delivery date.
    In the schedule line i do see the date as 2/22/09 only.
    The delivery was created with the following dates
    Picking = 2/17/09
    Transportation Planning = 02/18/2009
    Loading =02/18/2009 
    Planned GI= 02/18/2009
    Delivery Date = 02/22/2009
    How can the system give me the delivery date of a sunday when the calendar doesnt allow sunday as working day.
    Also the route time is 1 day in transit so i am not sure why the system is proposing a 3 day transit time?
    Can any one explain the behaviour of SAP for the delivery date logic

    Dspsac,
    Delivery date can be any date.  For instance, if your customer insisted on a Sunday delivery, you would accommodate him, regardless of any calendar.
    From the delivery date, the system counts backwards USING THE FACTORY CALENDAR ASSIGNED TO THE ROUTE by the number of days in the route.  You have to consult the FC assigned to your Route to determine if the GI date has been properly calculated.
    From the GI date, the system counts backward Pick/pack time, using the shipping point calendar, to arrive at Material availability date.
    Calculations are explained in SAP online help
    [Transportation and Delivery Scheduling|http://help.sap.com/erp2005_ehp_04/helpdata/EN/dd/5607e7545a11d1a7020000e829fd11/frameset.htm]
    Regards,
    DB49

  • Overriding the default "date-based" restrictions in time reporting

    Hi all.
    When using CATS/ESS for reporting time on tasks / roles there are some built in date based rules which limits when time reporting is possible.
    The cProjects 4.5 (SP05) help describes this as follows for a task-based set-up
    The system creates a worklist in CATS to enable you to record your time for a role or task. The system selects all objects (tasks, project roles, or project definitions) to which you are assigned in the confirmation time frame:
    If you set up confirmation via tasks, the worklist displays all tasks for confirmation to which your user is assigned by means of a role for the confirmation time frame and which have been released. For the confirmation time frame, the system first checks
    the time frame you specified on the Staffing tab page. Then it checks the time frame you specified in the Tasks Assigned to Selected Project Role group box on the Tasks tab page. If you only made entries on one of the tab pages, these apply.
    Put differently there is as I understand it a two-step check against the date that the user is trying to report on
    a) check against dates in staffing tab of role
    b) check against dates in the "tasks assigned to selected project role" tab of the role
    The requirement we are looking at now is to make this check a bit more loose.  An example could be to say that time reporting is OK as long as the dates lie within the projects scheduled dates.
    Any comments / experiences around this?  Possible?  I assume one would need to try to influence how the worklist is built up.
    Best regards / Anders

    Hi Anders,
    The building up the CATS worklist is done in two side, ERP system and cProject system. Regarding your requirment I think, the logic is done in cProject side, where the logic is hard coded and no Badi to enhance it.
    Please see my report in the Wiki to have more details:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=61926
    Kind regards,
    Zhenbo

  • Getting the Sunday dates using Next_Day

    The requirement is:
    Get the Sunday of this week and Sunday of the last week. As system date is 02-July, this Sunday is 01-July and last week Sunday is 24-Jun. If say suppose the system date is 01-July, then this Sunday should be 24-Jun and last Sunday should be 17-Jun. I tried something like :
    Select
    Next_Day(sysdate-8,'SUNDAY') sunday,
    Next_Day(sysdate,'SUNDAY') End_Sunday,
    To_Char(Next_Day(sysdate-8,'SUNDAY'),'YYYYMMDD') sun_mm,
    1 Fl
    From
    Dual
    Union
    Select
    Next_Day(sysdate-16,'SUNDAY') sunday,
    Next_Day(sysdate-16,'SUNDAY')+7 End_Sunday,
    To_Char(Next_Day(sysdate-16,'SUNDAY'),'YYYYMMDD') sun_mm,
    2 Fl
    From
    Dual
    I know the above doesn't work due to -16. Need some help in meeting the requirement.
    Thanks
    Chaitanya.S.S.K

    Micheals,
    this?
    SQL> alter session set nls_territory=germany;
    Session altered.
    SQL>  WITH t AS  ( SELECT SYSDATE AS DT FROM dual
      2               UNION ALL
      3       SELECT TO_DATE('07/01/2007','MM/DD/YYYY') FROM dual
      4         UNION ALL
      5       SELECT TO_DATE('07/02/2007','MM/DD/YYYY') FROM dual
      6       UNION ALL
      7       SELECT TO_DATE('06/30/2007','MM/DD/YYYY') FROM dual)
      8   SELECT DT, CASE WHEN TO_CHAR(DT,'DY')='SUN' THEN
      9                       TRUNC(dt,'d')-7
    10       ELSE 
    11           TRUNC(dt,'d')
    12       END last_sunday
    13   FROM  t;
    DT       LAST_SUN
    03.07.07 02.07.07
    01.07.07 18.06.07
    02.07.07 02.07.07
    30.06.07 25.06.07
    SQL> alter session set nls_territory=america;
    Session altered.
    SQL>  WITH t AS  ( SELECT SYSDATE AS DT FROM dual
      2               UNION ALL
      3       SELECT TO_DATE('07/01/2007','MM/DD/YYYY') FROM dual
      4         UNION ALL
      5       SELECT TO_DATE('07/02/2007','MM/DD/YYYY') FROM dual
      6       UNION ALL
      7       SELECT TO_DATE('06/30/2007','MM/DD/YYYY') FROM dual)
      8   SELECT DT, CASE WHEN TO_CHAR(DT,'DY')='SUN' THEN
      9                       TRUNC(dt,'d')-7
    10       ELSE 
    11           TRUNC(dt,'d')
    12       END last_sunday
    13   FROM  t;
    DT        LAST_SUND
    03-JUL-07 01-JUL-07
    01-JUL-07 24-JUN-07
    02-JUL-07 01-JUL-07
    30-JUN-07 24-JUN-07

  • Calculate depreciation start date based on user defined field in asset

    Hi,
    I have a specific scenario where the start of depreciation date for asset needs to be calculated on user-specific logic.There is a additional field "installation date" in asset master screens.The requirement is that for depreciation areas 10 and 11 user wants that the depreciation start date to be calculated on the installation date rather than capitalization date.
    I tried using the exit AMAV0001 where we can change the asset value date which determines the depreciation date at the time of first acquistion to asset.But the problem is we can't change it as per depreciation area wise and thats why posting error was coming.
    Please suggest if any idea on this.
    Thanks in advance.

    Hi Adriano,
    in your example 2 issues influence the described behaviour:
    1) In your example the revaluation occurs in the capitalization year, in which all acquisitions (and revaluations) are managed under the period for the first acquisition. Only as of the year following the capitalization year the period control "pro rata" would really consider the revaluation or another acquistion as of period 4. In case you want the period control also being considered according to the posting period in the capitalization year, set the indicator XBZDAT with the correction report from note  92925.
    That should solve your issue.
    2) In case you use the new depreciation calculation engine you have the possibility to use individual period controls for revaluation also. This means you could specify period control for acquisitions as "pro rata" and for revaluations "next month". To realize this create a new transaction type for revalutions as described in note 1138166 . Unfortunately this feature is not possible with the old depreciation calculation engine.
    Regards,
    Markus

  • SCAL calculate the holiday date.

    Hoy,
    I want a create a new factory calendar where the first 5 days of every month are a holiday.
    But I'm a little bit lazily, because I don't want to maintain this calendar every year.
    Is it possible to calculate the holiday with a abap-function ??
    Some kind of dynamic holiday …
    Greetings, Dirk

    Hoy,
    I want a create a new factory calendar where the first 5 days of every month are a holiday.
    But I'm a little bit lazily, because I don't want to maintain this calendar every year.
    Is it possible to calculate the holiday with a abap-function ??
    Some kind of dynamic holiday …
    Greetings, Dirk

  • How do i export the table data based on some condition for backup

    Is is syntax correct
    exp scott@orcl92 file=emp_29aug.dmp tables=emp
    query=\"where emp_no in (1,2,3,4) \".
    How do i take the backup of more than one table?
    what is the syntax for that
    Thans

    Thanks for your response
    If i want to add more than one condition in the query, then how do i do that
    exp scott/tiger@orcl file=scott.dmp tables=(emp, dept) query=\"where deptno = 30\" and emp_no in (1,2,3,4);
    how do i do that

  • Need a FM for gettng starting & ending date based on the settlement period

    Hi,
    I have to filter a database table based on the settlement period( IDENT3 ) and the field available is of date field. Can anyone give me a function module by which can calculate the starting date and ending date by providing the settlement period ( eg. AM- Monthly, AQ- Quarterly, AJ- Annually,  etc ) and date.
    Thanx in advance.
    Regards,
    Sumanth.

    Hi Sumanth,
    Please use the function module 'DATE_CONVERT_TO_FACTORYDATE' to get the start date and end date for the particular factory calender.
    For end date:
    CORRECT_OPTION                  +
    DATE                                       sy-datum
    FACTORY_CALENDAR_ID        Aq(quaterly)
    For start date:
    CORRECT_OPTION                  -
    DATE                                       sy-datum
    FACTORY_CALENDAR_ID        Aq(quaterly)
    According to sy-datum, it will calculate the Extreme  interval .
    Thanx,
    Zenthil.

Maybe you are looking for