Formula for finding specific date in a Current Year

Hello ,
Can get  a formula which i can use in variable to find date having first  Thursday in a current Year.
So in case of Current Year i.e 2014 , Formula should return date as "01/02/2014"(mm/dd/yyyy)
Thanks & Regards
Gourav Joshi

Hi Gourav Joshi,
Create a variable as per below. it will give you "First Thursday" of the year.
First_Thursday=
If(DayNumberOfWeek(RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-1)))=1) Then RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-4)) Else
If (DayNumberOfWeek(RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-1)))=2) Then RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-3)) Else
If (DayNumberOfWeek(RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-1)))=3) Then RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-2)) Else
If (DayNumberOfWeek(RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-1)))=5) Then RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())+6)) Else
If (DayNumberOfWeek(RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-1)))=6) Then RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())+5)) Else
If (DayNumberOfWeek(RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-1)))=7) Then RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())+4)) Else
RelativeDate(CurrentDate();-(DayNumberOfYear(CurrentDate())-1))
It will help you.
Regards,
Anish

Similar Messages

  • How to find last  date of the current year

    Hi
    Please tell me is there any function module to find out the last date of the current year.

    Hi,
    You can do that very simply like so.
    code
    report zrich_0001.
    data: first type sy-datum.
    data: last type sy-datum.
    first = sy-datum.
    first+4(4) = '0101'.
    last = sy-datum.
    last+4(4) = '1231'.
    write:/ first, last.
    [/code]
    OR use function modules
    1.use this function module HR_GB_TAX_YEAR_DATES
    Pass these values
    P08_TXYEAR = Year
    P08_PAYROLL_AREA = '01'
    2.use FM......... FIRST_AND_LAST_DAY_IN_YEAR_GET
    DATA: first LIKE sy-datum,
    last LIKE sy-datum.
    CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
    EXPORTING
    i_gjahr = '2007'
    i_periv = '24'
    IMPORTING
    e_first_day = first
    e_last_day = last.
    WRITE: / 'First Date', first, ' Last Date', last.
    Regards,
    Raj.

  • Sync with Outlook ONLY for a specific date range

    I have a Zire 31 that I'm syncing with Outlook via latest Palm Desktop/HotSync.   I did just install the latest conduit.
    I was getting several repeating calendar entries that were not syncing with the Zire (annual birthdays, etc.) - turns out that they did not have an "end-date" specified when created in Outlook.  Creating an end-date solved the problem.
    However - I would like to know if it is possible to specify a certain date range for the device to sync (e.g., sync calendar only for years 2007 through 2050, or in other words sync from 1 year ago to 50 years in future, etc...)
    I recall specifying this once years ago, but I may have been using a third party to sync with Lotus Notes at the time.  I'm wondering if this option is also available with syncing directly with Outlook using HotSync???  I can't imagine it's not, but I can't find where you specify it.
    One more interesting note:  while my Zire 31 had issues syncing those repeating calendar entries - my much older HandSpring Visor Deluxe syncs them no problem!  Go figure.
    Thanks much -
    Post relates to: Zire 31

    I'm not actually looking to purge old items.
    Rather - I would like to ONLY sync calendar entries between a specified range of dates.  For example - ONLY sync for calendar entries between Jan 1 2007 and Jan 1, 2050.
    the problem is that I have some repeating entries (birthdays, etc.) that are set up in Outlook with no end date.  Apparently Palm/HotSync is having trouble syncing these (they don't show up at all - for any year.)
    One resolution is to apply an end-date for each repeating calendar entry.  However, this is just another step my wife needs to remember to do.  If you happen to forget to to this, then Hotsync will ignore that entry.  Fine if you realize that's happening, but if you forget and forget to check - you won't even know it didn't sync!
    The other possible resolution is to only have HotSync sync for a SPECIFIC date range - one that does not presumably go to infinity.  That is my question - how does one sync ONLY for a specific date range.  Has nothing to do with purging old entries.
    Thanks!!
    Post relates to: Zire 31

  • How to get users' login logout time for user IDs for a specific date?

    Dear All,
    There is a case I being requested to retrieve the Userid, User Name,
    User Group, User Dept, Date, Login Time, Logout Time in a specific date, for example, 21.05.2009.
    How should I retrieve the information? The user want to input specific date and user group then return the details that mentioned above.
    I try with SUIM->Users->By Logon Date and Password Change... but I can't specific the date that I want ...
    I try with SM19 (Security Audit Log), but unfortunately in my system this is not activated.
    I've seek for SAP's advise, and they say need to ask abaper to developr a report in order to get such details....
    Do you guys have any other methods?
    Do you guys know which tables will contain the details as mentioned above?
    Best Regards,
    Ken

    Unfortunately without the audit log, you're going have a hard time finding this information.  As mentioned, ST03N will give you some information.  If your systems daily workload aggregation goes back to the date you require then you'll be able to get a list of all users who logged on that day.  ST03N doesn't keep time stamps just response times.
    My only idea is VERY labor intensive.  If your DB admin can retrieve a save of the database from that day then table USR02 will hold a little more information for you.  It will contain last login times for that day.  If your system backup policy happened to have saved the contents of folder "/usr/sap/<SID>/<instance>/data" then you potentially have access to all the data you require.  The stat file will have recorded every transaction that took place during that day.  If that file is restored you could use program RSSTAT20 to query against it.
    Good luck and turn on the audit log as it makes your life much easier!

  • Custom Report for the Stock and Stock value for a specific date

    Hi SAP Gurus,
    Is there any SAP standard t-code or any logic to get the transcations (additions (for example: Purchases) and subtractions (Sales) to the inventory) for a particular materials in a plant and with Total Stock and also Total Stock value when that particular transaction happened?
    Our system is R/3 4.7
    I looked at the MB5B, MBCE, MBCA, MC44, MB51 and some other standard T-codes but could not find the total stock value at the time of Transaction happened.
    The history tables MBEWH and MARDH  are updated after the month end closing procedures, right, which means I will have the inventory value changing every month if material has Price "S".
    Thank you,
    -Harter

    Hi Harter,
    Unfortunately, you cannot see in a single tcode the value of stock and stock quantity on a specific date. As you yourself have pointed out, we only have to make use of the history table MBEWH, MARDH for the month wise stock quantity and value. Along with that you should also make use of the table MBEW to take teh stock quantity and value. So the total value of stock on a particular date will be
    Stock qnty = MBEWH value until the previous month (for teh specific valuation class, period etc) + MBEW value for the present date.
    But this will nto work out if you want to find out teh stock quantity and stock value on a past date basis. For past data, only  m onthwise data is available. For this anyway you can refer to MC.1 and so on reports.

  • Fox formula for actual/plan data  - Planning function

    Hello,
    I am working on the following scenarios for developing a  planning functions for a monthly forecast.
    It is rolling montly forcast where user starts the planning in Jan and he has to show the actaul value for the month of Jan and blank values for the remaining 11 months of the year and then the user post his new forecast values for the remain 11 of the year(to replace initial balnk values) so that the data will be saved to real time cube with version v108
    In Feb, Jan & Feb months has to show the act values and remaining 10 months has to show last month forecast data. The the user may revise the forecast for the 10 months and then we have to write the data to the real time cube with version v208
    In Mar, Jan, Feb and Mar has to show the actual values and the reamining 9 months has to show the last month forecast and then users may revise the forecast data and then i have to write back to the cube with version v308.
    I want to automate this process for all the months and all years without manual intervention. So, i decideed to write a fox formula for this scenario with following draft code.
    I will get the fy period & year as a variable values and then take the system date into the variable
    for each fy period
    if the fy perio <= sys date.
      {version, infoprovider,value type,amount} = {0,act cube, 10, 0amount)
    else
    {version, infoprovider,value type,amount} = {result,plan cube, 20, 0amount)
    endif.
    result will be calculated on the separe routine and populated here
    case (fy per)
    when 01.
    concatenate v1 with fy+2(2) into y
    result = v1+y
    when 02.
    concatenate v2 with fy+2(2) into y
    result = v2+y
    when 03.
    concatenate v3 with fy+2(2) into y
    result = v3+y
    when 04.
    concatenate v4 with fy+2(2) into y
    result = v4+y
    when 05.
    concatenate v5 with fy+2(2) into y
    result = v5+y
    when 06.
    concatenate v6 with fy+2(2) into y
    result = v6+y
    when 07.
    concatenate v7 with fy+2(2) into y
    result = v7+y
    etc...for all months
    So, can you please let me know the best way to implement this (either by fox formuls or exits)...your inputs are really appreciated
    Thanks,
    Srini
    Edited by: srini on Mar 28, 2008 12:05 PM

    Hi Srini,
    If I 've understood u r problem clearly ,You have to write two Fox Functions and you can call exit variable in both to check the system date.
    I think first you should create exit varriable which would return the system date,use the same variable in data slice to lock the data till current period.
    After that create one fox restricted with any one version where you can copy the data for planning .for example:-
    1)First Fox:-
    DATA TIM_FISCPER TYPE 0FISCPER.
    TIM_REF_FISCPER = VARV(ZEXIT_FPER).
    Get the last month
    version using modlue or any another logic .(v108)
    FOREACH TIM_FISCPER.
        IF TIM_FISCPER <= TIM_REF_FISCPER.
      {0amount,version(001) ,tim_fiscper} = {0amount,version(000) ,tim_fiscper}.
    else.
      {0amount,version(001) ,tim_fiscper} = {0amount,version(v108) ,tim_fiscper}.
         endfor.
    Its just n example use the granularity according to the requirement.
    2)Second fox would save the changed plan data:-
    DATA TIM_FISCPER TYPE 0FISCPER.
    TIM_REF_FISCPER = VARV(ZEXIT_FPER).
    Get the last month
    version using modlue or any another logic .(v208)
    FOREACH TIM_FISCPER.
        IF TIM_FISCPER > TIM_REF_FISCPER.
      {0amount,version(v208) ,tim_fiscper} = {0amount,version(001) ,tim_fiscper}.
         endfor.
    Here ZEXIT_FPER is an exit variable created using cmod and populated with system date.
    Hope it will helpful for u.
    Rgds,
    Indu

  • Looking for a specific data in all the cubes and ods

    Hi Gurus
    "i am looking for all the cubes/ods that contain a specific Controlling area(lets say 0123) and a specific 0plant (lets say plant 4567), now i can go down to every cube and ods and search for it in its contents but i have like hundereds of cubes it will take days, is there a simple way to look for some particular data in all the cubes/ods, and it tells me which cube/ods contains these plants and controlling area."
    <b>now based on this above post i got a reply that abaping can help.</b>
    "you could write an ABAP where you call for every InfoProvider function RSDRI_INFOPROV_READ_RFC like
    loop at <infoprov-table> assigning <wa>.
    call function 'RSDRI_INFOPROV_READ_RFC'
    exporting
    i_infoprov = <wa>
    tables
    i_t_sfc = i_t_rsdri_t_sfc
    i_t_range = l_t_rsdri_t_range
    e_t_rfcdata = l_t_rsdri_t_rfcdata
    exceptions
    illegal_input = 1
    illegal_input_sfc = 2
    illegal_input_sfk = 3
    illegal_input_range = 4
    illegal_input_tablesel = 5
    no_authorization = 6
    generation_error = 7
    illegal_download = 8
    illegal_tablename = 9
    illegal_resulttype = 10
    x_message = 11
    data_overflow = 12
    others = 13.
    endloop.
    i_t_sfc should contain 0PLANT and i_t_range the restriction on you plant value.
    with a describe table statement on l_t_rsdri_t_rfcdata you can get the hits.
    check test program RSDRI_INFOPROV_READ_DEMO for details
    best regards clemens "
    <b>now my question is how do  i use this code to check each and every cube in bw, it seems like it is meant to be for only one cube at a time. and what does he  mean by  "for every infoprovider function"</b>
    thanks

    THANKS

  • Count records for a specific date range

    Hi,
    I am using BI Publisher with Siebel 8.1.1.1. I have a monthly report where I want to count the number of service requests entered per customer per month.
    I am using the following expression that works for one month:
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d',psfn:getCanonicalDate(ssCreated), xdoxslt:current_date($_XDOLOCALE,$_XDOTIMEZONE), $_XDOLOCALE, $_XDOTIMEZONE) <=28])?>
    However, I want to be able to specify a specific date range for my count, i.e ssCreated >= '01/02/2011' and <= '28/02/2011', as opposed to count for the past 28 days. Can you please advise what syntax I can use to specify a date range?
    Any help will be greatly appreciated!
    Claire

    Hello,
    Many many thanks for your reply.
    I'm doing as you suggest and am using the date_diff to the end of the period in question. I've tried the following to get the number of Service Requests with Severity 1-Critical, created in Jan 2011, feb 2011:
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-01-31', $_XDOLOCALE, $_XDOTIMEZONE) <=31])?>
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-02-28', $_XDOLOCALE, $_XDOTIMEZONE) <=28])?>
    In my xml sample data that I'm using I have 2 service requests that mean the criteria for Jan, yet when I run my report I'm getting '0'. The problem seems to be with my end of period date '2011-01-31'. I've also tried with both start and end period date (using a negative value as per your suggestion), but I still get '0':
    <?count(ssServiceRequest[ssSeverity[.='1-Critical'] and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-01-01', $_XDOLOCALE, $_XDOTIMEZONE) <=-31 and xdoxslt:date_diff('d', (psfn:getCanonicalDate(ssCreated), $_XDOLOCALE, $_XDOTIMEZONE), '2011-01-31', $_XDOLOCALE, $_XDOTIMEZONE) <=31])?>
    Many thanks,
    Claire

  • CTS+ Configuration in PI 7.4 for SLD specific data

    Hello Guys,
    I am doing CTS+ configuration for PI System SLD Vesrion 7.4 to transport J2ee as well as SLD specific data through transports. My CTS server is Solman System.
    I have created a CTS user in Solman System and in PI NWA I have defined destination to point to Solman System. But i am running into several errors.
    Could anyone please help me what user authorization are required for CTS user in Solman to transfer Non-Abap Data and SLD specific data through transports.
    Its very urgent.

    Did you happen to see this document of a CTS+ configuration for 7.3 (should be fairly the same for 7.4)?   CTS+ Configuration for PI 7.3
    Steps 1.2 and 8.2 have references to roles.

  • A query to create sales information for a specific date.

    Hi,
    Please look at attached image, you will see how this query look like. This query will generate all sales from 1/1/2014 until today. I would like to see if the query can create the sales report for a range from 1/1/2014 until yesterday (does not included any sales for today). Any help will be appreciated.
    -Bill

    Hi Bill,
    The query attached looks like it is selecting results based on the salesorder name starting with the current year. As is written, it won't be able to filter out today.
    If you want to exclude today, you'll need to modify the current selectivity predicate for today to perhaps a BETWEEN predicate ( e.g. table.datefield BETWEEN '2014-01-01' and DATEADD(day,-1,GETDATE()) ) or add an exclusion predicate ( e.g. table.datefield <> DATEADD(day,-1,GETDATE()) ).
    Note that you'll need to have a field in the data that has the day. Your query does not have any schema information, and all it seemingly reveals is that a salesorder name starts with the current year.
    Hope this helps,
    Tyson

  • Formula for Find Row action

    Hi,
    Can anyone please advice how to write the formula to for "Find Row" action in the Table tool bar? If there are 1000 entries in the table the user should be able to search for his record. Please let me know.
    Thanks in advance.
    Thanks.
    Aditya.

    Hi Aditya
    I have used the Find Row action successfully before.  In my case I had an input field (Search_Table) and a push button in a form view that triggered the Find Row action.  I set "Apply To" to the table I want to search on and the "Validation Scope" to "Element".  My table had 2 columns - KEY_EXT and TEXT.
    I then used a search formula like the one below:
    CONTAINS ( @KEY_EXT , #ID[ACA4GI]@Search_Table ) OR CONTAINS ( @TEXT , #ID[ACA4GI]@Search_Table )
    I assume you can do the same for a table toolbar button...
    When you trigger the action it will select the first hit (row) but will not automatically scroll to make the row visible which would have been good!
    Hope this helps
    Adam

  • Formula for Service or Data base name in (Webi Rich client )

    Hi Exports:
    Iam using s/w  Sap bo 3.1 sp3  .
    Query:
             I need formula to find Service  which,  I am using in Bo
              Where as Deskop Intelligence formula is =”source”&<Database Name >
              I need in Rich Client formula .Could u plz help me
    Thanks ,
    Raghu

    Hi Sujitha,
    thanks for ur quick replay ,your answer was helpfull to me ,but query what iam looking is
    . I need to find service name in Report or formula for Service name
    Thaks&Regards,
    Raghunath

  • Formula for finding channel value

    Hi all,
    Assumption : Dat file containing time and acceleration value. NOw there are only two channles.  Channel 1 is time . Channel 2 is Acceleration.
    Step 1: Create two more channels. channel 3 and channel 4
    Step 2:  go to analysis and search in accleration channel where its value is reached 1.xxxxxxxx
    Step 3: Where ever it has reached 1.xxxxxxxx in accleration channel from that point in channel 3 and 4, Paste all the std values. Std values are in the attached excel file.
    How do i do this?? what is the formula or script to do this?
    Thanks in advance.
    Solved!
    Go to Solution.
    Attachments:
    curve linear final limits ECE-AIS.xls ‏91 KB
    Dat file.zip ‏38 KB

    Hi Brad,
    Thank you very much for working with my dat file. I posed the same question to my engineer. So many empty cells exist after copying 1587 values from excel files. but I wonder they use the same strategy for testing their dat file.
    Now I have to create a script for that. I have recored a script for that. I am sending it in attachment.
    1. After copying the values 1587 values from excel file to channel table , from the beginning, it gives report in 2nd attachment format. ( All 3 curves overlapp on each other)
    2. After copying the values 1587 values from excel file to channel table ( 3 and 4) , 5 or 6 rows before , where ever the acceleration value of 2nd channel has reached 1.xxxxxx , it gives report in 3rd attachment format. (expected report format)
    3. Now I have to create a script to generate report in the 2nd format. What are your comments on this?? Whether it is a correct metrhod of checking the correctness of a test or not?
    4. HOw will i make script more interactive(If possible)?
    Attachments:
    VBS.zip ‏4 KB
    When attached from beginning.JPG ‏179 KB
    WANTED RESULT FORMAT.JPG ‏158 KB

  • FSG - Need to find beginning balance value from current year

    Hi,
    Could any one help me please,
    i designed FSG report and the issue is we need to find the beginning balance form the current year
    and i do not know which amount type i should use in column set.
    maybe there is any way or workaround for this issue?
    example :
    when i run the report with parameter JUN-12, the XXX (beginning balance current year) = 5000
    and when i run the report with parameter SEP-12, the XXX (beginning balance current year) is still 5000
    thanks
    Lim Johny

    This is some of the worst SQL I have seen. The data element names change from table to table, and they violate ISO-11179 rules. We seldom use OUTER JOINs in a properly designed schema, we seldom need to worry about NULLs; we use COALESCE(), not ISNULL();
    we use CURRENT_TIMESTAMP, not getdate(), etc. 
    Did you know that nesting scalar subqueries will screw any hope of optimization? The changes in the formatting of program text implies that many different, inexperienced younger programmers who wrote in many different non-SQL languages. You even posted in colors,
    like grade school! 
    My guess is that everyone wrote a query without any planning, and then threw them together in one pile. 
    It seems that this nightmare has three tables and we have no DDL or other specs:
     Stock 
     Stock_Lead_Times 
     Traces
    Want to follow Netiquette and post DDL with some specs? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Need a formula for 12 months data, 6 months data and 3 month

    Hi All Crystal Experts,
    In my report, data is grouped by months and I have monthly view of data. I have three prompts- Year, Startdate and Enddate. If I give 2013 as year, 1/1/2013 as start date and 05/01/2013 as end date then report shows monthly view of data for Jan-13, feb-13, Mar13, Apr-13 and May-13. Now in report, for each month, I want three additional columns, I want to show last 12month, 6 month and 3 months view. Like for Jan-13 month, in column 6 months, I want to show data for last 5 months including current month i.e. Jan-13+Dec-12+Nov-12+Oct-12+Sep-12+Aug-12 and in Column 12months view, I want to show accumulated data of last 11 months(+ current month) and in 3 months view, data for last 2 months(+ current month).
    I had tried creating Sub report for 12 months view and created Running total formula  but it is not showing any value in report. It is blank. I have created running total like this way:
    (1) "Running total formula" (which I am using and placing on group footer):
    (I) Field to summarize- @Cash_total
    (ii) Evaluate (use a formula):
    WhilePrintingRecords;
    NumberVar Cash_total_12 months;
    If Month ({@Month_PostDate}) In [(Month {?StartPostDate} - 11) to Month
    {?StartPostDate}] Then
       Cash_total_12 months :=  Cash_total_12 months + {@Cash_Total};
    (iii) Reset (use a formula):
    WhilePrintingRecords;
    NumberVar Cash_total_12 months=0;
    When I placed this formula in group footer, it is showing nothing.
    Please suggest me formula. Quick help would be much appreciated.
    Thanks,

    Hi Remi,
    Please do not post multiple threads for the same issue.
    Continue discussion on this thread:
    How to calculate last 12 months, 6 months, 3 months data in report
    -Abhilash

Maybe you are looking for

  • My old computer crashed and I cannot find the music i previously had on itunes, have I lost it all?

    Hello  My Old computer crashed and I have a new computer.    I found itunes and signed in to my acccount,  However I don't see any of my music I had loaded onto it or any music I had previously on my playlists  Have I lost it all?

  • Motion Judder in MAC 10,1,85,3

    Hello. I was attempting to watch the LIVE F1 Grand Prix feed from the BBC and the player was jumping around like it was cooking popcorn Audio was fine but the picture was unwatchable. When I went back to the site the video ran for a little while (a r

  • No item category exists (Table T184L HOD V)

    Hi, When I'm trying to reverse a goods receipt for a PO I'm getting the error as follows. No item category exists (Table T184L HOD V) Message no. VL320 Diagnosis There is no item category available in item category determination in the delivery (tabl

  • How many people like iCloud? I sure do NOT!

    Here is how this disaster began. My mom and I share the same Apple account because we didn't feel the need to set up a different account before iCloud came into the business. I set up iCloud on my phone first, and it changed nothing. I had no idea ho

  • IMovie quit unexpectedly during export

    I created a movie on iMovie but when I try to export it iMovie unexpectedly closes.  therefore I am not able to export it to share or put onto a DVD.  does anyone know hoe to fix this problem?