Code for the the previous Sat and Sat four weeks prior based on todays date

Hi All...
I am looking for a bit of code to work out the following  in a variable customer exit...)
Based on system (todays) date calculate the actual calendar day for
1. the last previous Saturday
2. the Saturday 4 weeks prior to 1.
i.e  todays date is for instance 12th September 2011 then results code needs to produce is
1. 10/09/2011
2. 13/08/2011
Thanks in advance,
Steve;)

Hi Steve,
You can follow the logic below:
data:
l_date like sy-datum, **TODAY
l_date2 like sy-datum, **First Saturday
l_date3 like sy-datum. **Saturday 4 weeks before
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 3 days for the first saturday
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 3
IMPORTING
ed_date = l_date2.
-Subtract 31 days for the saturday 4 weeks before
CALL FUNCTION 'HR_SEN_CALE_DAYS_DATE'
EXPORTING
id_date = l_date
id-operator = '-'
is_duration = 32
IMPORTING
ed_date = l_date23.
*If it is Tuesday
WHEN 2.
.... -> Like monday
*If it is Wednesday
WHEN 3.
*If it is Thursday
WHEN 4.
*If it is Friday
WHEN 5.
*If it is Saturday
WHEN 6.
*If it is Sunday
WHEN 7.
ENDCASE.
Regards,
Dilek

