Converting Calendar day to Number of Days(Period to analyze in MC46)

Dear All,
            Regards.We got a requirement where:
1).The BW Report(Slow moving Item) should be in the same format as MC46.Like,having "Period to Analyze:No. of Days since consumption) in the input selection screen ,
2) Calculate the Stock Value for the that particular day(Eg:For 30,60 or 100 Days backwards from Today)
(Eg: Today:02/04/08
Period to Analyze: 30days
Day for which stock is calculated = 02/03/08).
-The BW Standard report calculates for a Particular "Calendar Day(Period interval) rather than No. of Days  
  Guys,it would be fantastic if someone could take time to help me out with this issue...
Manythanks
Arun

Check this one: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/11291595-0501-0010-c881-e02c27261b55 if it helps

Similar Messages

  • Need to add number of days to users end date.

    Hi,
    I have a code where we are adding number of days(30) to current date and then updating user's end date in IDM DB.
    Now we have a requirement where we need to add number of days(30) to existing end date of user instead of adding to current date.
    *public String incrementDate(int daysToAdd)
         // Start date
         log.info("NotifyLastDayOfService::incrementDate(): Enter");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
         Calendar c = Calendar.getInstance();
         c.add(Calendar.DATE, daysToAdd); // number of days to add
         String newDate = sdf.format(c.getTime());
         log.info("NotifyLastDayOfService::incrementDate(): Exit");
         return newDate;
    Have any body implemented this scenario?
    Please suggest.
    Thanks,
    Kalpana.

    Hi Nayan,
    Here is the code:
    System.out.println("----inside increment date method-----");     
              HashMap<String, String> hm = new HashMap<String, String>();
              HashMap<String,Date> modifyMap=new HashMap<String,Date>();
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
              tcResultSet usrList = null;
         String enddate = null;
         hm.put("Users.Key",usrKey );
         try {
         usrList = this.usrIntf.findUsers(hm);
         usrList.goToRow(0);
         Date endDate =usrList.getDate("Users.End Date");
         System.out.println("-----users end date-----"+endDate);
         String userEndDate=sdf.format(endDate);
         System.out.println("-----String value of users end date-----"+userEndDate);
         Calendar cal=null;
         System.out.println("-----Calender date-----"+cal);
         cal.setTime(endDate);
         System.out.println("-----end date-----"+endDate);
    cal.add(Calendar.DATE, Integer.parseInt(daysToAdd)); // number of days to add
    Date newEnddate = cal.getTime();
    System.out.println("-----new end date-----"+newEnddate);
    //usrList.setEndDate(Edate);
    modifyMap.put(userEndDate,newEnddate);
    usrIntf.updateUser(usrList, modifyMap);
    System.out.println("updated user's end date in OIM DB");
    //System.out.println("-----updated user's end date in OIM DB-----");
    logger.info("NotifyLastDayOfService::incrementDate(): Exit");
         System.out.println("-----new date-----");
         } catch (tcAPIException e) {
         logger.error("Error in finding end date for user" + e);
         } catch (tcColumnNotFoundException e) {
         logger.error("Error in finding end date for user" + e);
    In th log file, I can see that the code is not executing this line:
    cal.setTime(endDate);
    end date is of type Date and stores users end date from DB. Please help in resolving this issue.
    Thakns,
    Kalpana.

  • Number of days in a period of factory calendar

    Hi Experts,
    My requirement is to find out the number of days in a particular period of factory calendar. I have the current date and calendar ID as input .
    1. Is there any FM available to find out the number of days(including both working and holidays)?From my search i could find some FMs , but the input parameters requires start and end date of the period.Start and end dates are not available in my case.
    2. IF the first option is not possible , I want to find out the start and end dates of the current period from the factory calendar. Any standard FMs available for this?
    Thanks in advance
    Sanu
    Moderator Message: Asked and answered many times. Please search
    Edited by: kishan P on Sep 13, 2010 5:28 PM

    according to SAP F1 help, it is calendar days.
    Double click a key figure (not the characteristic like material number) . then put the cursor onto the desired key figure and press F1

  • Convert Calendar Day into Company's Accounting Period

    Hi, please help me on this.
    I need to convert a date into accounting periods.
    e.g company's accounting period starts from 12/29/03 to 1/30/04. Then 12/30/03 would be Day 2 of the accounting period and it would be week 1 of the Acc. period. How can I do it ?
    Thanks,

    select to_char(to_date('12/29/03','MM/DD/RR'),'IW') WEEK1,
    to_char(to_date('01/05/04','MM/DD/RR'),'IW') WEEK2,
    to_char(to_date('12/29/03','MM/DD/RR'),'D') DAY1,
    to_char(to_date('12/30/03','MM/DD/RR'),'D') DAY2
    FROM DUAL;
    WE WE D D
    01 02 2 3
    Modify your NLS Parameters to retrieve appropriate results.

  • Program or FM to convert number of days into a CalDay format (ddmmyyy)

    Hi ABAP friends,
    I input calendar day values via a popup calendar from a spreadsheet to BW. So, the values that are populated in BW are the numbers, and not the date.
    For ex. when user selects a calendar day for ex. 11-April-2010, the value in excel is stored as 40279 (which is the number of days starting from 01-Jan-1900) and this is the value that gets stored in BW once we save the data.
    I'm looking for a function module or method or whatever that converts the above number (40279) into CalDay and writes it to the 0CALDAY infoobject ???
    Please help,
    Thanks,
    Venkat

    Thanks Pranaam.
    Two things:
    1. I cannot find this FM. It says FM doesn't exist. SE37 -->  HR_HK_DIFF_BT_2_DATES
    2. My requirement is actually reverse as you explained. I can certainly hard code the starting date: 01011900, but here the input should be the number of days. and I need the date (date2 in your ex.) based on the no. of days entered.
    I found another FM which does exist in my BW system. That is: FIMA_DAYS_AND_MONTHS_AND_YEARS
    Based on "From" & "To" dates, it outputs the number of days.
    But my requirement is:
    Based on the starting date (i.e. always 01011900) and number of days, it should give me the "To" date value.

  • How to calculate the number of days worked for a given period

    I need to calculate the number of days worked by contractor employees for a time period to be entered by a user. I am building a query on an infoset which contains employee information including contract start date and contract end date for the employee.
    Ideally I'd like the user to enter the time period which should be reported on e.g. 01.08.2009 to 31.08.2009
    The report should then identify all the contractor employees which were working during this period and to work out how many days they worked during this period. Obviously the contract start and end dates could fall both inside and outside the reporting period.
    Can this be done and if so, do you have any suggestions as to how to do it?
    Thanks.

    hi
    So here you will first have to load the master data table employee in one internal table and read this table with the variables entries.
    Your code in the reporting exit should look like that.
    bye
    data : wa_employee type /bi0/pemployee.
    When 'ZDATE1'
    if i_step = 2.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE2'.
    clear l_s_range.
    clear wa_employee
    1- select the entries from table employees
    select single employee dateto datefrom
    from /bi0/pemployee
    into corresponding fields of wa_employee
    where dateto le loc_var_range-low
    and datefrom ge loc_var_range-high.
    if sy-subrc eq 0.
    CALL FUNCTION 'FIMA_DAYS_BETWEEN_TWO_DATES'
       EXPORTING
           i_datum_von  = wa_employee-datefrom
           i_kz_ult_von = 'X'
           i_datum_bis  = wa_employee-dateto
           i_kz_ult_bis = 'X'
           i_szbmeth    = '1'
       IMPORTING
          e_tage       = no_days.
           l_s_range-low  = no_days.
           l_s_range-sign = 'I'.
           l_s_range-opt  = 'EQ'.
          APPEND l_s_range TO e_t_range.
              ENDIF.
            ENDIF.
    endloop.
    ENDIF.
    Boujema

  • How to get total number of days in current Fiscal period/year

    Hi,
    I need to get total number of days in current Fiscal period/year (current month) and assign it to an infoobject. I need a routine for this. Is there any function module to get this.If possible pls paste the ABAP code also for this task. Thanks in advance

    here is the FM:
    LAST_DAY_IN_PERIOD_GET
    KJ!!!

  • Determine the number of days in a False period in a Temporal Boolean

    Hi all,
    I need to determiine the number of days based on a condition that lies on the gaps between the periods.
    My input consists of multiple periods. The length of the gap is the condition to determine the start date for summation. However, there can be multimple gaps between my instances that satisfy this condition and I need the last one that satisfies it.
    For example:
    period 1: 1-1-1990 until 31-12-1992
    period 2: 1-1-1994 until 31-12-1996
    period 3: 1-1-1998 until 31-12-1999
    period 4: 1-6-2000 until 31-12-2009
    The condition for the start date is the last gap greater than 1 year. In this example, the start date should be the start date of period 3: 1-1-1998, because this is the period after the last gap >= 1 year. Period 2 also has a previous gap of >= 1 year, but this period should NOT be selected.
    My first idea was to use a TBR function: to determine relevant periods (based on the gaps before and after), calculate the amount of days per relevant period and add those up. However, if I want to do that I need to calculate the number of days in the gaps and I don't see how to do that, since I cannot determine a day difference across periods (end date period 1 until start date period 2).
    Any help/ other solution ideas?
    Kind regards, Els

    This was an interesting puzzle which you can solve from a couple of different angles.
    Firstly, you can use inferred relationships to infer a relationship "the following periods" (ie. the periods that follow the current one). My rules looked like this:
    the period (the other period) is a member of the following periods if
       the other period start date > the period start date
    the period’s next start date = InstanceMinimum(the following periods, the period start date)From here it should be easy to see if there was a gap of more than a year, and find the most recent period after a year-long gap. Of course you need to deal with the situation of the last period, when there is no 'next' period, presumably you would use the date of assessment in that case, but I'll leave that as an exercise for the reader.
    A completely different way of doing it is to use the TemporalConsecutiveDays function to find a date where a gap of 365 days exists, then select periods in which there is a gap immediately before the start of that period. Here are some rules that :
    there is a period that applies if
       ExistsScope(the periods)
          TemporalOnOrAfter(the period start date) and
          TemporalOnOrBefore(the period end date)
    there is a year-long gap if
       TemporalConsecutiveDays(365, 365, there is not a period that applies)
    the period starts after a year-long gap if
       ValueAt(the period start date, there is a year-long gap)
    the start date for calculation = InstanceMaximumIf(the periods, the period start date, the period starts after a year-long gap)Hopefully one of these is suitable for your needs.
    cheers,
    Steve.

  • Number of days in the calendar month

    Hi All,
    How can i get the number of days in the calendar month in Bex reporting.
    Thanks,
    Gana

    Hello,
    Please go through the following links.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/20f119d9-922d-2c10-88af-8c016638bd90
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f002c608-2533-2c10-25a1-d0e7f7b5b662
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10fc4382-afa6-2c10-1380-fa224fe4324f
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0fefc77-40e3-2c10-8da3-d4bfcb013387
    Thanks.
    With regards,
    Anand Kumar

  • Convert number of dayes per year to data

    Please i need help in Convert number of dayes to date
    I have ID's like id
    FT*09025*0000000001 date=20090125
    FT*01171*0000000002 date=20100620
    so should convert first five number after FT to date
    example *09025*
    09 map to 2009
    025 number of dayes per year map to 25 jan
    example *01171*
    01 map to 2010
    171 number of dayes per year map to 20 jun
    (jan+feb+mar+apr+may)=(31+28+31+30+31)=151
    171-151=20 for the next month
    Please need help so will added filter to informatica map with date
    Edited by: user8929623 on Jul 4, 2010 7:04 PM

    Well, I do not follow why when 09 maps into 2009, 01 maps into 2010, not into 2001. Assuming it should be 2001, use YYDDD format:
    SQL> with t as (
      2             select 'FT*09025*0000000001' id from dual union all
      3             select 'FT*01171*0000000002' from dual
      4            )
      5  select  to_date(substr(id,4,5),'yyddd') dt
      6    from  t
      7  /
    DT
    20090125
    20010620
    SQL> SY.

  • How to calculate number of days between Calendar objects

    Hi,
    I need to calculate the number of days between two Calendar objects. Here is some sample code:
    Calendar now = Calendar.getInstance();
    now.set(Calendar.HOUR_OF_DAY, 0);
    now.set(Calendar.MINUTE, 0);
    now.set(Calendar.SECOND, 0);
    now.set(Calendar.MILLISECOND, 0);
    // get a calendar that represents a day in the past
    Calendar aDayInThePast = getADayInThePast();
    aDayInThePast.set(Calendar.HOUR_OF_DAY, 0);
    aDayInThePast.set(Calendar.MINUTE, 0);
    aDayInThePast.set(Calendar.SECOND, 0);
    aDayInThePast.set(Calendar.MILLISECOND, 0);
    // how can I calculate the number of days ago this was??
    //it would also be useful to get back a negative number if the day is in the future

    My favorite answer so far is reply 15 by Marc__: http://forum.java.sun.com/thread.jspa?threadID=488668&start=15

  • Function module which convert number to days to date

    Hi,
    Any one knows any function module which convert total number of days into date.
    thnaks,
    shilpa k

    Hi,
        FIMA_DAYS_AND_MONTHS_AND_YEARS
    FI_PSO_DAYS_MONTHS_YEARS_GET
    RSSM_CONVERT_DAYSEC2TIMESTAMP
    RSSM_CONVERT_TIMESTAMP2DAYSEC
    Function Modules related to Date and Time Calculations
    DATE_COMPUTE_DAY : Returns weekday for a date
    DATE_GET_WEEK : Returns week for a date
    DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified
    MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
    END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.
    HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.
    FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.
    MONTH_NAMES_GET : Get the names of the month
    WEEK_GET_FIRST_DAY : Get the first day of the week
    HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format
    SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours
    L_MC_TIME_DIFFERENCE : Find the time difference between two date/time
    HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
    LAST_DAY_OF_MONTHS : Returns the last day of the month
    Regards

  • MDX- Getting Number of days in a selected period

    HI All,
    I need a help in MDX.
    Here I am calculating the number of days in a selected time period.
    In my date dimension we have the Month as the last level.
    But somehow I bring a column called "Days in Month" 
    Now my Date dimension table is like below:
    Id   year  Month
    DaysInMonth
    1 2014
    Jan 31
    2  2014
    Feb 28
    12  2014
    Dec 31         and so on.....
    So i created a hierarchy which contains three levels i.e. Year--->Month---->---->DaysInMonth
    Now I want to know the Total number of days in a selected time period.
    i.e. if I select 2014 then it should show 365, similarly if i select
    Aug-2014 then it should show 31.
    I have tried the below code i.e. 
    WITH MEMBER measures.X AS
          count( DESCENDANTS (
                [Time Accounting period].[Hierarchy].CURRENTMEMBER,
                [Time Accounting period].[Hierarchy].[Days In Month]))
    SELECT Measures.X ON 0,
    [Time Accounting period].[Hierarchy].[Year].&[2013] on 1 
    FROM [XXX]
    Here it is showing me the total members in that particular level,
    E.g. When I am selecting 2013, its showing me 12
    If I select Jan-2013, its showing me 1
    But I dont want this, if I would have the Dates in my Date Dimension, then this code would have worked perfectly.
    So i just want to know if somehow we can use the DaysInMonth
    column to accomplish this.
    Thanks
    Sudipta Ghosh
    Sudipta Ghosh Tata Consultancy Services

    HI David,
    If I would have the Day level data then my below code will give me the desired result.
    WITH MEMBER measures.X AS
          count( DESCENDANTS (
                [Time Accounting
    period].[Hierarchy].CURRENTMEMBER,
                [Time Accounting
    period].[Hierarchy].[Days]))
    SELECT Measures.X ON 0,
    [Time Accounting period].[Hierarchy].[Year].&[2013]
    on 1 
    FROM [XXX]
    But unfortunately I don't have the Day level in the dimension, So was wondering whether we can use the
    DaysInMonth column by any means.. :(
    Sudipta Ghosh Tata Consultancy Services

  • Number of days per period cumulated value

    Hi,
    I am using a keyfigure which gives me number of days per period cumulated.
    example
    001.2009  002.2009 003.2009
    30             61            91
    When i multiplying number of days keyfigure with a factor, Its caluculating using before aggregation values. i.e.
    001.2009 = 30*factor
    002.2009 = 31* factor
    003.2009 = 30*factor.
    The requirement is to multiply with cumulated values.
    001.2009 = 30*factor
    002.2009 = 61*factor
    003.2009 = 91*factor.
    Is this possible? If yes any help greatly appreciated.
    Regards,
    Suresh.

    Hi...
    It will answer following questions...
    1. How many days for month Feb' In the year 2008?
    2. How many days for the month Feb' in the year 2007?
    Analyze this program...
    data: var3(2) type n.
    PARAMETERS: var1(2) type n DEFAULT '2',
                var2(4) type n DEFAULT '2008'.
    call function 'NUMBER_OF_DAYS_PER_MONTH_GET'
      exporting
        PAR_MONTH       = var1
        PAR_YEAR        = var2
    IMPORTING
       PAR_DAYS        = var3.
    write:/ 'No. of days in the given month:', var3.
    Thanks,
    Naveen.I

  • How to calculate number of days between two date in Template design?

    Hello guys
    I have a situation where I have to create a template that returns data, and one of the thing of the existing report is that there is a column that is actually the number of days between start date and end date columns..
    So in template, how would I be able to do the same? I have start date and end date columns on the template, now when I created another column using expression like end date - start date and preview the template, I am getting errors saying :
    Caused by: oracle.xdo.parser.v2.XPathException: Cannot convert 03/31/2009 to number.
         at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:1534)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:521)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:489)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:271)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:155)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:192)
    Please advice
    Thanks

    Hi
    There is an extension function you can use, from the javadoc:
    date_diff
    public static long date_diff(java.lang.String format,
    java.lang.String fromDate,
    java.lang.String toDate,
    java.lang.String locStr,
    java.lang.String tzID)
    Method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only Gregorian calendar.
    Parameters:
    format - the format to which the difference is required; allowed formats are y (for Year), m(for month), w(for week), d(for day), h(for hour), mi(for minute), s(for seconds) and ms(for milliseconds)
    fromDate - the first date
    toDate - the second date
    locStr - locale string -> lang-Territory
    tzID - timezone ID ->http://java.sun.com/j2se/1.4.2/docs/api/java/util/TimeZone.html
    Returns:
    the difference in dates in the desired format
    For example
    <?xdoxslt:date_diff(‘d’,’2009-09-14’, ‘2009-09-20’,’en-US’,1)?>
    give a result of 6
    You can substitute in columns for the dates, just remember the date format required.
    Regards
    Tim

