Code to derive previous calender month based on System date

Hi Exerts,
I have a requirement to derive 0calmonth ( mmm.yyyy ) from System date in the update rule..in BW 3.5
Can anyone post the code please? We need to consider 1st day of the year tooo..
Thanks,
DV
Please do not dump your ABAP requirements here
Edited by: Pravender on Mar 16, 2011 5:32 PM

have a look at function module RSARCH_DATE_CONVERT

Similar Messages

  • Deriving previous Fiscal Period based on current date

    Hi All,
    I have a requirement wherein I need to derive the previous fiscal period based on the current date. Is there any standard FM to get the same? If not can you let me know if there is any other way of deriving it?
    Thanks
    Sundar

    Hi Srinivas, thanks for your reply. What you have suggested will work fine if I am looking for current fiscal period. I want previous fiscal period. How do I get that?
    Thanks
    Sundar

  • Calculate number of days based on System Date and a date column!

    Hi everyone,
    I have a query to run a report where the results has a column named “Due Date” which holds a date value based on the project submission date.
    Now, I need to add 4 columns named, “45 Days Expectant”, “30 Days Overdue”, “60 Days Overdue” and “90 Days Overdue”.
    I need to do a calculation based on the “Due Date” and “System (I mean default computer date) Date” that if “System Date” is 45 days+ to “Due Date” than put “Yes” in “45 Days Expectant” row.
    Also, if “Due Date” is less than or equal to system date by 30 days, put “Yes” in “30 Days Overdue” and same for the 60 and 90 days.
    For example the output should be like:
    Is this possible? Can someone help me how to write this Case Statement please? I have some answers how to do it in SSRS (Report Designer) but I want to get the results using T-SQL...Thanks heaps...cheers...
    artistdedigital

    Hi Jay,
    Thanks but those dates are just a reference. The actual table contains hundreds of date rows... so I guess this technique will not work (not sure though)...
    I am quite cool with this bit:
    select duedate,
    case when days > -45 and days < 0 then 'YES' else '' end as '45 Days Expectant',
    case when days between 30 and 60 then 'YES' else '' end as '30 Days overdue',
    case when days between 60 and 90 then 'YES' else '' end as '60 Days overdue',
    case when days > 90 then 'YES' else '' end as '90 Days overdue'
    from cte--------------------------------------------------------------------------------------------------But can you please explain this bit a more? Thanks for being so prompt though : )declare @tab table (duedate datetime)
    insert @tab select '04/25/2014'
    insert @tab select '02/10/2014'
    insert @tab select '01/10/2014'
    insert @tab select '12/10/2013'
    ;with cte
    as
    select duedate,datediff(dd,duedate,getdate()) as days
    from @tab
    artistdedigital

  • Customer exit code for fiscalyear period based on system date

    Hi Experts,
    Please provide customer exit code for fiscalyear period derive based sy-datum. Fiscal year period derivie current to previous 12 periods and current to fast 12 periods.
    Thanks,
    Subbaraju

    Hi Subbaraju,
    Please use below customer exit code for your solution. Please define declarations as per requirement.
    When 'ZFPERIOD'.
    IF I_STEP = 2.
    ztoday = sy-datum.
    zfast = sy-datum + 365.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
      EXPORTING
        i_date               =  ztoday
        i_periv              = 'K4'
    IMPORTING
       E_BUPER              = PERIOD2
       E_GJAHR              = YEAR2.
    CONCATENATE YEAR2 PERIOD2 INTO FISCPERLOW.
    CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
      EXPORTING
        i_date               =  zfast
        i_periv              = 'K4'
    IMPORTING
       E_BUPER              = PERIOD2
       E_GJAHR              = YEAR2.
    CONCATENATE YEAR2 PERIOD2 INTO FISCPERHI.
    L_S_RANGE-LOW = FISCPERLOW.
    L_S_RANGE-HIGH = FISCPERHI.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDIF.
    Similar code user for your previous periods also.
    Thanks,
    Chandra

  • What is the best way to dynamically create table partition by year and month based on a date column?

    Hi,
    I have a huge table and it will keep growing. I have a date column in this table and thought of partition the table by year and month. Can any you suggest better approach so that partition will create automatically for new data also along with the existing
    data? Nothing but automatically/dynamically partition should create along with file group and partition files.
    Thanks in advance!
    Palash 

    Also this one
    http://weblogs.sqlteam.com/dang/archive/2008/08/30/Sliding-Window-Table-Partitioning.aspx
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to Group Invoce Qualtity in SD by Month based on Billing Date

    Hi,
    I have Invoice quantity in a cube whcih I want to group monthwise.
    For example :
    Material            Billing Date        Invoiced Quantity
    Material 1        Jan-15,2007         100
    Material 1        Jan-20,2007           50
    Material 1        Jan 23,2007           10
    Material 2        Jan 14,2007           70
    Material 2         Jan 10, 2007         10
    In the Report, I want to show it as
    Material 1         Jan-2007             160
    Material 2         Jan-2007               80
    How do I do this. How can I group the Material like this in the report.
    Any suggestions are really appreciated.
    Thanks

    Arvind,
    Hopefully i understood your requirement correctly.
    What you need to do is to add the infoobject 0calmonth to your Infoprovider, and write the update rules to transform your date to 0calmonth.
    Then change your query to display material and 0calmonth in the rows, and the trick will be done.
    Hope it helps,
    Gili

  • Customer exit Variable for Previous 12months Rolling based on 0calday

    Hi Experts,
    I am creating a Customer exit variable to derive Rolling 12 months based on calday,
    Could you please any body correct the below code,
    Or if you any body have pseudo code based on calday, could you please pass to me
      WHEN 'zcalday'.
    * Rolling 12 months to period
        IF i_step = 2.
          CLEAR: l_s_range, loc_var_range,
          LOOP AT i_t_var_range INTO loc_var_range
            WHERE vnam = 'RYEAR'.
       MOVE sy-datum TO: lv_date_from,
                                        lv_date_to.
               zmonth = lv_date_from+4(2)
           l_s_range-high = zmonth = loc_var_range-low.
            v_fiscper = v_fiscper - 12.
            l_s_range-low = v_fiscper.
            l_s_range-sign = 'I'.
            l_s_range-opt  = 'BT'.
            APPEND l_s_range TO e_t_range.
          ENDLOOP.
        ENDIF.
    Thanks and regards
    Sree

    Hi Yasemin,
    Thanks for your help,
    I have small clarification, I have following data in base cube,After restricting the customer exit variable
    on revenue I suppose I will get one Amount, i.e 7800, But If I want month wise, Do I need to create offset? or without creation of offset is there any way that will split based customer exit variable.....
    Thanks a lot
    regards
    Sree
    Execution date
    24/06/2014
    Comp Code
    Date
    Revenue
    C100
    01/07/2013
    100
    C100
    01/08/2013
    200
    C100
    01/09/2013
    300
    C100
    01/10/2013
    400
    C100
    01/11/2013
    500
    C100
    01/12/2013
    600
    C100
    01/01/2014
    700
    C100
    01/02/2014
    800
    C100
    01/03/2014
    900
    C100
    01/04/2014
    1000
    C100
    01/05/2014
    1100
    C100
    01/06/2014
    1200
    Total
    7800

  • Financial Report to get data of previous 2 months

    Hi,
    I got a requirement to create a report to show the data of previous 2 months based on the prompted month and year. Suppose if user selects March and year as *2009* then my report should show data for Mar followed by Feb and Jan of *2009*. I am able to create that correctly for the current year if the prompted month is from March to December.
    But if user prompts Jan and Year as *2009* then I should retrieve the report of data*Jan* of *2009* followed by Dec and Nov of previous year that is *2008*. Similarly if user prompts Feb then my report should show the data of Jan of this year 2009 and Dec of *2008*. I have YEAR and PERIOD dimensions in the Column. Could anybody please help me how can I provide such functionality. Thanks in advance.
    Regards,
    Sravan

    Hi Sravan,
    Check the below thread...hope it will help you.
    Very Urgent FR Report
    Regards,
    Mars

  • How to add a new metadata field to iPhoto where new field is calculated as age in years and month based on a specific date and the date photo was taken ? I want to calculate and display the age of my two kids on every photo.

    Hi
    How can I add 2 new metadata-fields to every photo in iPhoto ?
    The new fields should state the age of my kids in years and months based on the date that they were born and the date that photo is taken.
    Exampel:
    My son is born 01.01.2010
    My daughter is born 01.01.2012
    Photo taken by data
    Aage of son
    Aage of daughter
    01.07.2011
    1 year 6 month
    not born yet
    01.01.2014
    4 year 0 month
    2 year 0 month
    I would like to be able to search by kids age and get the info displayed when doing slideshows.
    How to do this in iPhoto ?
    Any alternatives to accomplish the same ?
    Kind regards

    It can't be done with iPhoto.  There are some DAM (digital asset management) applications that can write to other IPTC fields that iPhoto can't read. One such app is Media Pro 1.
    However you would have to calculate the age for each date and add it to one of the fields. There are online age calculators that can do that for you: Age Calculators
    If you go thru that much trouble then use iPhoto, make the calculations and add the age to the Description field.  Then you can use Smart Albums to search for 1year 6 month text.
    OT

  • Code to derive the Work Week (ISO IW doesn't fit the requirement)

    I could use some assistance with my pl/sql code to derive the work week from the current date.
    If January 1st lands on Thursday, Friday, or Saturday, the work week for January 1st is '53'. If January 1st lands on Sunday, Monday, Tuesday, or Wednesday, the work week for January 1st is '1'.
    I think I have the logic down, but my pl/sql is admittedly weak.
    This is what I have thus far:
    create or replace procedure work_week_fn (work_week DATE) IS
    first_year_day INTEGER;
    my_work_week INTEGER;
    BEGIN
    SELECT '01-JAN-'||to_char(to_date(sysdate, 'DD-MON-RR'), 'YY') into first_year_day from dual;
    SELECT to_char(to_date(sysdate, 'DD-MON-RR'), 'WW') into my_work_week from dual;
    IF first_year_day IN ('SUNDAY','MONDAY','TUESDAY','WEDNESDAY') THEN
    dbms_output.put_line(my_work_week);
    ELSE dbms_output.put_line(my_work_week + 1);
    END IF;
    END;
    It's compiling, but I'm not getting the result I need. Any suggestions?

    Hi tk,
    I'm not able to reproduce.
    SQL> set serveroutput on
    SQL> with t as (
    select trunc(sysdate, 'Y') + level - 1 dte from dual
    connect by level <= 20
    select dte, to_char(dte, 'DAY') dte_day, to_char(dte, 'D') dte_d, to_char(dte, 'IW'),
           case
             when to_char(dte, 'IW') IN ('01','53') or
                 to_char(dte, 'IW MM') = '52 01' then
               case
                 when to_char(trunc(dte, 'Y'), 'D') > 4
                   or to_char(dte, 'IW MM') = '01 12'
                 then 53
                 else 1 end
             when to_char(trunc(dte, 'Y'), 'D') > 4 then
               to_char(dte, 'IW')-1
             else
               to_char(dte, 'IW')+0
           end work_week
    from t
    DTE      DTE_DAY D TO  WORK_WEEK
    09-01-01 TORSDAG 4 01          1
    09-01-02 FREDAG  5 01          1
    09-01-03 LØRDAG  6 01          1
    09-01-04 SØNDAG  7 01          1
    09-01-05 MANDAG  1 02          2
    09-01-06 TIRSDAG 2 02          2
    09-01-07 ONSDAG  3 02          2
    09-01-08 TORSDAG 4 02          2
    09-01-09 FREDAG  5 02          2
    09-01-10 LØRDAG  6 02          2
    09-01-11 SØNDAG  7 02          2
    09-01-12 MANDAG  1 03          3
    09-01-13 TIRSDAG 2 03          3
    09-01-14 ONSDAG  3 03          3
    09-01-15 TORSDAG 4 03          3
    09-01-16 FREDAG  5 03          3
    09-01-17 LØRDAG  6 03          3
    09-01-18 SØNDAG  7 03          3
    09-01-19 MANDAG  1 04          4
    09-01-20 TIRSDAG 2 04          4
    20 rows selected.Must depend on some NLS setting?
    SQL> set serveroutput on
    SQL> select * from nls_session_parameters
    PARAMETER                      VALUE                                  
    NLS_LANGUAGE                   DANISH                                 
    NLS_TERRITORY                  DENMARK                                
    NLS_CURRENCY                   kr                                     
    NLS_ISO_CURRENCY               DENMARK                                
    NLS_NUMERIC_CHARACTERS         ,.                                     
    NLS_CALENDAR                   GREGORIAN                              
    NLS_DATE_FORMAT                RR-MM-DD                               
    NLS_DATE_LANGUAGE              DANISH                                 
    NLS_SORT                       DANISH                                 
    NLS_TIME_FORMAT                HH24:MI:SSXFF                          
    NLS_TIMESTAMP_FORMAT           RR-MM-DD HH24:MI:SSXFF                 
    NLS_TIME_TZ_FORMAT             HH24:MI:SSXFF TZR                      
    NLS_TIMESTAMP_TZ_FORMAT        RR-MM-DD HH24:MI:SSXFF TZR             
    NLS_DUAL_CURRENCY              €                                      
    NLS_COMP                       BINARY                                 
    NLS_LENGTH_SEMANTICS           BYTE                                   
    NLS_NCHAR_CONV_EXCP            FALSE                                  
    17 rows selected.Regards
    Peter

  • 1st & last day of month based on month selected

    Hi All,
    I am an infant in BO. I want to create a variable in which I need to compare Order Creation Date with First Day of Month and Last Day of Month.
    I have gone through the posts here regarding this, I found huge no of posts on calculating the 1st & last day of month based on a date value. But,
    I don't have any date objects in the universe level, instead I have only Month Name/Month Number objects in the universe level (as it is a monthly report)
    So, How to create 1st day & last day of month based on the month selected.
    That is, If I run the report for FEB 2011 (Prompt values), I need the outputs as 01/02/2011 & 28/02/2011 as my 1st & last date values respectively.
    I am working on BOXI R 3.1
    Thanks in Advance,
    Mitch

    Hi
    Create a variables and write a formula like
    Also add Month number Object in query level
    Var_Month
    =userresponse("Enter Month")
    Var_A
    "01/"MonthNumberObj+Right(var_Month;4)
    var_First date
    Todate(var_A;"dd/MM/yyyy")
    var_lastdate
    =lastdayofmonth(var_Firstdate)
    Note: check the default format for date according to ur database like MM/dd/yy or something like that . and add in the var_firstdate
    regards
    Sunil

  • How i can find out number of transaction code created in last 6 month

    Dear Friends,
    How i can find out number of transaction code created in last 6 month and last used date for each transaction code.
    System - ECC 5.0
    Plz help.
    Thanks,
    Regards,
    Sachin

    Hi,
    As per your query you can find out the list of t-code not to use in last time details in suim t-code.
    Anil

  • Get Last Invoice Day and No of days based on Invoice date

    Hi,
    Can you please provide me logic on how to get the Last Invoice day from the invoice dates .
    Also want to the know the no. of days in the month based on invoice date,
    Thanks,
    Pra.

    Hi
    Getting this information there is few standard functions available. Try to find out & utilize it.
    or else you should have to write code in customer exit.
    swetha

  • Compare turnover actual month with previous month on monthly based report

    Hello Gurus,
    please help me with the following requirment:
    In have a monthly based report with key figure 'turnover'. Now I want to calculate deviation turnover actual month vs turnover previous month from last year. How to handle this?
    Example:
                             CalYear/Month     
                             01.2010   02.2010   03.2010   04.2010
    Turnover              10            20            15            20
    Calculated          xxxx         xxxx       xxxx         xxx
    Thank you very much!
    Muammer

    Hello voodi,
    it doesn't work. With offset function it shows the turnover only in the columns from last year. I need the turnover from last year in the columns from this year. Any ideas?
    Expected:
                                   CalYear/Month
                                         01.2010   02.2010   03.2010   04.2010
    Turnover                          10            20            15             20
    Turnover last year        xxxxx      xxxxx      xxxxxx    xxxxx
    With offset -12
                                CalYear/Month
                                          01.2009         02.2010     ...               01.2010   02.2010   03.2010   04.2010
    Turnover                           20               50           ....                    10            20            15             20
    Turnover last year            20               50           ...                  blank         blank       blank         blank
    Thank you!
    Muammer

  • 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

Maybe you are looking for

  • Servlet in Tomcat 4.0.1

    Hi everyone! I have a web application in Tomcat that uses JSP and Servlet. I have a Servlet named "MainServlet" that is a controller ( MVC Design Pattern ). When the servlet is called from a JSP ( let say Login.jsp ), I get an exception saying: javax

  • HT1600 apple tv latest update is asking me to plug to itunes.

    I tried this morning to update my apple TV. I went through the process and then this huge itunes logo and lightening connector pic appeared on my screen, and its still on. i guess its asking me to connect to itunes, and now i can,t even get access to

  • How to listen to .mp3 songs in Solaris 10 -x86 ??

    Hello friends, I have installed Solaris-10 on my PC ( ie Solaris 10 for x86). I would like to play .mp3 files (songs). I checked that mpg123 is installed. At the same time, I could not find the files /dev/audio and /dev/audioctl. Browsing the net fet

  • ABAP Standard & Guidelines  OO vs Procedural

    Hi all - In Blueprint phase of new SAP implementation and am creating ABAP Standard & Guidelines document.  I am split on whether to enforce use of object-oriented versus procedural programming (as per Blumenthal & Keller).  Seems to me that even on

  • Proximity not installed on this computer?

    I have receantly bought an iMac 27 and transferred all data from my old MacPro, using the Migration Assistant. I am an Adobe Creative Cloud member, and when opening a InDesign CS6 document in my new iMac, ID says: "If you edit the text in the documen