AW: Step agents - superior of superior.

Abby Dywan abby.dywan at us.pwcglobal.com
Thu Aug 22 10:52:27 EDT 2002


I've been working on the same problem myself and developed a custom role to
handle it (it goes to his superior & his superior's superior though, not
just the second superior.).  Code for the function module is below.  It
isn't perfect yet - it relies on the assumption that each user has only 1
direct superior - but it might be a good start...
 
Hope that helps!
Abby  :)
 
FUNCTION zca_get_two_superiors.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  TABLES
*"      ACTOR_TAB STRUCTURE  SWHACTOR
*"      AC_CONTAINER STRUCTURE  SWCONT
*"  EXCEPTIONS
*"      NOBODY_FOUND
*"----------------------------------------------------------------------
 
  INCLUDE <cntain>.
 
  DATA BEGIN OF org_object OCCURS 0.
          INCLUDE STRUCTURE swhactor.
  DATA END OF org_object.
 
  DATA:  BEGIN OF vorg_agent OCCURS 0.
          INCLUDE STRUCTURE swhactor.
  DATA:  END OF vorg_agent.
 
  DATA: BEGIN OF new_ac_container OCCURS 3.
          INCLUDE STRUCTURE swcont.
  DATA: END OF new_ac_container.
 
  DATA: BEGIN OF high_ac_container OCCURS 3.
          INCLUDE STRUCTURE swcont.
  DATA: END OF high_ac_container.
 
  DATA: org_type LIKE swhactor-otype.
  DATA: org_id LIKE swhactor-objid.
  DATA: result_tab LIKE swhactor OCCURS 0 WITH HEADER LINE.
  data: positions LIKE swhactor OCCURS 0 WITH HEADER LINE.
  DATA: high_positions LIKE swhactor OCCURS 0 WITH HEADER LINE.
  data: high_result_tab LIKE swhactor OCCURS 0 WITH HEADER LINE.
 
  clear:  actor_tab.
  REFRESH: actor_tab.
 
break-point.
 
* Get the org-object under consideration.
  swc_get_element ac_container 'ORG_OBJECT' org_object.
* Get the org-object-type and the org-object id.
  swc_get_element ac_container 'OTYPE' org_type.
  swc_get_element ac_container 'OBJID' org_id.
 
* Pass the org-object, the org-object-type and the org-object-id
* to a new container.
* The org object get a new name: ORG_AGENT.
  swc_set_element new_ac_container 'ORG_AGENT' org_object.
  swc_set_element new_ac_container 'OTYPE' org_type.
  swc_set_element new_ac_container 'OBJID' org_id.
 
* Call the 'new' function module for role resolution.
  CALL FUNCTION 'RH_ACT_LEADING_POSITION'
       EXPORTING
            use_default_userid = ' '
       TABLES
            actor_tab          = positions
            ac_container       = new_ac_container
       EXCEPTIONS
            no_lead_pos_found  = 1
            no_active_plvar    = 2
            OTHERS             = 3.
 
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
      RAISING nobody_found.
  ENDIF.
 
* Resolve the result actor_tab (which contains the position of the first
* superior) to users.
  LOOP AT positions.
    CALL FUNCTION 'RH_STRUC_GET'
         EXPORTING
              act_otype       = positions-otype
              act_objid       = positions-objid
              act_wegid       = 'SAP_TAGT' " as suggested by LP
*         ACT_PLVAR       = ' '
*         ACT_BEGDA       = SY-DATUM
*         ACT_ENDDA       = SY-DATUM
*         ACT_TDEPTH      = 0
*         AUTHORITY_CHECK = 'X'
*    IMPORTING
*         ACT_PLVAR       =
         TABLES
            result_tab      = result_tab
*         RESULT_OBJEC    =
*         RESULT_STRUC    =
         EXCEPTIONS
              no_plvar_found  = 1
              no_entry_found  = 2
              OTHERS          = 3.
 
* Add the first superior to the list of responsible agents
    APPEND LINES OF result_tab TO actor_tab.
 
