Get the Current Quarter  and Current Week from date

Hi,
I want to get the Current quarter and Current week from a given date, which function modules should i use?
I tried using function module - 'HR_99S_GET_QUARTER' for getting the quarter but it is throwing an error while loading data. Moreover it doesnt exist in BI7.
Similarly for current week.
Please help. Sample code snippets would be appreciated.
Thanks
Jaya

You can use FORM time_conversion wich is the one used by standard in Update Rules:
You can select whether convert 0CALDAY to 0CALWEEK or whatever infobject formats you prefer...
  perform time_conversion
            using  '0CALDAY'
                   '0CALMONTH'
                    p_input_date
                    l_fscvtval
            changing RESULT
                     c_t_idocstate
                     c_subrc
                     c_abort.
  if c_subrc <> 0 or c_abort <> 0.
    exit.
  endif.
form time_conversion
               using i_timnm_from type rsiobjnm
                     i_timnm_to   type rsiobjnm
                     i_timvl
                     i_fiscvarnt  type t009b-periv
               changing e_timvl
                        c_t_idocstate  type rsarr_t_idocstate
                        c_subrc   like sy-subrc
                        c_abort   like sy-subrc. "#EC *
data: l_timvl  type rsd_chavl,
      l_result type rsd_chavl.
  IF i_timvl CO ' 0'.
    CLEAR e_timvl.
    EXIT.
  ENDIF.
  l_timvl = i_timvl.
  CALL FUNCTION 'RST_TOBJ_TO_DERIVED_TOBJ'
    EXPORTING
      i_timnm_from             = i_timnm_from
      i_timnm_to               = i_timnm_to
      i_timvl                  = l_timvl
      I_FISCVARNT              = i_fiscvarnt
      I_BUFFER                 = rs_c_true
    IMPORTING
      E_TIMVL                  = l_result
    EXCEPTIONS
      INCOMPATIBLE_TOBJS       = 1
      NO_INPUT_VALUE           = 2
      FISCVARNT_MISSING        = 3
      INPUT_NOT_NUMERIC        = 4
      WRONG_DATE               = 5
      WRONG_FISCPER            = 6
      X_MESSAGE                = 7
      OTHERS                   = 8
  e_timvl = l_result.
ENDFORM.                  "TIME_CONVERSION