Maybe you are looking for

  • Is it possible to change the description of an attribute in the local view

    I have a characteristic in a query which has multiple attributes. In the global view I am able to change the descriptions on the attributes. But the local view does not show the updated descriptions - it shows the descriptions from the multiprovider?

  • IPhone 4 won't boot up if not connected to wall plug

    Okay so I've been using my black 16GB iPhone 4 for quite a period of time now. Recently I got a new 32GB white one, so I changed over. One day I was kind of bored so I tried to boot up my black iPhone. It didn't work. I hooked it up to the charger(wa

  • How can I block Vendor for Quality Reasons at POrg Level ?

    We are currently on ERP 4.7 and are facing the following challenge: We want to block the Vendor using MK05 with the function Block for Quality Reasons at the POrg level. Example: If we define a Delivery Block in configuration to Block Goods Receipt a

  • LMS 4.1 - dbreader.html -- Authorization error with DB-Users

    Hi all, in our lab-environment we installed LMS 4.1 from scratch. Trying to connect to eg. ani-db via URL (https://<server>/dbreader/dbreader.html) with user cwsiSA I got error message stating "Authorization error". Is that default behavior? We need

  • Create Portal user programmatically

    Hi, I've been told there was an API in the 3.0.8 portal release to allow the creation of portal users in the Login Server programmatically. I think this API is called : portal30_sso.wwsso_ls_private. Does anyone know where I can find this API descrip