* Use the first superior and pass the org-object, the org-object-type
* and the org-object-id to a new container to get the second superior.
    CONCATENATE result_tab-otype result_tab-objid INTO vorg_agent.
    APPEND vorg_agent.
 
    swc_set_element high_ac_container 'ORG_AGENT' vorg_agent.
    swc_set_element high_ac_container 'OTYPE' result_tab-otype.
    swc_set_element high_ac_container 'OBJID' result_tab-objid.
 
* Use the username of the first superior to get the position of the
* second superior.
    CALL FUNCTION 'RH_ACT_LEADING_POSITION'
         EXPORTING
              use_default_userid = ' '
         TABLES
              actor_tab          = high_positions
              ac_container       = high_ac_container
         EXCEPTIONS
              no_lead_pos_found  = 1
              no_active_plvar    = 2
              OTHERS             = 3.
 
* The reason we are not checking sy-subrc here is because we do not want
* the role resolution to fail if we don't have a second superior - it
* should simply try to loop, and since it can't, a second superior will
* not be included in the responsible agents.
 
* Loop through the second superior's position (should only be one, but
* to be careful) to get the username of the second superior.
    LOOP AT high_positions.
      CALL FUNCTION 'RH_STRUC_GET'
        EXPORTING
             act_otype       = high_positions-otype
             act_objid       = high_positions-objid
             act_wegid       = 'SAP_TAGT' " as suggested by LP
*         ACT_PLVAR       = ' '
*         ACT_BEGDA       = SY-DATUM
*         ACT_ENDDA       = SY-DATUM
*         ACT_TDEPTH      = 0
*         AUTHORITY_CHECK = 'X'
*    IMPORTING
*         ACT_PLVAR       =
        TABLES
           result_tab      = high_result_tab
*         RESULT_OBJEC    =
*         RESULT_STRUC    =
        EXCEPTIONS
             no_plvar_found  = 1
             no_entry_found  = 2
             OTHERS          = 3.
 
* Add the user name of the second superior to the responsible agents
      APPEND LINES OF high_result_tab TO actor_tab.
 
    ENDLOOP.
 
  ENDLOOP.
 
ENDFUNCTION.
 
 
 
 
                      Michael Kemmler
                      <Michael.Kemmler at HVBS       To: SAP-WUG at MITVMA.MIT.EDU
                      ystems.com>                 cc:
                      Sent by: SAP Workflow       Subject:  AW: Step agents - superior of superior.
                      <Owner-SAP-WUG at MITVMA
                      .MIT.EDU>
                      08/22/2002 02:21 AM
 
                      Please respond to
                      "SAP Workflow Users'
                      Group"
 
 
 
 
 
 
Hi all,
 
if you have a Organisation Plan in HR, build a new step like this example.
With the SWX_GET_MANAGER - function you get the next higher superior (A12)
in the Org. Plan. We use it to sent at the next step a email
(sendtaskdescription) to
the superior.
 
Regards,
Michael Kemmler
 
-
begin_method ermittle_email_von_fk changing container.
data:
      adressstring like soxna-fullname,
      adresstype like soxna-type,
      personnelnumber like p0001-pernr.
 
* intern Data
data: count type n,
      ac_container like swcont occurs 0 with header line,
      adressstrings like soxna-fullname occurs 0 with header line.
 
  swc_get_element container 'PersonnelNumber' personnelnumber.
 
adresstype = 'G'.
 
ac_container-element = 'OBJID'.
ac_container-tab_index = '000001'.
ac_container-elemlength = '008'.
ac_container-type = 'N'.
ac_container-value = personnelnumber.
append ac_container.
ac_container-element = 'OTYPE'.
ac_container-tab_index = '000001'.
ac_container-elemlength = '002'.
ac_container-type = 'C'.
ac_container-value = 'P '.
append ac_container.
 
call function 'SWX_GET_MANAGER'
     tables
          actor_tab    = adressstrings
          ac_container = ac_container
     exceptions
          nobody_found.
 
if sy-subrc <> 0.
    endif.
 
loop at adressstrings.
  if adressstrings(2) = 'P '.
    delete adressstrings.
  endif.
endloop.
 
describe table adressstrings lines count.
 
if count ne 1 and count ne 2.
  clear adressstrings. refresh adressstrings.
  select single yy_dd_emailadr from yyp_dd_email into adressstring
                      where yy_dd_postfach eq 'REKLAMATIONEN'.
endif.
 
read table adressstrings index 1 into adressstring .
 