Similar Messages

  • Plugged iPhone 5 in for the first time and it freezes iTunes.  Everything up-to-date.  Any ideas?

    I've connected the new iPhone 5 numerous times.  After restarting both devices.  Updating everything.  I even connected the old iPhone 4 and it works fine.  My computer recognizes the iPhone 5 every time it is connected.  iTunes will freeze right away most of the time when the iPhone 5 is connected, however sometimes I can get to the point to where I can sync the phone.  The sync will proceed for a while, however it either freeze iTunes or show a fail message.  Anyone have any thoughts about or heard of this issue?

    This was the first time I had connected it to itunes as I put it on to charge while using my laptop and as I have an itunes account already it came up for me to register my phone so I clicked yes but not as a new iphone and it wiped off my photos etc....how can this happen when it didn't ask any questions other than register your iphone?

  • Adding asset in the previous period and depreciation run

    Hi Experts,
    I want to know whether we can add an asset for the previous period and run the depreciation.
    I will try explaining with an example.
    Let us say,I forgot to add an asset and i want to add an asset now with date as 1st July 2008. Is it possible? If it is possible will the system calculate the depreciation from July or will it calculate from the date the asset has been added?
    Please explain.
    Thanks,
    Sasidhar

    Hi
    It will allow you to add a new asset in the closed period with few conditions
    Since you have given in your example as july 2008, check whether your FI year is open. Then check the asset period whether its opened are closed
    If all the periods are not resticting you, you can go a head with adding an asset
    Your depreciation will be calculated from the date of purchasing, that means only the calculationg will happen from that period and not the accounting entry
    You will have only one planned depreciation from july to current period as per your example. So when your running the planned depreciation run for the current period, the entire depreciation will get posted now
    You can do repeat run only for one period prior to the current planned period and not at any prior period
    So with your example of july 2008, if your running AFAB monthly, repeat run may not work
    Warm Regards
    Bala

  • On my Macbook pro 15 2011, System Profiler is suggesting that it uses SATA III for the hard drive and SATA II for the Optical Drive.  Is that true?

    On my Macbook pro 15, 2011, System Profiler is suggesting that it uses SATA III for the hard drive and SATA II for the Optical Drive.  Is that true?

    That is correct. The tech specs indicate:
    Hard Drive Interface
    6.0 Gbps Serial ATA (SATA)
    Optical Drive Interface
    3.0 or 6.0 Gbps Serial ATA (SATA)

  • [svn:osmf:] 15581: Better coding style and some comments for the previous code submission.

    Revision: 15581
    Revision: 15581
    Author:   [email protected]
    Date:     2010-04-19 17:14:00 -0700 (Mon, 19 Apr 2010)
    Log Message:
    Better coding style and some comments for the previous code submission.
    Modified Paths:
        osmf/trunk/apps/samples/framework/OSMFPlayer/src/OSMFPlayer.as

    Revision: 15581
    Revision: 15581
    Author:   [email protected]
    Date:     2010-04-19 17:14:00 -0700 (Mon, 19 Apr 2010)
    Log Message:
    Better coding style and some comments for the previous code submission.
    Modified Paths:
        osmf/trunk/apps/samples/framework/OSMFPlayer/src/OSMFPlayer.as

  • Variance of Wagetype amounts  Report  for the previous and prest months

    Hi experts,
    our clients are wish to have the report of  Variance of Wagetypes for the Previous and Present months.
    we require the report on  new wagetypes included in the Current month along with amount and also any wagetypes deleted for the current month along with amount.We also need to have the Difference between previous gross amount and current months Gross.
    Is it possible to have the report on variation of amounts.
    Regards,
    V Sai.

    Hi,
    The quickest way is to use wage type reporter (transaction PC00_M99_CWTR, report H99CWTR0_CE).
    There you can specify two payroll periods and compare values by wage types, if necessary export result in Excel and do whatever you want.
    Cheers

  • I need help! i am trying to update iphoto on my macbook pro that i had bought from someone else. although i am signed into my account when trying to update it is asking me for the previous owners account details and it wont let me change it to my details

    i need help! i am trying to update iphoto on my macbook pro that i had bought from someone else. although i am signed into my account when trying to update it is asking me for the previous owners account details and it wont let me change it to my details how can i solve this problem please.
    thank you
    Jan Robinson

    That's because the Mac, OS X and the iLife apps that came preinstalled on the Mac all belong to the previous owner. The previous owner needs to call Apple care and have their Apple ID disassociated from the Mac. Then the hard drive needs to be totally erased and OS X and the iLife apps reinstalled using OS X Recovery.

  • HT1414 My iPhone has crashed during a sync and now I can't restore from backup as it is asking for password to load the backup yet neither the lock code for the phone or my iTunes Password are working... I have no other password to all upon and need the r

    My iPhone has crashed during a sync and now I can't restore from backup as it is asking for password to load the backup yet neither the lock code for the phone or my iTunes Password are working... I have no other password to call upon and need the restore to retrieve info onto my phone, I am a real novice to this...... please help, !!!!

    If anyone else is looking for a solution to this same problem, I was able to get it working looking through several older discussions.
    The solution was to use the password that I had on my iTunes account the very first time I set up the iPhone about a year ago.  I changed my iTunes password about 10 months ago;  but apparently, the backups continue to use the password that existed when the phone was first set up.
    A couple of troubling things with this are that 1) I didn't apply a password when I did the backup this afternoon so I don't understand why it was required when I did the restore a few hours later. and 2) it makes zero sense why iTunes would not be smart enough to use the current accout password when requiring the password to restore from a backup made with no password. 
    I thought iTunes and Apple were smarter than that.  With so many posts stating exactly the same problem, it is clear that this is bug in the software. 
    Best,
    Craig

  • Streamlining the code for the button group with individual links and rollover imgs

    I am looking for a solution to streamline the code for the array of 20+  buttons located inside the scroll pane.
    I know I can make an array if all the buttons would have a unified code executable change, i.e. they would become larger and brighter.
    My problem is that each button represents an product image in the lights off stage, then of rollover it is a lights on stage so I have to import two images in the on and off stage and play around with the opacity.
    Additional problem is that each button has to ling to a different label.
    My question is: is it possible to unify the code if buttons have that much individuality or I have to make each one of them as in the example below.
    // makes a hand cursor appear over a mc acting as a button for all the buttons inside the scrollpnaeBckgrnd_mc.scrollpaneBckgrnd_btns_mc.
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.buttonMode = true;
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.useHandCursor = true;
    ///////////////INDIVIDUAL BUTTONS
              MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLyte _btn.FloraLyte_ON.alpha = 0;
                        var  FloraLyte_btn_Tween:TweenLite = TweenLite.to(MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.F loraLyte_btn.FloraLyte_ON, .5, {alpha:1, paused:true});
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLyte_btn.addEventListener(MouseEvent.ROLL_OVER, overHandler_FloraLyte_btn);
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLyte_btn.addEventListener(MouseEvent.ROLL_OUT, outHandler_FloraLyte_btn);
            MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLyte_btn. addEventListener(MouseEvent.CLICK, onClick_floralytePopUp);
                      function onClick_floralytePopUp(event:MouseEvent) :void {
                                            gotoAndPlay("floralytepp");
    function overHandler_FloraLyte_btn(e:MouseEvent):void{
             FloraLyte_btn_Tween.play();
             trace("you rolled over me");
    function outHandler_FloraLyte_btn(e:MouseEvent):void{
             FloraLyte_btn_Tween.reverse();
             trace("you rolled off me");
    MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLytell_btn .FloraLytell_ON.alpha = 0;
                        var  myTween:TweenLite = TweenLite.to(MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.F loraLytell_btn.FloraLytell_ON, .5, {alpha:1, paused:true});
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLytell_btn.addEventListener(MouseEvent.ROLL_OVER, overHandler);
                        MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.Flor aLytell_btn.addEventListener(MouseEvent.ROLL_OUT, outHandler);
            MovieClip(mc_pane2.content).scrollpaneBckgrnd_mc.scrollpaneBckgrnd_btns_mc.FloraLytell_bt n.addEventListener(MouseEvent.CLICK, onClick_floralytellPopUp);
                      function onClick_floralytellPopUp(event:MouseEvent) :void {
                                            gotoAndPlay("floralyte2pp");
              function overHandler(e:MouseEvent):void{
             myTween.play();
             trace("you rolled over me");
              function outHandler(e:MouseEvent):void{
             myTween.reverse();
             trace("you rolled off me");

    as ned suggested, plan your flow and code into it. here is one example:
    var buttonArray = [someButton, someOtherButton, aDifferentButton];
    for(var i = 0; i < buttonArray.length; i++){
         //get reference to county movieclip
         var mc = buttonArray[i];
         //then add listeners
         mc.addEventListener(MouseEvent.ROLL_OVER, overMe);
    function overMe(e:MouseEvent){
         var mc = e.target;
         switch(mc){
              case: someButton:
                       someOtherButton:   doThis();
                                                     break;
              case: aDifferentButton:     doThat();
                                                     break;
              default:                            //do nothing;
                                                     break;
    function doThis(){
         trace("do this")
    function doThat(){
         trace("do that")

  • Compare previous row values for the same id and decide

    Hello ,
    I have this sample data
    create table #student_academic
    pk_id int identity(1,1) primary key ,
    student_id int ,
    [year] int,
    [aggr_marks] float
    insert into #student_academic
    student_id ,
    [year] ,
    [aggr_marks]
    values
    (112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
    (112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
    (112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
    select * from #student_academic
    from the above data i have to generate an extra status column. this status column should be decided by comparing the previous row value. the exact output should be like below.
    student_id year aggr_marks Staus----------------------------------------------------------
    112 2012 55.4 None
    112 2013 75.4 Promoted
    112 2014 61.2 Demoted
    113 2012 95.2 None
    113 2013 75.6 Demoted
    113 2014 91.22 Promoted
    113 2012 45.45 None
    113 2013 65.4 Promoted
    113 2014 82.32 Promoted
    is there any way to write the t-sql with out using cursors ? this table has around 25GB of data. Any idea would be appreciated.
    Thanks in advance.

    Hello,
    The difficulty of your example is
    that there are several rows for
    the same year and the same student.
    I present a solution
    if there is
    one line per year per
    student:
    TRUNCATE TABLE #student_academicinsert into #student_academic
    student_id ,
    [year] ,
    [aggr_marks]
    values
    (112,2012,55.4),(113,2012,65.4),(114,2012,82.32),
    (112,2013,75.4),(113,2013,91.22),(114,2013,45.45),
    (112,2014,61.2),(113,2014,95.2),(114,2014,75.6)
    Go
    WITH CTE AS
    (SELECT pk_id, student_id, year, aggr_marks,
    (SELECT TOP 1 aggr_marks FROM #student_academic AS b
    WHERE a.student_id = b.student_id AND a.year -1 = b.year
    ORDER BY student_id) AS prev_aggr_marks
    FROM #student_academic AS a
    SELECT
    pk_id, student_id, year, aggr_marks,
    CASE
    WHEN prev_aggr_marks IS NULL THEN 'None'
    WHEN aggr_marks < prev_aggr_marks THEN 'Demoted'
    WHEN aggr_marks >= prev_aggr_marks THEN 'Promoted'
    END AS Status
    FROM CTE
    ORDER BY student_id, year
    Regards,
    Charlie
    Charlie Dancoisne - Independent Consultant & Trainer (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable. This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • Hey I bought an iPhone off gumtree and everything was well. But then I tried to set it up and it asked for the apple if of the previous owner and so I asked him for it his Apple ID but refused to tell me so I can not use the phone. how do I fix this?

    Hey I bought an iPhone off gumtree and everything was well. But then I tried to set it up and it asked for the apple if of the previous owner and so I asked him for it his Apple ID but refused to tell me so I can not use the phone. how do I fix this?

    Contact them back and have them follow these instructions  Find My iPhone Activation Lock: Removing a device from a previous owner’s account - Apple Support

  • I scratched the label off on a £25 gift card and it removed the code. How can I get the code for the card?

    I scratched the label off on a £25 gift card and it removed the code. How can I get the code for the card?

    Click here and request assistance. Gift cards are usually if not always final sale because it would be easy enough for someone dishonest to abuse returns or replacements of them.
    (58640)

  • Delete the previous administrator and make a user account for myself on my iMac G4

    delete the previous administrator and make a user account for myself on my iMac G4

    Open the Accounts pane of System Preferences, create the new account, log in with it, and delete the existing one. If the computer's one you've recently purchased, you may want to erase the drive and install a new OS; do this only if you have the computer's original disks or a retail package compatible with it.
    (64808)

  • 48 Hours ago I started to upgrade to Mtn Lion on a now 10 day old IMac - 30 minutes ago I got the email with the content code and redeem code for the download from the app store - it said download was happening, but nothing happened for 30 min - FIX IT!

    48 Hours ago I started to upgrade to Mountain Lion on a now 10 day old IMac - 30 minutes ago I got the email with the content code and redeem code for the download from the app store - it said download was happening, but nothing happened for 30 min - HOW DO I (or you) FIX IT!?

    This is a User's Forum, yelling at us won't help. You have 90 days of customer support via telephone. Use them as they can interact with their system and hopefully get you back on track. Otherwise take it to them at the Genius Bar and have them make it good.

  • I create an id. on review option when i enter visa card and security code, it always gives an error msg "Invalid Secruity code". but i use this code for money withdraw from ATM and for shopping also. plz tell the solution ????

    i create an id. on review option when i enter visa card and security code, it always gives an error msg "Invalid Secruity code". but i use this code for money withdraw from ATM and for shopping also. plz tell the solution ????

    The code they are asking for is the last three digits of the number on the back of the card (you don't use this when using an ATM or presenting the card in shops).

Maybe you are looking for

  • What's the best way to move thousands of files?

    I'm working on a script that renames and moves potentially thousands of files at a time. It's meant to process photo timelapses and separate bracketed exposures. The first part of my script works very well. tell application "Finder" to set firstSetCh

  • Getting HWND to Swing component with C++ as main

    I've ran into another issue with the Native interface , it occurs when mixing it with JNI. Anyone know why the class load fails on the Native Invocatuon side if I include a JNI call on the Java side?? Here's the sequence 1 .Main.cpp -> 2 . MainNative

  • How to specify that a generic type should implement cloneable ?

    Hi everybody, I created a map type called StringMap as such class StringMap<V>{ HashMap<String,V> map; and now, I want to implement the method clone() in my StringMap, for that I would like to use the method V.clone() but I get an error saying "The m

  • Re-Defining Variables

    Hi I am trying to make a math model for the cooling of an object for my Java class. My assignment was: The loss of heat from a hot object depends upon the difference in temperature between the object and the air. An equation for this, to be plotted r

  • Can't reinstall 6300 firmware

    Hello, my phone is rebooting about every minute (blank screen and again normal). I went to Nokia service and they reinstalled the phone's firmware and evertyhing was allright, but i played with a large mount of sms with this phone and this problem ca