Position() function in XPATH

Hello,
does anyone know how to get the position() function to work in a XPATH Queries? What I tried until now is
SQL>  SELECT EXTRACTVALUE (COLUMN_VALUE, '/row/a/position()') p
  FROM TABLE (XMLSEQUENCE (XMLTYPE ('<row><a></a><a></a></row>')))
Error at line 0
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00601: Invalid token in: '/row/a/position()'The XPATH expression should be fine as it is tested in Stylus Studio.
Any clues?

Does this help
SQL> select extractvalue(column_value('/row/a[position()]') p
  2  from   table(xmlsequence(xmltype('<row><a></a><a></a><row>')));
P
1 row selected
SQL> select extractvalue(column_value('/row/a[position()=1]') p
  2  from   table(xmlsequence(xmltype('<row><a></a><a></a><row>')));
P
1 row selected
SQL> select extractvalue(column_value('/row/a[position()=1]') p
  2  from   table(xmlsequence(xmltype('<row><a>abc</a><a>def</a><row>')));
P
abc
1 row selected
SQL> select extractvalue(column_value('/row/a[position()]') p
  2  from   table(xmlsequence(xmltype('<row><a>abc</a><a>def</a><row>')));
P
abc
1 row selected  http://www.liberidu.com/blog/?p=60

Similar Messages

  • The "reverse position" function for midi in the transform window does not seem to be working.

    So I'm trying to have all of the notes of my midi region play in reverse order. I found out after some research that the way to do this is via the "reverse position" function in the transform window. I opened the parameters for this and it gave me an option to select "inside" a set of measure positions, so I set it to between measure 99 (99 1 1 1) and measure 172 (172 1 1 1) and tried to "select and operate." Nothing. Tried to select manually and then hit "operate." Nothing. I then changed the condition from "inside" to "all" and manually select, then hit "operate," and this time it showed "340 events in one midi region found" at the bottom of the window but still did nothing. I haven't manually counted the notes in the region but that seems like a fair estimate that it's the right number of notes (midi events).
    Any idea why this function seems to do absolutely nothing?

    ((/MAIN/NODE1NODE2 = 'x') EX)
    This means that the condition will eval to true or false ONLY if the node exists?
    (Note: In the actual scenario, I have an IDOC and I wish to perform a similar check on a tag that may or may not exist depending
    upon the situation).
    If your requirement is to check if a node exists or not then below is the condition which you should be using:
    Left Operand: /MAIN/NODE1/NODE2
    Middle Operand: EX
    NO right operand in this case
    Regards,
    Abhishek.

  • Position  function query in XSLT

    I have a query regarding XSLT mapping
    I have two E1EDK03 segments for the same qualifier. But I want the values based on posiotion
    Example:
    <E1EDK03 SEGMENT="1">
             <IDDAT>012</IDDAT>
             <DATUM>20110720</DATUM>
          </E1EDK03>
         <E1EDK03 SEGMENT="1">
             <IDDAT>012</IDDAT>
             <DATUM>20110905</DATUM>
          </E1EDK03>
    If position = 1, I need the 1st set of E1EDK03
    <E1EDK03 SEGMENT="1">
             <IDDAT>012</IDDAT>
             <DATUM>20110720</DATUM>
          </E1EDK03>
    If position = 2, I need the 2nd set of E1EDK03
    <E1EDK03 SEGMENT="1">
             <IDDAT>012</IDDAT>
             <DATUM>20110905</DATUM>
          </E1EDK03>
    How to achieve that using XSLT
    Thanks

    Hi,
    Since we have E1EDK03 with same qualifier 012, I don't have any other identifier to distinguish them, because at one instance I need 1st occurrence of E1EKD03 structure and another instance I need the 2nd occurrence of E1EDK03.
    If you observe, only DATUM will have different values. I was trying to do that using position function
    I have defined a variable to copy the segments and later trying to get the each segment based on position
    <!--copying all the E1EDK03 qualifier 012 segments -->
            <xsl:variable name="e1edk03_qual_012">
                   <xsl:for-each select="//IDOC/*">
                        <xsl:if test="starts-with(name(), 'E1EDK03') and IDDAT = '012'">
                             <xsl:copy-of select="."></xsl:copy-of>
                        </xsl:if>
                   </xsl:for-each>
            </xsl:variable>          
    Now the above code has
    <E1EDK03 SEGMENT="1">
             <IDDAT>012</IDDAT>
             <DATUM>20110720</DATUM>
          </E1EDK03>
         <E1EDK03 SEGMENT="1">
             <IDDAT>012</IDDAT>
             <DATUM>20110905</DATUM>
          </E1EDK03>
    I want to split these into two E1EDK03 segments and use further in the XSLT mapping and populate in the target
    Thanks

  • Position Function for Netezza

    We are trying to update the Netezza.PRM file to include the Position function.  When using it in Designer we get a Parse error that it found a comma (,) when it was expecting 'In' or 'Op' or '=='r '<' or '>'.  Does anyone know the correct parameters for adding the Position function to the Netezza.PRM file?

    There are no native functions for double-bar graphs in CVI. If you are looking for side-by-side bars, something like this
    you can do it with a little trick explained by mzimmers and me in this discussion.
    I'm not aware of a method to obtain stacked bar graphs, if you are looking for them.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How disable track position function in iTunes 7?

    This function is driving me crazy and I can’t seem to be able to disable it!
    iTunes remembers the how far along the song was played before I skip it. This means when the song plays again it comes in half way through.
    I’m a woman on the verge make, please make it stop!
    Thanks

    correct,
    GET INFO > OPTIONS > check or unckeck "Remember Playback Position"
    You can do this in mass as well. Look for the option near the bottom of the edit window.
    I love this new feature myself.
    J.

  • Custom XPath function & customize XPath expression builder

    Hi,
    I have made several custom XPath functions and apparently it is not possible to customize the UI and add these functions to the XPath expression builder.
    Could someone confirm this ?
    Thanks

    Nobody knows the answer?
    I just have the same question.

  • Whats the difference between extending the xls mapper functions and xpath

    What is the whole deal about extending the xlst mapper functions or the xpath functions?
    any insight about the diferences would be greatly appreciated. I mena shouldnt the functions for xlst be the sames that are available for xpath?
    regards,
    gabs

    Unfortunately, XPath and XSL are two different standards, and the implementation of functions at the Java level uses a different interface. So a custom XPath function is not automatically reusable in XSL and vice versa.
    The core java code might be the same, but you need to code different "wrappers" for XPath and XSL.
    Marc

  • POSITION function

    Hello Experts,
    I am using the following column formula:
    POSITION('Administrators' in valueof (NQ_SESSION.GROUP)).
    This returns value 65 if the logged in user is a part of the Administrator Group else it returns 0.
    The problem is I want to convert this value to either integer .This returns the value in varbinary format.
    Can anyone help me?
    thx,
    parag

    Hello Kishore,
    I have a simple report with this column.
    When Im putting a filter on this column:
    POSITION('Manager' in VALUEOF(NQ_SESSION.GROUP))>0,
    When, Im logged in as a user who is not a manager, it is still returning me records rather than showing No Results.

  • XMLType index supporting position in XPath

    I would like to know if it is possible to create index which will support position function in XPath.
    For example:
    Xpath:
    select extractValue(p.pack_content,'/Data/Contractors/Contractor[278]/PermissionNumber')
    from packages p;
    The table packages is based on the schema and it is created by the statement:
    CREATE TABLE packages
    (pack_id NUMBER primary key,
    pack_content XMLType
    XMLTYPE COLUMN pack_content
    XMLSCHEMA "http://www.example.com/example" ELEMENT "Data"
    VARRAY pack_content."XMLDATA"."Contractors"."Contractor"
    STORE AS TABLE pkg_contractors
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$))
    ORGANIZATION INDEX OVERFLOW);
    What kind of indexes should I create?
    Grzegorz.

    Just a stupid example to see if it could be done (not that it works);
    Does it make any sense ?
    No idea if this will work for you, you should further test it
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    5 rows selected.
    SQL> create table temp
      2  (lclob xmltype)
      3  ;
    Table created.
    SQL> insert into temp
      2  values('<itemMaster>
      3  <itemNumber>001000222</itemNumber>
      4  <itemDesc>HGR REUSE BX FOR HANGERRTNS </itemDesc>
      5  <paltSize>1</paltSize>
      6  <stdUOM>1</stdUOM>
      7  <shflfUOM>1</shflfUOM>
      8  <aliases>
      9  <upcCode>123456</upcCode>
    10  <upcCode>490010002222</upcCode>
    11  </aliases>
    12  </itemMaster>
    13  ')
    14  ;
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select extractvalue(lclob,'/itemMaster/aliases/upcCode[position()=2]') from temp;
    EXTRACTVALUE(LCLOB,'/ITEMMASTER/ALIASES/UPCCODE[POSITION()=2]')
    490010002222
    1 row selected.
    SQL> set autotrace on
    SQL> select extractvalue(lclob,'/itemMaster/aliases/upcCode[position()=2]') from temp;
    EXTRACTVALUE(LCLOB,'/ITEMMASTER/ALIASES/UPCCODE[POSITION()=2]')
    490010002222
    1 row selected.
    Execution Plan
    Plan hash value: 1896031711
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |  2002 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| TEMP |     1 |  2002 |     3   (0)| 00:00:01 |
    Note
       - dynamic sampling used for this statement
    Statistics
              0  recursive calls
              0  db block gets
              7  consistent gets
              0  physical reads
              0  redo size
            476  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> create index pos_idx on temp
      2  (extractvalue(lclob,'/itemMaster/aliases/upcCode[position()]'));
    Index created.
    SQL> select extractvalue(lclob,'/itemMaster/aliases/upcCode[position()=2]') from temp;
    EXTRACTVALUE(LCLOB,'/ITEMMASTER/ALIASES/UPCCODE[POSITION()=2]')
    490010002222
    1 row selected.
    Execution Plan
    Plan hash value: 1896031711
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |  2002 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| TEMP |     1 |  2002 |     3   (0)| 00:00:01 |
    Note
       - dynamic sampling used for this statement
    Statistics
             19  recursive calls
              0  db block gets
             19  consistent gets
              0  physical reads
              0  redo size
            476  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> begin  dbms_stats.set_table_stats
      2  ( ownname => 'MARCO'
      3  , tabname => 'TEMP'
      4  , numrows => 50000000  , numblks => 1200000  );
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL> select extractvalue(lclob,'/itemMaster/aliases/upcCode[position()=1]') from temp;
    EXTRACTVALUE(LCLOB,'/ITEMMASTER/ALIASES/UPCCODE[POSITION()=1]')
    123456
    1 row selected.
    Execution Plan
    Plan hash value: 1896031711
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |    50M|  4768M|   265K  (2)| 00:53:04 |
    |   1 |  TABLE ACCESS FULL| TEMP |    50M|  4768M|   265K  (2)| 00:53:04 |
    Statistics
              8  recursive calls
              0  db block gets
              9  consistent gets
              0  physical reads
              0  redo size
            470  bytes sent via SQL*Net to client
            385  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processedMessage was edited by:
    mgralike

  • How to use xpath function to select some particular  nodes

    Dear experts:
    does abap supports  xpath  to sellect particular  nodes  according some node value or condition, i know other  programe language  supports the function selectNode(xpath expression)  , does abap or have the api to support it?
    and i know there is a class support  the xpath but it's not work., the class this:cl_xslt_processor
    to clarify my point. i take a ex.
    the xml doc is follow:
    <?xml version="1.0" encoding="utf-8" ?>
    - <n0:MT_CRM_Req xmlns:n0="http://gome.com/CRM/CRM/Outbound" xmlns:prx="urn:sap.com:proxy:DC0:/1SAI/TAS05C79364B9D0DC5F6738:701:2010/02/19">
    <company name="hp">
    <dep name="gds">
    <empolyeeid>123</empolyeeid>
    </dep>
    <dep name="its">
    <empolyeeid>148</empolyeeid>
    </dep>
    </company>
    <company name="foxconn">
    <dep name="fih">
    <empolyeeid>569</empolyeeid>
    </dep>
    </company>
      </n0:MT_CRM_Req>
    i  want to  select the employee 's company name who empolyee id is 123
    i use the method  ,and the code is :
    l_xslt->set_expression(
    expression = '/n0:MT_CRM_Req/n0:company[n0:dep/n0:empolyeeid=123]'
    nsdeclarations = 'n0 http://gome.com/CRM/CRM/Outbound'
    l_xslt->run('').
    nodes = l_xslt->get_nodes( ).
    LEN = nodes->GET_LENGTH( ) .
    WRITE LEN.
    but no nodes return.
    is anybody knows what's wrong with it? or there is some other api to manipulate the xml dom.
    best regrds!

    Hello Kevin ,
    i think you can get those details , have a look at program BCCIIXMLT1, i think this program will give you some idea to handle * manage xml docs.
    along with that program ...you need to put filter
    *---creating filers.
      filter   = document->create_filter_name( name = 'Company' ).
      iterator = document->create_iterator_filtered( filter ).
      main_node =  document.
    *---processing document.
      perform print_node using main_node p_flag.
    let me know if you need anymore help.
    regards
    Prabhu

  • XPath eval function

    I am looking for a function in xPath that is equivalent to eval() in javascript.
    Basically I have to fields in  a database used for conversion
    Operator --values can be   *   +    -      /
    Amount  --numeric value
    I want to apply the operator and amount to a value inside a transaction. 
    Example. 
    Local.Operator =  " * "
    Local.Amount = 10
    I am looping through tag values and want to dynamically apply the operator and amoun
    Local.NewAmount = LoopValue Local.Operator  Local.Amount
    I want it to   evaluate it to    Local.NewAmount =   LoopValue * 10 
    in javascript it is eval(LoopValue Local.Operator  Local.Amount).
    Any ideas how to do this in a transaction?
    Thanks

    Thanks for the idea, I will give it a try.  
    I also created a small transaction that just uses a switch statement based on the operator, and then adds, multiplies etc. Then returns the value.   It works well for reuse, since multiple transactions need this funcitonality.
    Just have to see which method works better.
    Thanks again,
    Jeff

  • Use USERID from DB and increment it using position() to create new USERID's?

    I'm trying to do the following in XSQL:
    <?xml version="1.0"?>
    <database connection="test" xmlns:xsql="urn:oracle-xsql">
    <xsql:include-request-params/>
    <xsql:query id-attribute="" tag-case="lower" rowset-element="maxuserid" row-element="idnum">
    SELECT MAX(USER_ID) AS "USERID"
    FROM LKUP_USER
    </xsql:query>
    <xsql:insert-request table="LKUP_USER" transform="/dvd/xsl/admin/createusertransform.xsl"/>
    </database>and XSL:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
    <ROWSET>
    <xsl:choose>
    <xsl:when test="/request/parameters[not(row)]">
    <xsl:for-each select="/request/parameters">
    <xsl:call-template name="generate-rows"/>
    </xsl:for-each>
    </xsl:when>
    <xsl:otherwise>
    <xsl:for-each select="/request/parameters/row">
    <xsl:call-template name="generate-rows"/>
    </xsl:for-each>
    </xsl:otherwise>
    </xsl:choose>
    </ROWSET>
    </xsl:template>
    <xsl:template name="generate-rows">
    <ROW>
    <FIRSTNAME><xsl:value-of select="firstname"/></FIRSTNAME>
    <LASTNAME><xsl:value-of select="lastname"/></LASTNAME>
    <PASSWORD><xsl:value-of select="password"/></PASSWORD>
    <EMAIL><xsl:value-of select="user-email"/></EMAIL>
    <ACCESSLEVEL><xsl:value-of select="accesslvl"/></ACCESSLEVEL>
    <USER_ID><xsl:value-of select="/maxuserid/idnum/userid + position()"/></USER_ID>
    </ROW>
    </xsl:template>
    </xsl:stylesheet>which returns the following:
    <?xml version="1.0" ?>
    - <!-- <?xml-stylesheet type="text/xsl" href="/dvd/xsl/admin/createeditdeleteuserconfirm.xsl"?>
    -->
    - <database>
    - <request>
    - <parameters>
    <password>test</password>
    <lastname>test</lastname>
    <firstname>test</firstname>
    <accesslvl>5</accesslvl>
    <user-email>test</user-email>
    </parameters>
    - <session>
    <access>1</access>
    <emailparam>[email protected]</emailparam>
    <adminfirstname>Malik</adminfirstname>
    <adminlastname>Graves-Pryor</adminlastname>
    </session>
    - <cookies>
    <JServSessionIdroot>57ta3u4mns</JServSessionIdroot>
    </cookies>
    </request>
    - <maxuserid>
    - <idnum>
    <userid>17</userid>
    </idnum>
    </maxuserid>
    - <xsql-error action="xsql:insert-request">
    <message>'java.sql.SQLException: ORA-01722: invalid number ' encountered during processing ROW element 1. All prior XML row changes were rolled back. in the XML document.</message>
    </xsql-error>
    </database>You can see what I'm trying to do, but I can't figure out exactly how to implement it. I want to avoid the problem of conflicting USER_ID values in the Oracle DB, so I figured, pull out the max USER_ID before submission and use that when 'row-ifying' the data to create new USER_ID which are incremented based on the position() function.
    Help? Is this even possible?
    p.s.: I realize that I might not be able to do this because the query is not a "request". Is there another way of accomplishing this task?
    p.p.s.: I don't have my XSLT book yet..
    Malik Graves-Pryor

    My book, Building Oracle XML Applications, has lots of XSLT material and examples :-)
    You should use:
    <xsql:set-stylesheet-param>
    to accomplish this. Remember again that the XML that the <xsql:insert-request> sees is not the XML of your data page, but the POSTED XML. The posted XML document will not have the maxid value in it. So, instead just use a top-level stylesheet parameter in your stylesheet:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <!-- Top level stylesheet parameter -->
    <xsl:param name="maxid"/>
    <xsl:template match="/">
    Rest of template here.
    Refer to value of maxid in any XPath expression
    in the stylesheet with $maxid
    </xsl:stylesheet>then in your XSQL page, you use <xsql:set-stylesheet-param> instead of <xsql:query> like this:
    <xsql:set-stylesheet-param name="maxid">
    select max(user_id) from lkup_user
    </xsl:set-stylesheet-param>However -- and this is not an XSQL issue, but a general database thing -- you need to be careful about concurrency issues using the SELECT MAX() trick. If two requests come in simultaneously, they will both SELECT MAX() and get the same current maximum number, then both try to insert a new user. One will (presumably) violate your primary key constraint.
    It's better to use database SEQUENCES instead, so the numbers are guaranteed to be unique. To use a sequence you would just change your SQL statement above to be:
    SELECT yoursequencename.NEXTVAL FROM DUAL
    instead of the SELECT MAX() query.

  • BPEL Engine XPATH (non?) compliance

    Hi,
    what is the level of compliance of BPEL Engine 10.1.3.4 (MLR#8) to XPATH 1.0 or XPATH 2.0?
    Specifically, I am interested in boolean() function. XPATH 1.0 and XPATH 2.0 specifications both state the following:
    http://www.w3.org/TR/xpath/#function-boolean
    >
    Function: boolean boolean(object)
    The boolean function converts its argument to a boolean as follows:
    * a number is true if and only if it is neither positive or negative zero nor NaN
    * a node-set is true if and only if it is non-empty
    * a string is true if and only if its length is non-zero
    * an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type
    >
    http://www.w3.org/TR/xpath-functions/#func-boolean
    >
    15.1.1 fn:boolean
    fn:boolean($arg as item()*) as xs:boolean
    Summary: Computes the effective boolean value of the sequence $arg. See Section 2.4.3 Effective Boolean ValueXP
    * If $arg is the empty sequence, fn:boolean returns false.
    * If $arg is a sequence whose first item is a node, fn:boolean returns true.
    * If $arg is a singleton value of type xs:boolean or a derived from xs:boolean, fn:boolean returns $arg.
    * If $arg is a singleton value of type xs:string or a type derived from xs:string, xs:anyURI or a type derived from xs:anyURI or xs:untypedAtomic, fn:boolean returns false if the operand value has zero length; otherwise it returns true.
    * If $arg is a singleton value of any numeric type or a type derived from a numeric type, fn:boolean returns false if the operand value is NaN or is numerically equal to zero; otherwise it returns true.
    * In all other cases, fn:boolean raises a type error [err:FORG0006].
    >
    In bpel, if I have a switch with a case expression as boolean(bpws:getVariableData('inputVariable','payload','/client:TestRequest/client:StringValue')), this returns false only if the StringValue element is missing in the inputVariable payload. If the StringValue element is present but is empty like <stringElement/>, then this expression returns true.
    Is this a bug?
    Thanks,
    Shanmu.

    bumping up to check if some one can provide more information
    Regards,
    Shanmu.

  • Changing option in function module

    sir,
      plz explain the role or importance of changing option in function module SE37

    hi check this example it had the usage of the changing option..
    here the using will input the value to the perform and do some prosses and output some value..
    PERNR               TYPE P0001-PERNR                           Personnel Number                  
    PLANS               TYPE P0001-PLANS                           Position                          
    ORGEH               TYPE P0001-ORGEH                           Organizational Unit               
    DATE                TYPE SY-DATUM       SY-DATUM               Date and time, current (applic    
    PLVAR               TYPE PLOG-PLVAR     '01'                   Plan Version                      
    ISTAT               TYPE PLOG-ISTAT     '1'                    Planning Status                   
    MANAGER     TYPE     ZHMSS_MANAGER     Structure for manager for MSS
    NO_PERNR_PLANS_ORGEH_SPEC     No pernr, position or org unit specified
    NO_EXIST_PLANS                Position does not exist                 
    INVALID_PLANS                 Position invalid                        
    NO_EXIST_ORGEH                Org unit does not exist                 
    NO_EXIST_PERNR                Personnel number does not exist         
    function z_get_orgunit_manager_info.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(PERNR) TYPE  P0001-PERNR OPTIONAL
    *"     REFERENCE(PLANS) TYPE  P0001-PLANS OPTIONAL
    *"     REFERENCE(ORGEH) TYPE  P0001-ORGEH OPTIONAL
    *"     REFERENCE(DATE) TYPE  SY-DATUM DEFAULT SY-DATUM
    *"     REFERENCE(PLVAR) TYPE  PLOG-PLVAR DEFAULT '01'
    *"     REFERENCE(ISTAT) TYPE  PLOG-ISTAT DEFAULT '1'
    *"  EXPORTING
    *"     REFERENCE(MANAGER) TYPE  ZHMSS_MANAGER
    *"  EXCEPTIONS
    *"      NO_PERNR_PLANS_ORGEH_SPEC
    *"      NO_EXIST_PLANS
    *"      INVALID_PLANS
    *"      NO_EXIST_ORGEH
    *"      NO_EXIST_PERNR
      if pernr is initial and
         plans is initial and
         orgeh is initial.
        raise no_pernr_plans_orgeh_spec.
      endif."pernr is initial and
      if not pernr is initial.
        if pernr cn '0123456789'.
          exit.
        endif.
    *-- See if pernr exists
        call function 'P_EMPLOYEE_CHECKEXISTENCE'
             exporting
                  object_id          = pernr
                  date               = date
             exceptions
                  employee_not_found = 01.
        if sy-subrc ne 0.
          raise no_exist_pernr.
          exit.
        endif.
    *-- Obtain pernr position
        call function 'HR_READ_INFOTYPE'
             exporting
                  pernr           = pernr
                  infty           = c_infty_0001
                  begda           = date
                  endda           = date
             importing
                  subrc           = g_retcd
             tables
                  infty_tab       = i0001
             exceptions
                  infty_not_found = 01
                  others          = 02.
        if sy-subrc eq 0.
          describe table i0001 lines g_lines.
          if g_lines > 0.
            read table i0001 index 1.
    *-- Got position now find org unit
            perform zf_proc_get_om_objects tables i_objects
                                           using c_otype_position
                                                 i0001-plans
                                                 plvar
                                                 c_rsign_a
                                                 c_relat_003
                                                 istat
                                                 date
                                                 date
                                                 c_otype_orgunit
                                        changing g_retcd.
            if g_retcd eq 0.
              read table i_objects index 1.
              g_orgeh = i_objects-sobid(8).
            endif. "g_retcd eq 0.
          endif. "g_lines > 0. for i0001
        endif.  "sy-subrc eq 0 hr_read_infotype
      elseif not plans is initial.
        if plans co '9' or
           plans co '0'.
          raise invalid_plans.
          exit.
        endif.
        call function 'RH_READ_OBJECT'
             exporting
                  plvar     = plvar
                  otype     = c_otype_position
                  objid     = plans
                  istat     = istat
                  begda     = date
                  endda     = date
                  langu     = sy-langu
             exceptions
                  not_found = 1
                  others    = 2.
        if sy-subrc <> 0.
          raise no_exist_plans.
          exit.
        endif.
    *-- Find org unit
        perform zf_proc_get_om_objects tables i_objects
                                       using c_otype_position
                                             plans
                                             plvar
                                             c_rsign_a
                                             c_relat_003
                                             istat
                                             date
                                             date
                                             c_otype_orgunit
                                    changing g_retcd.
        if g_retcd eq 0.
          read table i_objects index 1.
          g_orgeh = i_objects-sobid(8).
        endif."g_retcd eq 0.
      elseif not orgeh is initial.
        call function 'RH_READ_OBJECT'
             exporting
                  plvar     = plvar
                  otype     = c_otype_orgunit
                  objid     = orgeh
                  istat     = istat
                  begda     = date
                  endda     = date
                  langu     = sy-langu
                  CHECK_STRU_AUTH   = space              "ASikaria, 10/15
             exceptions
                  not_found = 1
                  others    = 2.
        if sy-subrc <> 0.
          raise no_exist_orgeh.
          exit.
        endif.
        g_orgeh = orgeh.
      endif. "not pernr is initial.
      if not g_orgeh is initial.
        manager-orgeh = g_orgeh.
    *-- Got org unit now find manager
        perform zf_proc_get_om_objects tables i_objects
                                       using c_otype_orgunit
                                             manager-orgeh
                                             plvar
                                             c_rsign_b
                                             c_relat_012
                                             istat
                                             date
                                             date
                                             c_otype_position
                                    changing g_retcd.
        if g_retcd eq 0.
          read table i_objects index 1.
          if sy-subrc eq 0.
            manager-plans = i_objects-sobid.
            call function 'Z_GET_POSITION_HOLDER'
                 exporting
                      plans              = manager-plans
                      plvar              = plvar
                      istat              = istat
                      date               = date
                 importing
                      pernr              = manager-pernr
                 exceptions
                      position_not_exist = 1
                      position_invalid   = 2
                      others             = 3.
            if sy-subrc <> 0.
              clear: manager-pernr.
            endif.
            if not manager-pernr is initial.
    *- BOC RTDK902962
    *-- Obtained formatted name
              clear: i0001.
              refresh: i0001.
              call function 'HR_READ_INFOTYPE'
                   exporting
                        pernr           = manager-pernr
                        infty           = c_infty_0001
                        begda           = date
                        endda           = date
                   importing
                        subrc           = g_retcd
                   tables
                        infty_tab       = i0001
                   exceptions
                        infty_not_found = 1
                        others          = 2.
              if sy-subrc eq 0.
                read table i0001 index 1.
                if sy-subrc eq 0.
                  manager-ename = i0001-ename.
                endif.
              endif.
    *- EOC RTDK902962
    *-- Obtain pernr information
    *- Get 0002 data
              clear: i0002.
              refresh: i0002.
              call function 'HR_READ_INFOTYPE'
                   exporting
                        pernr           = manager-pernr
                        infty           = c_infty_0002
                        begda           = date
                        endda           = date
                   importing
                        subrc           = g_retcd
                   tables
                        infty_tab       = i0002
                   exceptions
                        infty_not_found = 1
                        others          = 2.
              if sy-subrc eq 0.
                read table i0002 index 1.
                if sy-subrc eq 0.
                  manager-inits = i0002-inits.
                  manager-vorna = i0002-vorna.
                  manager-nachn = i0002-nachn.
                  manager-midnm = i0002-midnm.
                endif.
              endif.
    *- Get 0105 data
              clear: i0105.
              refresh: i0105.
              call function 'HR_READ_INFOTYPE'
                   exporting
                        pernr           = manager-pernr
                        infty           = c_infty_0105
                        begda           = date
                        endda           = date
                   importing
                        subrc           = g_retcd
                   tables
                        infty_tab       = i0105
                   exceptions
                        infty_not_found = 1
                        others          = 2.
              if sy-subrc eq 0.
                describe table i0105 lines g_lines.
                if g_lines > 0.
    *- SAP usrid
                  loop at i0105 where subty = c_0105_usrid_subty.
                    manager-usrid = i0105-usrid.
                  endloop.
    *- Email address
    *// not sure where email is going to be stored but assume it is subtype
    *// 0010
                  loop at i0105 where subty = c_0105_email_subty.
                    manager-email = i0105-usrid_long.
                  endloop.
                endif. "g_lines > 0
              endif."sy-subrc eq 0.
            endif. "not manager-pernr is initial.
          endif. "sy-subrc eq 0.
        endif."g_retcd eq 0.
      endif. "not g_orgeh is initial.
    endfunction.
    zposition holder
    PLANS     TYPE     PLOG-OBJID                               Object ID
    PLVAR     TYPE     PLOG-PLVAR     '01'     Plan Version
    ISTAT     TYPE     PLOG-ISTAT     '1'     Planning Status
    DATE     TYPE     SY-DATUM     SY-DATUM     Date and time, current (application server) date
    PERNR               TYPE      P0001-PERNR                 Personnel Number                
    POSITION_NOT_EXIST            Position does not exist                 
    POSITION_INVALID              Invalid position                        
    function z_get_position_holder.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(PLANS) TYPE  PLOG-OBJID
    *"     REFERENCE(PLVAR) TYPE  PLOG-PLVAR DEFAULT '01'
    *"     REFERENCE(ISTAT) TYPE  PLOG-ISTAT DEFAULT '1'
    *"     REFERENCE(DATE) TYPE  SY-DATUM DEFAULT SY-DATUM
    *"  EXPORTING
    *"     REFERENCE(PERNR) TYPE  P0001-PERNR
    *"  EXCEPTIONS
    *"      POSITION_NOT_EXIST
    *"      POSITION_INVALID
      if plans cn '0123456789'.
        raise position_invalid.
      endif."plans cn '0123456789'.
      if plans co '9'.  "default position
        exit.
      endif.
      call function 'RH_READ_OBJECT'
           exporting
                plvar     = plvar
                otype     = c_otype_position
                objid     = plans
                begda     = date
                endda     = date
           exceptions
                not_found = 01
                others    = 02.
      if sy-subrc ne 0.
        raise position_not_exist.
      else.
        perform zf_proc_get_om_objects tables i_objects
                                       using c_otype_position
                                             plans
                                             plvar
                                             c_rsign_a
                                             c_relat_008
                                             istat
                                             date
                                             date
                                             c_otype_pernr
                                    changing g_retcd.
        if g_retcd eq 0.
          sort i_objects by begda descending. "get earliest rec
          read table i_objects index 1.
          if sy-subrc eq 0.
            pernr = i_objects-sobid(8).
          endif.
        endif. "g_retcd eq 0.
      endif. "sy-subrc ne 0.
    endfunction.
    regards,
    venkat

  • Parsing an xml document using  XPATH

    Hello,
    I am pretty new to programming "Java and XML" and right now very confused with the range of available xml parsers,xpath engines and xslt processors.I need some guidance on how to parse a xpath expression with variables in it .
    Thanks,
    Chan.

    Gregory . Thank you so much for the insight into parsing and xpath expression evalaution . I downloaded the XpathExamples.java file , practical xml jar file and executed the program to see the output for various example functions that you have created .All of them worked perfectly without any issues.
    In the variablesExample() function , I added the following lines to check if it works :
    variables.put(new QName("myvar"), "foo");
    System.out.println("myvar bound as 'argle' = " + xpath.evaluate("/$foo/bar/baz", dom));
    I ran into exceptions like ..
    Exception in thread "main" javax.xml.transform.TransformerException: Extra illegal tokens: '$', 'foo', '/', 'bar', '/', 'baz'
    Can you please tell me what was I doing wrong ? I am also planning to use starts-with() function in xpath expression . Will it work ?
    Thank you for your reasoning.

Maybe you are looking for

  • What is the pre-requisite of getting  delivery completed indicator in PO

    Hi , I we have done complete GR against a PO item still delevery completion indicator is not set for this material in PO, Is there any other condition to be fulfllled to get this indicator? we don not have any over delivery tolerance . Thanks in Adva

  • Time doesn't change!

    the time on my iphone 3g is somehow an hour late, i tried ti change it manually through the following steps: Setttings>general>date & time but somehow it always returns me back to the home screen, i don't know why?! Is there another way to manually c

  • External table in Oracle 10g and Windows server 2003

    I'm having a problem accessing an external table in an Oracle 10g and Windows 2003 server environment. The disk is remote (mapped) to the server. It's the usual access errors, kup-04001 or kup-04063. I have the [seemingly] exact same setup in an Orac

  • Raw images from 1GX are rendering soft in Aperture - crystal clear on Lightroom

    I have just upgraded to a Canon 1Gx MK II as my point & shoot.  RAW images are rendering terribly soft in Aperture - crystal clear in Lightroom.  Any ideas?

  • Change semanticColor of cell editor

    Hi Experts, I have a table and depending on the values of a particular field I want the color of the cell editor to change in one of the columns. How can I achieve that. The table has values populated at run time depending on the inputs from the user