Group Ownership of Forms

Introduction

In the standard behaviour a form is routed from person to person and is therefore 'owned' by one single person at any one time; only the owner of a form can open the form and change the contents.  However, sometimes this behaviour is not sufficient.  For example if the business requires that multiple users have access to the same form, and whoever launches the form first should lock out the other users in the group.  This is known as 'Group Ownership of Forms' and is supported in FLM.

FLM Configuration

In order to activate SAP Usergroup functionality, a checkbox must be selected on the Customer Code configuration table.

In order to enable group access to a form type, the 'Group Access Allowed' flag must be selected on the Form Type configuration table.

Determination of the Group User

In the standard behaviour we determine the next user in the routing either programmatically in the Routing userexit or by table entry from FLM Configuration.  For group ownership, the owner can for example be a SAP Usergroup defined in transaction SUGR, or an Organisational Unit defined in the SAP HR Organisational Structure, or a Purchasing Group code. It is however recommended to have a SAP user Id defined which matches the owner even if the owner is not a real person.

Assignment of users into groups

How you achieve this is not enforced by the FLM framework, but examples could include:

  • using SAP Usergroups
  • using a custom tables.  
  • using User Parameters..
  • using SAP HR organisational structure   

However you achieve this link, you must be able to programmatically read the group in ABAP from inside the InBox user exit, as described in 3)

Modification of the FLM Portal Inbox contents

The standard FLM Portal Inbox contains:

  • forms for which the owner is the logged in user
  • forms for which the owner is an SAP Usergroup that the logged in user belongs to.

The Inbox user-exit enables the addition of other forms to the FLM Portal Inbox.  This involves checking what groups the current user belongs to and then searching for forms currently escalated to those groups, and then appending the forms to the list.

Example of Inbox Redetermination

This example assumes only the status 'Approved' for form type 'ABCD' is to be shared amongst the groups users.  The form owner is defined as 'GROUP1'.  The groups are defined by users having a form type set against one of 5 user parameters.

 

 

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
     DATA: ls_newentry     TYPE /flm/get_inbox_user_l,
           lv_group_access TYPE flag,
           ls_fpe          TYPE /flm/fpe,
           lt_fpe          TYPE TABLE OF /flm/fpe,
           lv_ccode        TYPE /flm/cust_code,
           lt_flock        TYPE TABLE OF /flm/flock,
           ls_flock        TYPE /flm/flock.
    *
    * Call Function for my form type to see if form 'ABCD' is shared for this user:
    *
    * form_type    = 'ABCD' call this several times if other forms shared.
    *
      CALL FUNCTION 'Z_FLM_SHARED_USERS'
        EXPORTING
          requestor_id = im_user
          form_type    = 'ABCD' 
        IMPORTING
          group_acces  = lv_group_access.
    *
    * If this user doesn't have group access for the form type ABCD (and there are no other
    * form types to check), then we can leave without altering the contents of the Inbox
    *
      IF lv_group_access IS INITIAL.
        EXIT.
      ENDIF.
    *
    * My form owner for form type 'ABCD' is defined as 'GROUP1', so the standard Inbox won't
    * contain any forms for that user and so I don't have to go deleting anything from the
    * existing list.  What I have to do now is to add in the forms that are shared by
    * reading table /flm/fpe:
    *
      lv_ccode = /flm/core=>get_default_customer( ).

    * Select all forms.
      SELECT * FROM  /flm/fpe INTO TABLE lt_fpe
        WHERE ccode   EQ lv_ccode
         AND  ftype   EQ 'ABCD'
         AND  fstatus EQ 'A'
         AND  fowner  EQ 'GROUP1'.
    
    * Get all forms locked to a different user
      SELECT * FROM /flm/flock INTO TABLE lt_flock
        WHERE ccode EQ lv_ccode
         AND  ftype EQ 'ABCD'
         AND  fuser NE sy-uname.
  
    *
      LOOP AT lt_fpe INTO ls_fpe.
    *
        READ TABLE lt_flock INTO ls_flock WITH KEY id = ls_fpe-id id_var = ls_fpe-id_var.
        IF sy-subrc IS INITIAL. "If a form is locked to a different user, don't include it in the inbox
          CONTINUE.
        ENDIF.
*
        CLEAR ls_newentry.
        ls_newentry-fname           = 'My Form Description'.  "or read from /flm/ftype
        ls_newentry-fstatus         = 'Approved'.             "or read from /flm/fstatt
        ls_newentry-fuser           = '*'.
        ls_newentry-form_id         = ls_fpe-id.
        ls_newentry-ftype           = ls_fpe-ftype.
        ls_newentry-fccode          = ls_fpe-ccode.
        ls_newentry-fver            = ls_fpe-fver.
        ls_newentry-flang           = ls_fpe-flang.
        ls_newentry-fcreated_date   = ls_fpe-created_date.
        ls_newentry-fsaved_date     = ls_fpe-change_date.
        ls_newentry-finitiated_user = ls_fpe-finitiator.
        ls_newentry-form_id_var     = ls_fpe-id_var.
    *
        ls_newentry-ftask = /flm/core=>get_portal_instruction( im_ccode = lv_ccode
                                                               im_flang = sy-langu
                                                               im_msgnr = ls_fpe-ftask_msg
                                                               im_fpe   = ls_fpe  ).

        APPEND ls_newentry TO ch_inbox.
    *
      ENDLOOP.   

    *------- end of user-exit --------------------------------------------*
    ENDMETHOD.

    FUNCTION z_flm_shared_users.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(REQUESTOR_ID) TYPE  SYUNAME
    *"     VALUE(FORM_TYPE) TYPE /FLM/FTYPE_CODE
    *"  EXPORTING
    *"     VALUE(GROUP_ACCESS) TYPE FLAG

    *"----------------------------------------------------------------------
    *
        TABLES: usr05.
        CLEAR group_access.
    *
    * Users can share up to 5 form types in this scenario:
    *
        SELECT SINGLE * FROM usr05
          WHERE bname = requestor_id
           AND ( parid = 'Z_FLM_SHARED_FORM_1' OR
                 parid = 'Z_FLM_SHARED_FORM_2' OR
                 parid = 'Z_FLM_SHARED_FORM_3' OR
                 parid = 'Z_FLM_SHARED_FORM_4' OR
                 parid = 'Z_FLM_SHARED_FORM_5' )
           AND parva = form_type.
    *
        IF sy-subrc IS INITIAL.
          group_access = 'X'.
        ENDIF.
    *
      ENDFUNCTION.