Role resolution of AC00000157 question
Kjetil Kilhavn
kjetilk at statoil.com
Wed Jul 31 03:12:20 EDT 2002
Unfortunately the standard function does not allow specification of the
evaluation date, SYST-DATUM is hardcoded in the function.
I don't know why RH_STRUC_GET wasn't used (date specification allowed), but
hopefully he who developed our function had a good reason :-)
I don't think there was a predefined path which included the manager's
substitute (A010) - at least not when we started using this in release 3.1
- but again it was before my time.
--
Kjetil Kilhavn
"Dart, Jocelyn"
<jocelyn.dart at sap.co To: SAP-WUG at MITVMA.MIT.EDU
m> cc: (bcc: Kjetil Kilhavn)
Sent by: SAP Subject: Re: Role resolution of AC00000157 question
Workflow
<Owner-SAP-WUG at MITVM
A.MIT.EDU>
31.07.2002 08:04
Please respond to
"SAP Workflow Users'
Group"
Hi Kjetil/Shane,
Your code is interesting but it might be easier to use standard function
module
RH_GET_STRUCTURE that lets you specify an evaluation path and the starting
org unit/position/user/whatever
and gives you the result. You should find all the evaluation paths you
need already
available in table T778A to find the relationships you want.
Regards,
Jocelyn Dart
Consultant (SRM, EBP, Workflow)
and co-author of the book
"Practical Workflow for SAP"
SAP Australia
jocelyn.dart at sap.com
+61 412 390 267
+61 2 9935 4880
-----Original Message-----
From: Kjetil Kilhavn [mailto:kjetilk at statoil.com]
Sent: Friday, 26 July 2002 9:38 PM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: Role resolution of AC00000157 question
The code is fairly simple. Loop until a user has been found (don't forget
an exit condition if there are no superior orgunits).
You only need three relations I suppose:
- reports to (O to O)
- is managed by (O to S, perhaps it can also be O to P, perhaps even O to
US)
- holder (S to P)
Look up directly in HRP1001 for these relations, or spend some hours
finding a function module to look it up.
Here is our implementation for a similar problem
Z008 is used to hold temporary positions (when a person is lent from one
unit to another for a longer period).
Z_O_S_P returns managers for an O-object and is defined as O => B012 => S
and S => A008 => P and S => A010 => P
* Find the person's position
SELECT SINGLE * "look for temporary position
FROM hrp1001
WHERE otype = 'P' AND
objid = i_person AND
plvar = l_plvar AND
istat = '1' AND
relat = 'Z08' AND
sclas = 'S' AND
begda <= i_date AND
endda >= i_date.
IF syst-subrc = 0.
l_temppos = true.
ENDIF.
CLEAR wa_hrobjects.
l_moveup = true.
WHILE l_moveup = true.
* Find the position(s) and person(s) who can approve
REFRESH it_hrobjects.
CALL FUNCTION 'Z_B_TB_GET_PD_RELATIONSHIP'
EXPORTING
otype = e_otype
objid = e_objid
wegid = 'Z_O_S_P'
subty = space
date = syst-datum
TABLES
objects = it_hrobjects
EXCEPTIONS
nothing_found = 1
OTHERS = 2.
IF syst-subrc = 0.
l_moveup = false.
* If person had temporary position, check it
IF l_temppos = true.
READ TABLE it_hrobjects
INTO wa_hrobjects
WITH KEY otype = 'S'
objid = hrp1001-sobid.
ENDIF.
* Look for person among those who can approve
IF wa_hrobjects IS INITIAL.
READ TABLE it_hrobjects
INTO wa_hrobjects
WITH KEY otype = 'P'
objid = i_person.
ENDIF.
ENDIF.
IF NOT wa_hrobjects IS INITIAL.
l_moveup = true.
ENDIF.
IF l_moveup = true.
* Person approves for this unit, or no approvers, traverse up
* Traverse for the same date as used to find unit for person
CLEAR wa_hrobjects.
REFRESH it_hrobjects.
CALL FUNCTION 'Z_B_TB_GET_PD_RELATIONSHIP'
EXPORTING
otype = e_otype
objid = e_objid
wegid = space
subty = 'A002' "reports to
date = i_date
TABLES
objects = it_hrobjects
EXCEPTIONS
nothing_found = 1
OTHERS = 2.
IF syst-subrc <> 0.
"No unit to report to. Exit with objid = 0 and signal error
e_objid = 0.
l_moveup = false.
RAISE nobody_found.
ELSE.
LOOP AT it_hrobjects
INTO wa_hrobjects
WHERE otype = 'O ' AND
objid <> e_objid.
e_otype = wa_hrobjects-otype.
e_objid = wa_hrobjects-objid.
ENDLOOP.
ENDIF.
CLEAR wa_hrobjects.
ENDIF.
ENDWHILE.
FUNCTION Z_B_TB_GET_PD_RELATIONSHIP.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(OTYPE) LIKE HROBJECT-OTYPE
*" VALUE(OBJID) LIKE HROBJECT-OBJID
*" VALUE(WEGID) LIKE T778A-WEGID
*" VALUE(SUBTY) LIKE PLOG-SUBTY DEFAULT SPACE
*" VALUE(DATE) LIKE SY-DATUM DEFAULT SY-DATUM
*" TABLES
*" OBJECTS STRUCTURE HROBJECT
*" EXCEPTIONS
*" NOTHING_FOUND
*"----------------------------------------------------------------------
DATA I1001 LIKE P1001 OCCURS 5 WITH HEADER LINE.
DATA IT77AW LIKE T77AW OCCURS 5 WITH HEADER LINE.
DATA PLVAR LIKE OBJEC-PLVAR.
DATA RELAT LIKE PLOG-SUBTY.
DATA LIN TYPE I.
CALL FUNCTION 'RH_GET_PLVAR'
IMPORTING
PLVAR = PLVAR
EXCEPTIONS
NO_PLVAR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
RAISE NOTHING_FOUND.
EXIT.
ENDIF.
OBJECTS-PLVAR = PLVAR.
OBJECTS-OTYPE = OTYPE.
OBJECTS-OBJID = OBJID.
APPEND OBJECTS.
IF WEGID <> SPACE.
SELECT * INTO TABLE IT77AW FROM T77AW
WHERE WEGID = WEGID ORDER BY PRIMARY KEY.
ELSE.
IT77AW-OTYPE = OTYPE.
IT77AW-RSIGN = SUBTY(1).
IT77AW-RELAT = SUBTY+1.
APPEND IT77AW.
ENDIF.
LOOP AT IT77AW.
CONCATENATE IT77AW-RSIGN IT77AW-RELAT INTO RELAT.
CALL FUNCTION 'RH_READ_INFTY_1001'
EXPORTING
SUBTY = RELAT
BEGDA = DATE
ENDDA = DATE
TABLES
I1001 = I1001
OBJECTS = OBJECTS
EXCEPTIONS
NOTHING_FOUND = 1
WRONG_CONDITION = 2
OTHERS = 3.
IF SY-SUBRC = 0.
* refresh hlp_obj. clear hlp_obj.
IF WEGID <> SPACE.
LOOP AT I1001 WHERE SCLAS = IT77AW-SCLAS.
OBJECTS-PLVAR = PLVAR.
OBJECTS-OTYPE = I1001-SCLAS.
OBJECTS-OBJID = I1001-SOBID.
APPEND OBJECTS.
ENDLOOP.
ELSE.
LOOP AT I1001.
OBJECTS-PLVAR = PLVAR.
OBJECTS-OTYPE = I1001-SCLAS.
OBJECTS-OBJID = I1001-SOBID.
APPEND OBJECTS.
ENDLOOP.
ENDIF.
REFRESH I1001. CLEAR I1001.
ENDIF.
ENDLOOP.
SORT OBJECTS BY OTYPE OBJID.
DELETE ADJACENT DUPLICATES FROM OBJECTS .
DESCRIBE TABLE OBJECTS LINES LIN.
IF LIN = 1.
RAISE NOTHING_FOUND.
ENDIF.
ENDFUNCTION.
--
Kjetil Kilhavn
Shane Burns
<Shane.Burns at boimail To:
SAP-WUG at MITVMA.MIT.EDU
.com> cc: (bcc: Kjetil
Kilhavn)
Sent by: SAP Subject: Re: Role
resolution of AC00000157 question
Workflow
<Owner-SAP-WUG at MITVM
A.MIT.EDU>
26.07.2002 12:58
Please respond to
"SAP Workflow Users'
Group"
Thanks for your reply Nicholas,
would the extension of the function module require much more coding, or has
anyone else out there extended the FM to keep going up the Org Structure
until it finds a position that is assigned to a user/person???
I don't have any coding experience in ABAP, but I am hoping the extension
would require me copying the role and FM and adding the extra code??
Thanks,
Shane Burns,
Bank Of Ireland,
Dublin.
Nicholas Brand
<nicholas.n.brand at uk.pwcg To:
SAP-WUG at MITVMA.MIT.EDU
lobal.com> cc:
Sent by: SAP Workflow Subject: Re: Role
resolution of AC00000157 question
<Owner-SAP-WUG at MITVMA.MIT
.EDU>
23/07/2002 16:02
Please respond to SAP
Workflow Users' Group
Memo from Nicholas N Brand of PricewaterhouseCoopers
-------------------- Start of message text --------------------
Shane,
Yup you're right, you'll need to extend the function of the FM.
Essenitally, check if the position returned by the FM has user(s) assigned
to it and if not, carry on going up a level in the org structure until a
position with user(s) assigned is found.
You may also need to look at the issue of who should approve the managing
director's (i.e. the top guy's) expenses.
Kind regards,
Nicholas
Shane Burns <Shane.Burns at boimail.com>@MITVMA.MIT.EDU> on 23/07/2002
15:44:11
Please respond to "SAP Workflow Users' Group" <SAP-WUG at MITVMA.MIT.EDU>
Sent by: SAP Workflow <Owner-SAP-WUG at MITVMA.MIT.EDU>
To: SAP-WUG at MITVMA.MIT.EDU
cc:
Subject: Role resolution of AC00000157 question
Hi all,
We are on 4.6C here, and I have a question regarding the role resolution of
AC00000157 ( Superior Chief Position ), function - RH_ACT_LEADING_POSITION.
Currently we are using this role in a custom trip expenses workflow, it
finds the leading (chief) position of the workflow initiator, and takes the
user attached to this position to use as the actual agent to send the work
item to.
However, in our company there is sometimes a leading position that may not
have a user assigned to it for whatever reason, this results in all
possible agents getting the work item!!!
Will I have to copy and modify the role so that it will go up the org
structure and look for the next chief position that does have a user
assigned to it???
I am a workflow novice, and I couldn't find any documentation for this
particular role, I would be very grateful for any pointers.
Thanks in advance.
Shane Burns,
Bank Of Ireland,
Dublin.
********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please
notify us immediately at MailManager at psir.ie and delete this E-mail
from your system. Thank you.
It is possible for data transmitted by email to be deliberately or
accidentally corrupted or intercepted. For this reason, where the
communication is by email, the Bank of Ireland Group does not accept
any responsibility for any breach of confidence which may arise
through the use of this medium.
This footnote also confirms that this email message has been swept
for the presence of known computer viruses.
********************************************************************
--------------------- End of message text --------------------
This e-mail is intended only for the person to whom it is
addressed. If an addressing or transmission error has
misdirected this e-mail, please notify the author by replying to
this e-mail. If you are not the intended recipient you must not
use, disclose, copy, print or rely on this e-mail.
The principal place of business of PricewaterhouseCoopers and
its associate partnerships is 1 Embankment Place, London
WC2N 6RH where lists of the partners' names are available for
inspection. All partners in the associate partnerships are
authorised to conduct business as agents of, and all contracts
for services to clients are with, PricewaterhouseCoopers. The
UK firm of PricewaterhouseCoopers is authorised by the
Institute of Chartered Accountants in England and Wales to
carry on investment business. PricewaterhouseCoopers is a
member of the world-wide PricewaterhouseCoopers
organisation.
PricewaterhouseCoopers may monitor outgoing and incoming
e-mails and other telecommunications on its e-mail and
telecommunications systems.
----------------------------------------------------------------
Visit our website http://www.pwcglobal.com
_________________________________________________________________
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.
********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please
notify us immediately at MailManager at psir.ie and delete this E-mail
from your system. Thank you.
It is possible for data transmitted by email to be deliberately or
accidentally corrupted or intercepted. For this reason, where the
communication is by email, the Bank of Ireland Group does not accept
any responsibility for any breach of confidence which may arise
through the use of this medium.
This footnote also confirms that this email message has been swept
for the presence of known computer viruses.
********************************************************************
-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.
-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.
More information about the SAP-WUG
mailing list