Using a SAP workflow rule within FAB

Assigning approvers to a FAB form is achieved using FAB configuration tcode /IQX/FAB_CONFIG.


Typically this has been done by assigning an Object Type as P (Person) followed by the ID of the

related object. 


This example shows how you can use this mechanism to assign an approver to a form using

a standard rule that you may already have defined in SAP.  You could even extend this to some or other

custom Object Type that you define. 


In the below example  the CAPEX_DEMO form has been setup to have the person (P) with id 900212 to be the approver at level 1.


The  TEST_WORKFLOW form has been setup to employ rule (R) 9810038 at level 1 and rule (R) 9810039 at level 2.

Note: The OT of R is a personal choice. You could define an object type of say RL (for Role) and then proceed to use the related object type (a role)

to find approvers. 



To be able to implement the rule that you have defined you need to write ABAP code in method DETERMINE_APPROVERS_WORKFLOW of your 

forms implementation class.

The first thing to do in this method is to read table /iqx/def_approvr holding the information setup above and then act on it to pick up the approvers

from the rule.


*i_form_name and i_level are input parameters to the method

data: lt_defined_approvers      type standard table of /iqx/def_approvr,
         ls_defined_approvers     like line of lt_defined_approvers,
         object                              type hrobjec_14,
         ac_container                   type standard table of swcont,
         ac_container_wa             type swcont

select * from /iqx/def_approvr into table lt_defined_approvers

      where zform_name i_form_name
        and approval_level i_level.

    read table lt_defined_approvers into ls_defined_approvers with key approval_level i_level.
    if sy-subrc and ls_defined_approvers-objty 'R'.
      object(2'AC'.
      object+2  ls_defined_approvers-objid.
    endif.

    clear ac_container.
    clear ac_container_wa.


Now proceed to fill the ac_container structure(s) with the details defined in the rule

and use function module  RH_GET_ACTORS to get the actors/approvers 

and append them to the ct_approvers table - changing parameter of the method.


Hint: Use tcode PFAC and Container tab to get the information about the rule and the

required containers.