if adressstring cs '@'.
    adresstype = 'U'.
endif.
 
swc_set_element container 'Adressstring' adressstrings.
swc_set_element container 'AdressType' adresstype.
end_method.
 
 
 
 
 
 
 
> -----Urspr|ngliche Nachricht-----
> Von:  Ernest Liczki [SMTP:eliczki at deloitteCE.com]
> Gesendet am:  Donnerstag, 22. August 2002 07:54
> An:   SAP-WUG at MITVMA.MIT.EDU
> Betreff:      Re: Step agents - superior of superior.
>
> Hi all,
>
> I need something very similar, but for the purchase requisition release
> WF.
>
> The scenario is:
>
> 1. The first level approval (release code 01) is done by the user A (more
> users possible from the organization - solved by the user exit -
> enhancement
> M06B0001).
>
> 2. The second level has to be done by his superior B.
>
> 3. And so on, the next level by the superior of the previous superior -
> user
> C.
>
> The problem is that the WS00000038 (Workflow for requisition release) is
> started every time as a new instance with new release code and therefore
> the
> (_WI_ACTUAL_AGENT) could not be used for the next level determination.
>
> I believe that the best solution is to find the previous agent from the
PR
> release history.
> Did anybody of you try to find that last user released the PR, is there
> any
> suitable function module for that or rather I have to start my own ABAP
> coding ?
>
> Thank you very for your help.
>
> Best regards,
>
> Ernest
>
> -----Original Message-----
>> From: Shaelene Hooper [mailto:Shaelene.Hooper at intelligroup.co.nz]
> Sent: Wednesday, August 21, 2002 7:34 PM
> To: SAP-WUG at MITVMA.MIT.EDU
> Subject: Re: Step agents - superior of superior.
>
>
> Hi Abby
>
> You could bind the actual agent (_WI_ACTUAL_AGENT) of the step 1 dialog
> workitem back into the workflow container.  To do this, you would need to
> create a workflow container element of data type
> WFSYST-ACT_AGENT.   You would then bind this workflow container element
> into
> the agent assignment of your next task.
>
> Regards
> Shaelene
>
>         -----Original Message-----
>         From: Abby Dywan [mailto:abby.dywan at us.pwcglobal.com]
>         Sent: Wed 08/21/2002 11:57 AM
>         To: SAP-WUG at MITVMA.MIT.EDU
>         Cc:
>         Subject: Step agents - superior of superior.
>
>
>
>         Hi all -
>
>         I am trying to figure out how to get the superior of a superior
to
> be an
>         agent of a step.  My workflow goes something like this.
>
>         Step 1 - Assigned agent - superior of workflow initiator
>
>         Step 2 - Assigned agent - superior of superior.
>
>         Step 3 - Assigned agent - superior of superior of superior.
>
>         Unfortunately, I can't use positions to do this because the
> initiator will
>         be at all different levels.  I'm trying to figure out how to read
> the
>         superior from Step 1 into the workflow container to use to
> determine
> the
>         superior in the Step 2.  Does anyone have any suggestions as to
> how
> I can
>         do this?
>
>         Any help would be appreciated - I've been playing with standard
> roles
>         trying to do this but I'm wondering if it will require a custom
> role...
>
>         Thanks so much!
>         Abby  Dywan
>         PwC Consulting
>         404 808 3974
>         _________________________________________________________________
>         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.
>
>
>
>
>
> -------------------
> Privileged/confidential information may be contained in this message.
This
> communication is confidential and intended solely for the addressee(s).
> Unauthorized distribution, modification or disclosure of the contents may
> be
> unlawful. If you receive this in error, please notify the sender and
> delete
> it from your system.  If you are not the addressee indicated in this
> message
> (or responsible for delivery of the message to such person), you may not
> copy or deliver this message to anyone. Please advise immediately if you
> or
> your employer does not consent to Internet e-mail for messages of this
> kind.
> Opinions, conclusions and other information in this message that do not
> relate to the official business of Deloitte & Touche shall be understood
> as
> neither given nor endorsed by it.  Views expressed herein do not
> necessarily
> reflect those of Deloitte & Touche.
 
 
 
_________________________________________________________________
         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.
 


More information about the SAP-WUG mailing list