BPC - Script - How to get the month of a date stored as an amount?

We have a account called "StartDate" in our database.
The user enter a date for this account: 01/07/2010
This date is then stored as 40360 in the db
We are trying to get the month number (7) out of this record.
We succeeded to write an sql query to do that:
Select Month( cast( as datetime ) )
From tblFact
Where = 'StartDate'
Any idea how to do that in a bpc script logic ?
Thanks,
Bénédicte

There's no built-in support for any type of date math in BPC script logic.
One approach I've used is to add a property to the time dimension, ExcelTimeID. Then you can compare the value to your time periods, if your logic requires this type of condition.
*WHEN SignedData
*IS < Time.ExcelTimeID
But that doesn't solve the problem you have, where you want to know the month. I can't think of an immediate solution, other than perhaps in the original input schedule to hide a second account that submits the month number (as an integer) along with the account you have now (with the full date).
Or stick a stored proc in some logic package, scheduled to run every 10 minutes or whatever, that takes the account with the date in it, and runs your query, saving the result as the month number. Ugly in so many different ways, but it's another way to tackle the problem further upstream.
And last result is to build script logic with ridiculous hard-coding of Excel time IDs all over the place.

Similar Messages

  • How to get the difference of two dates in years,months and days

    Hi friends,
    how to get the difference of two dates in years,months and days
    for ex 2 years 3 months 13 days
    select (sysdate-date_Start) from per_periods_of_service
    thanks

    Something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
      2             select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
      3             select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
      4             )
      5  -- end of test data
      6  select c_start_date, c_end_date
      7        ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
      8        ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
      9        ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
    10* from t
    SQL> /
    C_START_D C_END_DAT        YRS      MNTHS        DYS
    17-NOV-06 21-JAN-08          1          2          4
    21-NOV-06 17-FEB-08          1          2         27
    21-JUN-06 17-JUL-08          2          0         26
    SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.

  • How to get the monthly interest rate

    Hello!
    I have been using AppleWorks for 10 years.
    Since that time, I use a financial template named Mortgage Analyser.
    In this file, one can get the pmt if one provided the +pv, monthly interest rate and the number of periods.+
    What I get is the reverse, that is, how to get the +monthly interest rate+, if I provide the +pv, the number of periods and the pmt+?
    I think I had this in the past, but I can not find it.
    Thanks,
    Jorge Lucas (the guy from Rio Grande do Sul)

    Peter,
    I already saw that, but it does not give me what I want.
    That works only if you put a money at a savings account and DO NOT TOUCH IT for a given period.
    My need right now is to help a girl to buy a car in 36 or 48 monthly payments and calculate the real interest.
    I want to have this for any other similar buying.
    I can do it using the Mortgage Analyser template changing the MONTHLY RATE by *+try and error+* but — +since I am a High School Math Teacher+ — I would like to have the function directly.
    Another day I was looking on the Internet and it seems that there is no direct response for what I want, using AppleWorks.
    So, if I continue to use AW, I must calculate it by try and error.
    Thanks anyway!
    Jorge Lucas (the guy from Rio Grande do Sul)

  • Get the month from a date column with the calculated column

    I am trying to get the month from a date field with the help of calculated column. However I get this syntax error whenever I want to submit the formula:
    Error 
    The formula contains a syntax error or is not supported. 
    the default language of our site is German and [datum, von] is a date field.

    Hi,
    I have created two columns
    Current MM-YY
    Calculated (calculation based on other columns)
    Today
    Date and Time
    Current MM-YY is calculated value with formula as
    =TEXT(Today,"mmmm")
    But the output shows as December instead of May.
    I have tried =TEXT([Datum, von];"mmmm") but no help.
    I am trying to populated the column automatically with current month..ex: if its May the field should show May, next month it should show June an so on.
    Any kind help is grateful.
    Regards,
    Pradeep

  • I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    Select all the photos that you need to change, then click the "Photos" menu and choose "Adjust Date and Time".
    If you add a year, it will adjust all the photos that you selected by adding a year (so if you accidentally select one of the photos that already has "2012", that will change to "2013"). 

  • How to get the name of a Data Element of a generic Table!

    Hi guys!
    In my function i have the following import paramenter
    i_outtab type standard table
    now i import a table and i want to get the dataelement of the fields.
    is there a way to do this??

    Hello Thomas
    Perhaps the following sample report may be useful for you.
    *& Report  ZUS_SDN_RTTI_STRUCT_COMPONENTS
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1145711"></a>
    *& Thread: How to get the name of a Data Element of a generic Table!
    REPORT  zus_sdn_rtti_struct_components.
    TYPE-POOLS: abap.
    TYPES: BEGIN OF ty_s_outtab.
    TYPES: bukrs    TYPE bukrs.
    TYPES: kunnr    TYPE kunnr.
    TYPES: END OF ty_s_outtab.
    DATA: gdo_data    TYPE REF TO data.
    DATA: gs_outtab   TYPE ty_s_outtab.
    DATA: go_typedescr  TYPE REF TO cl_abap_typedescr,
          go_structdescr  TYPE REF TO cl_abap_structdescr,
          go_datadescr    type ref to cl_abap_datadescr.
    DATA: gs_comp        TYPE abap_compdescr,
          gd_dtel        type string,
          gt_dfies        type ddfields.
    FIELD-SYMBOLS:
      <gs_struct> TYPE ANY.
    START-OF-SELECTION.
      BREAK-POINT.
      GET REFERENCE OF gs_outtab INTO gdo_data.
      ASSIGN gdo_data->* TO <gs_struct>.
      go_typedescr = cl_abap_typedescr=>describe_by_data( <gs_struct> ).
      go_structdescr ?= go_typedescr.
      BREAK-POINT.
      LOOP AT go_structdescr->components INTO gs_comp.
        go_datadescr = GO_STRUCTDESCR->GET_COMPONENT_TYPE( gs_comp-name ).
        gd_dtel = go_datadescr->get_relative_name( ).
        write: / syst-tabix, 'Data element =', gd_dtel.
      ENDLOOP.
    END-OF-SELECTION.
    Regards
      Uwe

  • How to get the today's julian date in java?

    how to get the today's julian date in java?
    hi can any one tell me how to get the todays julian date using Calender class or GregorianCalender class....
    Julian date for 2006.November.01 AD 05:54 PM : 2454041.0
    i have tryied with
    calJ.setGregorianChange(new Date(Long.MAX_VALUE));
    System.out.println(sdf2.format(calJ.getGregorianChange()));
    thanks
    Tushar
    Message was edited by:
    lad_tushar

    thanks a lot....for intrest....
    I have found some details about the Julian calendar as follows:
    The Julian date for 2006: JAN: 01:12:01:59 is 2453737.00138
    245 represent the year digits for year 2006
    3737 represent the date fir 1 Jan
    .00138 represents the time for 12:01:59
    Julian date change as per every day 12 noon it increase one digit in it.
    As per ref from
    http://www.aavso.org/observing/aids/jdcalendar.shtml
    Also chk this calendar where Julian date is 20. October 2006 for 02 November 2006
    As per ref from
    http://www.calendar.sk/julian_calendar-en.php
    I have tried the pure �GregorianCalendar� class from jdk1.4 API and its setGregorianChange method but not getting as per the expected Julian date format. Using the �setGregorianChange()� i have setting the cutover date to Long.MAX_VALUE it means GregorianCalendar now have to act as per the Julian calendar ...so after setting the cutover date it return me changed date using �getGregorianChange()� but that was not the Julian date of the current date...as expected or as per above both scenario. Even though the last two digits are nowhere equal to the actual Julian date.
    Program
    GregorianCalendar cal = new GregorianCalendar();
    cal.setGregorianChange(new Date(Long.MAX_VALUE)); // setting the calendar to act as a pure Julian calendar.
    // cal.set(Calendar.DATE, new Date().getDate()); // seting the current date
    // Date todayJD = cal.getGregorianChange(); // getting the changed date after the setGregorianChange
    Date todayJD = cal.getTime(); // getting the calculated time of today�s Julian date
    SimpleDateFormat sdfJulianDate = new SimpleDateFormat("yyDDD");
    SimpleDateFormat sdfJuliandayOfYear = new SimpleDateFormat("DDD");
    System.out.println("today Date = " + new Date());
    System.out.println("Today as julian date = " + sdfJulianDate.format(todayJD));
    System.out.println("Today as day of year = " + sdfJuliandayOfYear.format(todayJD));
    OUTPUT:
    USING : Date todayJD = cal.getGregorianChange();
    Today Date = Thu Nov 02 15:17:05 IST 2006
    Today as julian date = 94229
    Today as day of year = 229
    USING : cal.set(Calendar.DATE, new Date().getDate());
    Today Date = Thu Nov 02 15:19:22 IST 2006
    Today as julian date = 06319
    Today as day of year = 319
    USING : Date todayJD = cal.getTime();
    Today Date = Thu Nov 02 15:17:59 IST 2006
    Today as julian date = 06306
    Today as day of year = 306
    There is one another concept i found to get the Julian day of the year as per the Julian day chart mention on nasa site (http://angler.larc.nasa.gov/armsgp/JulianDayChart.html) and i m getting the moth of the year that is 306 for nov 02 2006 using getTime() method in above code then the out put is right for Julian day. But it was not as per the expected Julian date format. So in conclusion we can only able to retrieve the day of year for the Julian calendar. hope their will be a solution for this problem in java api ....else we allways have to depend upon the third party api that was not accepteble some times.....
    Kindly chk chart on the site
    http://angler.larc.nasa.gov/armsgp/JulianDayChart.html
    http://weather.uwaterloo.ca/julian.html
    http://www.fs.fed.us/raws/book/julian.shtml
    Thanks,
    Tushar Lad

  • How to get the Month from no of week

    Dear Friendz
    I have one variable which contains the value as 200547 where 2005 is the year and 47 is the no of week.
    now i want to get the month from the no of week.
    so how to solve the problem???
    thank in advance.
    Regards
    nilesh shete

    Hi,
    report ztest.
    data: myweek type SCAL-WEEK,
          mydate type SCAL-DATE,
          mymonth(2).
    myweek = '200547'.
    call function 'WEEK_GET_FIRST_DAY'
         EXPORTING
              WEEK   = myweek
         IMPORTING
              DATE   = mydate
         EXCEPTIONS
              others = 9.
    mymonth = mydate+4(2).
    write mymonth.
    Svetlin

  • Report Script - How to get the total on the any number of rows selected

    Hi,<BR>I am using Essase and report script for the reporting purpose. In this i would like to know how to get the sum of all the rows selected. I know we can use the calculate row, but it has to be done with print row to display the newly created row. But i am using alphablox where this print row is not working. Is there any other alternative is there to get the sum of any number of rows, and displaying them??<BR>Please help me.<BR><BR>Regards<BR>R.Prasanna

    Pls check the structure and index.
    EMP_ID NUMBER(9) NOT NULL,
    EMP_CD           NUMBER(3),
    EMP_NO VARCHAR2(250 BYTE) NOT NULL,
    FROM_EFF_DT DATE NOT NULL,
    TO_EFF_DT DATE,
    CREATE INDEX IDX_EMP_NO ON EMP
    (EMP_NO)
    NOLOGGING
    TABLESPACE INDEXES
    PCTFREE 20
    INITRANS 10
    MAXTRANS 255
    STORAGE (
    INITIAL 56K
    NEXT 1784K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    NOPARALLEL;

  • RMAN to disk script - how to get the hostname into the directory?

    I see you can get the Oracle SID in there but how to get the hostname?
    We have a NFS device where the directory is
    /backups/<hostname>/rman
    Ideas?
    This is not a unix script, ideally its run thru OEM.

    You never mentioned a version.
    Version is always important.
    From 9i and higher you don't need to allocate a channel, and you can CONFIGURE the default channels.
    You can also include a format specifier in the configuration command.
    This needs to be done only once.
    Apart from that: with that number of databases one would probably create a catalog and work with stored scripts, which can be called from a generic RMAN job.
    Stating 'it isn't possible' is too early, especially as you are scarce on information.
    Sybrand Bakker
    Senior Oracle DBA

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • How to get the details of entry date in SQ00.

    Hello,
    Can anybody let me know the steps how to get the entry date in the report SQ00.Here when i am selecting entry date its coming as 00.00.00.(as zero).please let me know how to correct the steps with proper steps.

    Hi
    Apply the SAP NOTE 562031. This will rectify the error. I too faced similar problem which was then corrected when this Note was applied.
    Test it first an then let me know

  • How to get the ep user information data in the web dynpro?

    Hi all
      I want to create a web dynpro application on EP.I want to get the ep user information data in the web dynpro.How can I do?Thanks.

    Lin,
    Two steps to achieve this:-
    <b>Step 1:</b> Add the following code in your view Controller:-
    IWDClientUser user = WDClientUser.getCurrentUser();
    IUser objUser = user.getSAPUser();
    wdContext.currentContextElement().setXXXX(objUser.getUniqueName());
    wdContext.currentContextElement().setYYYY(objUser.getFirstName());
    wdContext.currentContextElement().setZZZZ(objUser.getLastName());
    where XXXX, YYYY , ZZZZ are the context names.
    getUniqueName : Gives Login id of Portal user.
    getFirstName : Gives First Name of the Portal user.
    getLastname : Gives Last Name of the Portal user.
    <b>Step 2 : </b>Use "Organize imports" and make sure that you have the following two libraries added in the build path of your project. You can do these by right clicking on your project name ==> Properties ==> Java Build Path ==> Libraries ==> Add External jars.
    The external jars are :
    <b>com.sap.security.api.jar
    com.sap.security.api.perm.jar</b>
    Finally rebuild your project and deploy.
    Regards,
    <b>Chintan Virani.</b>

  • How to get the difference of two dates?

    let's say i have a table named tblData and has 4 columns: data_RefNo, data_DateReported, data_TargetDate, data_Data
    tblData returns 2 rows.
    data_RefNo.............data_DateReported.............data_TargetDate........................data_Data
    10000................10-20-2004 10:55:44 AM........10-20-2004 10:57:44 AM........Slow Response Time
    10000................10-21-2004 10:55:44 AM........10-21-2004 11:55:44 AM........Bug Error
    i just wana ask how to get the difference of the date_DateReported and date_TargetDate.
    i tried this code but it didnot work
    public Vector get_con_pf()
      Vector vData = new Vector();
      String query  = "SELECT * FROM tblData WHERE data_RefNo= '"'10000'"'";
      try
        DBConnect db = new DBConnect();
        db.openCon();
        ResultSet rs = db.execute(query);
        while (rs.next())
          vData.addElement(DATEDIFF(mi, rs.getString("st_DateReported"), rs.getString("st_TargetFinishDate")));
        db.closeCon();     
      catch (Exception e)
        System.out.println("Error: " + e );
      return vData;   
    i want to return the difference of the data_DateReported and date_TargetDate, i did this
    vData.addElement(DATEDIFF(mi, rs.getString("st_DateReported"), rs.getString("st_TargetFinishDate")));but it didnot work.
    How do i get that? because i want to return a vector.
    the code must return the values:
    2 for the 1st rows because the difference is only 2 minutes, and
    60 for the 2nd row.

    ooops i tried this one:
    query = "SELECT *, DATEDIFF(mi, data_DateReported, data_TargetDate) AS diff FROM tblData WHERE data_RefNo = '10000'";and it works.
    hehehehe!!!!!!
    problem solved! :)

  • How to get the month value in a date?

    I am retrieving a Date from the database using the getDate() method! However, I want the value of the month in this obtained result, which i want to compare with an integer!
    I dont see any other option but to use the deprecated getMonth() method on this Date object! Or rather get the date as a String & apply the substring methods to get the reqd value!
    Is there any other go on this?

    Hi
    You can use GregorianCalendar.
    Date d = new Date();
    Calendar c = new GregorianCalendar();
    c.setTime(d);
    System.out.println(c.get(Calendar.MONTH)+1);
    -nmw-

Maybe you are looking for

  • Placing files from Bridge. Indesign is not an option.

    Placing files from Bridge. Indesign does not show up as an option, only Photoshop and After effects. What am I doing wrong?

  • Where TF is the File menu?!

    Nice going with this new "improved" version with no menubar and few useful options under the Firefox "menu." Whose bright idea was this?

  • Problem with Stateful EJB in JBOSS

    Hi, J have a problem with invoking stateful EJB methods from my web application deployed in Jboss 4.0.5.GA both. The same EJB with WebLogic functions perfectly, instead with Jboss it often throws the following exception: ERROR [org.jboss.ejb.plugins.

  • How to get budget/actual/commitments amount on a given year and period...

    Hello Experts, I need to get the actual, budget and commitment budgets for a given internal orders. Do you guys know any FM/BAPI to get my requirement? Hope you can help me guys. Thank you and take care!

  • Controlling printing and printer

    I am trying to control Adobe Pro (create OLE object of AcroExch) during the printing phase with a number of different options for a print shop. So far so good with a couple of exceptions: a) If Adobe is up when we go to set the printer, I cannot, the