Similar Messages

  • How to get the column name and table name from xml file

    I have one XML file, I generated xsd file from that xml file but the problem is i dont know table name and column name. So my question is how can I retrieve the data from that xml file?

    Here's an example using binary XML storage (instead of Object-Relational storage as described in the article).
    begin
      dbms_xmlschema.registerSchema(
        schemaURL       => 'my_schema.xsd'
      , schemaDoc       => xmltype(bfilename('TEST_DIR','my_schema.xsd'), nls_charset_id('AL32UTF8'))
      , local           => true
      , genTypes        => false
      , genTables       => true
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS
      , options         => dbms_xmlschema.REGISTER_BINARYXML
    end;
    genTables => true : means that a default schema-based XMLType table will be created during registration.
    enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS : indicates that a repository resource conforming to the schema will be automatically stored in the default table.
    If the schema is not annotated, the name of the default table is system-generated but derived from the root element name :
    SQL> select table_name
      2  from user_xml_tables
      3  where xmlschema = 'my_schema.xsd'
      4  and element_name = 'employee';
    TABLE_NAME
    employee1121_TAB
    (warning : the name is case-sensitive)
    To annotate the schema and control the naming, modify the content to :
    <?xml version="1.0" encoding="UTF-8" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
      <xs:element name="employee" xdb:defaultTable="EMPLOYEE_XML">
        <xs:complexType>
    Next step : create a resource, or just directly insert an XML document into the table.
    Example of creating a resource :
    declare
      res  boolean;
      doc  xmltype := xmltype(
    '<employee>
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>'
    begin
      res := dbms_xdb.CreateResource(
               abspath   => '/public/test.xml'
             , data      => doc
             , schemaurl => 'my_schema.xsd'
             , elem      => 'employee'
    end;
    The resource has to be schema-based so that the default storage mechanism is triggered.
    It could also be achieved if the document possesses an xsi:noNamespaceSchemaLocation attribute :
    SQL> declare
      2 
      3    res  boolean;
      4    doc  xmltype := xmltype(
      5  '<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      6             xsi:noNamespaceSchemaLocation="my_schema.xsd">
      7    <details>
      8      <emp_id>1</emp_id>
      9      <emp_name>SMITH</emp_name>
    10      <emp_age>40</emp_age>
    11      <emp_dept>10</emp_dept>
    12    </details>
    13   </employee>'
    14   );
    15 
    16  begin
    17    res := dbms_xdb.CreateResource(
    18             abspath   => '/public/test.xml'
    19           , data      => doc
    20           );
    21  end;
    22  /
    PL/SQL procedure successfully completed
    SQL> set long 5000
    SQL> select * from "employee1121_TAB";
    SYS_NC_ROWINFO$
    <employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceS
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>
    Then use XMLTABLE to shred the XML into relational format :
    SQL> select x.*
      2  from "employee1121_TAB" t
      3     , xmltable('/employee/details'
      4         passing t.object_value
      5         columns emp_id   integer      path 'emp_id'
      6               , emp_name varchar2(30) path 'emp_name'
      7       ) x
      8  ;
                                     EMP_ID EMP_NAME
                                          1 SMITH

  • How to get the number of minutes or hours from date arithmetic ?

    Thanks in advance,
    I have two date fields that I would like to derive the number of minutes or hours via the following:
    select start_date - end_date from dual;
    How do I get HH:MM results ? Thanks

    If greater than 24 hours you'll need to calculate the hours and minutes as numbers individually. (You can then display them in whatever format you choose)
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('6-10-2008 08:00','DD-MM-YYYY HH24:MI') as from_dt, to_date('7-10-2008 12:30','DD-MM-YYYY HH24:MI') as to_dt from dual)
      2  --
      3  select from_dt, to_dt, to_dt-from_dt
      4        ,to_char(trunc(sysdate)+(to_dt-from_dt),'HH24:MI') as hrs_mins
      5        ,trunc((to_dt-from_dt)*24) as hrs
      6        ,trunc((((to_dt-from_dt)*24)-trunc((to_dt-from_dt)*24))*60) as mins
      7* from t
    SQL> /
    FROM_DT           TO_DT             TO_DT-FROM_DT HRS_M        HRS       MINS
    06-OCT-2008 08:00 07-OCT-2008 12:30        1.1875 04:30         28         30
    SQL>

  • Problem with getting the file name and type from OAMessageFileUploadBean

    Hi Tapash,
    I am trying the code below to get the file name and mime type from OAMessageFileUploadBean,
    DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("Documents");
    String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
    String contentType = fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
    But this piece of code gives errors saying that selectValue selectValue(null, java.lang.String) not found in class oracle.svc.DataObject
    Any ideas? why this code is giving error?
    Can i handle the event of browse button for OAMessageFileUploadBean?
    Regards,
    Nagesh Manda.

    Try using class oracle.cabo.ui.data.DataObject
    --Shiv                                                                                                                                                                                                       

  • To get the company code and country grouping attached to a position

    Hi everyone,
    I have a position and I need to get the company code and the country grouping that this position is attached to. Could you kindly suggest an FM or a class which would fetch the above data keeping in mind the inheritance tree. That is, if the company code is not maintained in HRP1008, then it should look for the same in the Org Unit that this position belongs to and so on..
    Any help will be greatly appreciated.
    Regards,
    Alpana.

    Hi
    Check the A011 relationship of the position and get the cost center, from cost center you can get the company code and country grouping from Cost Center Master CSKS.
    ~~~Ganesh Kumar K.

  • How to get Current Quarter and Fiscal Quarter for a Date - Fiscal Year starts from 1st April

    Hi, 
    I need to calculate current quarter and fiscal quarter in my Sql query.
    I have a column for DateTime Datatype. 
    I need to find out Current Quarter Name like Q12012, Q22012, Q32012, Q42012 and Fiscal Quarter Name as well.
    Now Fiacal Year starts from 1st April, and Current Quarter starts from 1st Jan.
    For Current Quarter of 2012
    Jan-Mar = Q12012
    Apr-Jun = Q22012
    Jul-Sep = Q32012
    Oct-Dec = Q42012
    For Fiscal Quarter of 2012 ( starts from 1st Apr, 2011 )
    Apr2011-Jun2011 = Q12012
    Jul2011-Sep2011 = Q22012
    Oct2011-Dec2011 = Q32012
    Jan2011-Mar2012 = Q42012
    means if its 1st April, 2012,
    its a new Fiacal Year 2013 so Fiacal Quarter Name should be Q12013
    and its Current Quarter Name should be Q22012
    Can you help me to calculate this in a select query for given dates?
    Thanks in advance, 
    Nirav

    This should do it..
    Select
    FORMAT(datepart(quarter,getdate()),'Q#')+FORMAT(getdate(),'yyyy')

  • How to write customer exit in my BI query to get (current fiscal quarter) and (current fiscal quarter - 1 ) without user input

    Hi all,
    I need your help how to write customer exit in my BI query to get (current fiscal quarter) and (current fiscal quarter - 1 ) without user input.
    in my query info object is 0CALQUARTER and variable is ZFIS_QTR.
    in 0CALQUARTER fiscal quarter stored in 201301,201302,201303,201304 and 201401 format, for current fiscal quarter 201401 and (current fiscal quarter - 1 ) would be 201304.
    please replay ASAP to deliver the report to client.
    thanks in advance.
    -- Rakesh Nagpure

    I am Getting the same error for both the codes that i have written...
    Do i Need to write sth else in the code...
    Code:
    WHEN 'ZVLIVELEASES'.
      IF I_STEP = 2.
            L_DATE = SY-DATUM.
            SELECT * FROM "DSO_ACTIVE_TABLE"
                INTO TABLE ITAB_LL where "EXPIRY_DATE" > L_DATE.
            LOOP AT ITAB_LL INTO WA_LL.
            CLEAR l_s_range.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            l_s_range-low = WA_LL-"EXPIRY_DATE".
           APPEND L_S_RANGE TO E_T_RANGE.
            ENDLOOP.
       ENDIF.
    Error: Error for variable in customer enhancement ZLIVELEASES

  • How do I get the full path and filename of the current document?

    I'm writing a format plug-in. How do I obtain the full path and filename of the current image (document) from within my plug-in? Any help would be greatly appreciated!

    I actually just figured this out. For anyone else who would like to know, check out the propetizer sample code in the photoshop sdk. It makes a "filter" plug-in that just spits out all the properties of the document you could ever want to know about. The function I used to get the full path and filename of the current document is PIGetDocumentName(). I hope this helps someone eventually...

  • I currently have LR 5.7 and am interested in getting upgraded to LR 6. If I get the package LR and CC what happens to my LR 5.7 and the library I have on it now??

    What happens to my LR 5.7 and it's library if I get the package LR and CC?

    Back up your music and install from the website. You probably won't need to do this, but if your library is erased, restore it from the backup.
    (59049)

  • Balance sheet required for current quarter and previous quarter

    Hi Guys,
                 I am using 0FIGL_C10 cube for balance sheet report,i need to create balances for current quarter and previous quarter.
    user will enter the fisper, based on fisper it has to show the current quarter and previous quarter balance.
    how to calculate the quarter using fisper.

    you can use offset with ranges.
    or
    just offset of -1 , -2 & -3 seperately in 3 selections and add it in one column in formula (this will give u current quarter).
    similarly offset of -4, -5 , -6 will give u previous quarter result.
    total of 6 selection and 2 formulas. hide all selections from display.

  • Current quarter and four future quarters

    Hello Forum Members,
    I have a config table with the following data:
    Quarter Config Rep_date
    Q1-2006|1|1/1/2006
    Q2-2006|32|4/12/2006
    Q3-2006|321|7/15/2006
    Q4-2006|897|12/14/2006
    Q1-2007|10|2/12/2007
    Q2-2007|10|5/12/2007
    Q4-2007|50|11/12/2007
    Q1-2008|30|1/1/2008
    Q2-2008|57|4/10/2008
    Q4-2008|45|12/12/2008
    Q3-2008|34|8/8/2008
    Q4-2005|21|12/1/2005
    Q3-2005|20|8/22/2005
    Q2-2005|65|4/14/2005
    Q1-2005|65|1/14/2005
    Q3-2007|435|9/9/2007
    I have to show current quarter and four future quarters in oracle form.
    ie
    Q4-2007|50|
    Q1-2008|30|
    Q2-2008|57|
    Q3-2008|34|
    Q4-2008|45|
    Please advise me.
    Thanks

    Coming at it from a different angle, you could fix the data before doing the query. This makes the query much simpler, which is good if it has to be used in many places in the application. Obviously the best way would be to make the quarter column a date column, but that's not always possible. A view or a function-based index can do the same job:
    DROP TABLE quarters;
    CREATE TABLE quarters AS
    SELECT a quarter, b config, To_Date(c,'MM/DD/YYYY') rep_date FROM(
      SELECT 'Q1-2006' a, 1 b, '1/1/2006' c FROM dual UNION ALL
      SELECT 'Q2-2006', 32, '4/12/2006' FROM dual UNION ALL
      SELECT 'Q3-2006', 321, '7/15/2006' FROM dual UNION ALL
      SELECT 'Q4-2006', 897, '12/14/2006' FROM dual UNION ALL
      SELECT 'Q1-2007', 10, '2/12/2007' FROM dual UNION ALL
      SELECT 'Q2-2007', 10, '5/12/2007' FROM dual UNION ALL
      SELECT 'Q4-2007', 50, '11/12/2007' FROM dual UNION ALL
      SELECT 'Q1-2008', 30, '1/1/2008' FROM dual UNION ALL
      SELECT 'Q2-2008', 57, '4/10/2008' FROM dual UNION ALL
      SELECT 'Q4-2008', 45, '12/12/2008' FROM dual UNION ALL
      SELECT 'Q3-2008', 34, '8/8/2008' FROM dual UNION ALL
      SELECT 'Q4-2005', 21, '12/1/2005' FROM dual UNION ALL
      SELECT 'Q3-2005', 20, '8/22/2005' FROM dual UNION ALL
      SELECT 'Q2-2005', 65, '4/14/2005' FROM dual UNION ALL
      SELECT 'Q1-2005', 65, '1/14/2005' FROM dual UNION ALL
      SELECT 'Q3-2007', 435, '9/9/2007' FROM dual
    CREATE OR REPLACE FUNCTION get_qtr_date(p IN VARCHAR2) RETURN DATE DETERMINISTIC AS
    BEGIN
      RETURN Add_Months(Trunc(To_Date(SubStr(p,4),'YYYY'),'YYYY'), (To_Number(SubStr(p,2,1))-1)*3);
    END;
    CREATE INDEX function_based ON quarters(get_qtr_date(quarter));
    SELECT * FROM quarters
    WHERE get_qtr_date(quarter) BETWEEN Trunc(SYSDATE-100,'Q') AND Add_Months(Trunc(SYSDATE-100,'Q'), 12)
    ORDER BY get_qtr_date(quarter);
    QUARTER CONFIG REP_DATE
    Q3-2007    435 09-SEP-07
    Q4-2007     50 12-NOV-07
    Q1-2008     30 01-JAN-08
    Q2-2008     57 10-APR-08
    Q3-2008     34 08-AUG-08Another benefit of a function-based index on a column which has to take a specific format is that you can validate the data on the way in rather than checking it on the way out. For example:
    CREATE OR REPLACE FUNCTION get_qtr_date(p IN VARCHAR2) RETURN DATE DETERMINISTIC AS
    BEGIN
      IF InStr(p,'Q') != 1 THEN
        Raise_Application_Error(-20000, 'Invalid quarter format');
      END IF;
      RETURN Add_Months(Trunc(To_Date(SubStr(p,4),'YYYY'),'YYYY'), (To_Number(SubStr(p,2,1))-1)*3);
    END;
    INSERT INTO quarters VALUES('P3-2009',100,To_Date('10/10/2009','DD/MM/YYYY'));
    ORA-20000: Invalid quarter format
    ORA-06512: at "TEST.GET_QTR_DATE", line 4

  • How to get the number of files currently open?

    hi,
    does any one know how to get the number of files currently open in windows OS?
    e.g. lets say .txt files...
    any comment will be really appreciated.
    thanks

    Assuming that you don't want to actually do this from within Java code (which would obviously require native code), here's a utility that will give you a list of which file handles are opened by which processes (on Windows):
    http://www.sysinternals.com/ntw2k/freeware/handle.shtml
    - K

  • How to get the first day of current month

    hi guys,
    i am trying to get the first day of current month which get from the date i input at the selection screen. my method is not so good, so i was wondering if there is better way to get the this,
    thanks.

    Try this .
    data : DAYNR LIKE  HRVSCHED-DAYNR,
         DAYTXT LIKE  HRVSCHED-DAYTXT.
    data langu like sy-langu value 'EN'.
    Parameters PDATE LIKE SY-DATUM.
    PDATE+6(02) = '01'.
    CALL FUNCTION 'RH_GET_DATE_DAYNAME'
      EXPORTING
        LANGU                     = LANGU
        DATE                      = PDATE
      CALID                     =
    IMPORTING
       DAYNR                     = DAYNR
       DAYTXT                    = DAYTXT
      DAYFREE                   =
    EXCEPTIONS
      NO_LANGU                  = 1
      NO_DATE                   = 2
      NO_DAYTXT_FOR_LANGU       = 3
      INVALID_DATE              = 4
      OTHERS                    = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE :/ PDATE, DAYNR, DAYTXT.
    Cheers

  • How can I get the UDA of a current member in a calc scrpt?

    Hi!
    I need to get the UDA of a current meber of a dimension.
    Ex:
    I have the Accout1 and I need to know its UDA. So i can use it like a string. And I need to do it in a dynamic way.
    I hope someone can help me :)
    Thanks in advance.
    Bye

    I don't believe the code sample would work. Vars only store numeric amounts in a calc script. I think you have to work at it backward(If it will work) and perhaps fix on the UDA you want then check to see if it is the member. If you are trying to do something like get the uda for a member then use that uda to create a member name for a subsequent calc good luck. I think you would have to create a custom defined macro or function to do that.
    One note, Vars in business rules can store other things but in a straight calc script they can't
    Edited by: GlennS_2 on Oct 16, 2009 7:29 AM

  • Display Current Quarter and Previous Quarter???

    Hi Gurus,
    I Had a requirement to display only the current Quarter and previous quarter in the report level using single quarter column.
    and my quarter value type is Q1 2013.
    Please anyone help me out on this asap/
    Thanks.

    Hi,
    Using time serious function you can acheive this requirement.
    http://obieetutorialguide.blogspot.in/2012/02/modeling-time-series-function-in-obiee.html
    OBIEE 11g Time Series Function
    or,
    Using presentation variable you can achieve this.
    Re: OBIEE 10g LY YTD returns YTD for past years
    The above thread for year you can change to qtr.
    Hope this help's
    Thanks,
    Satya

Maybe you are looking for