...
Step 1 | Create a FAB application in transaction /n/IQX/FAB. Define the Properties, set the Workflow Mode to Process, and click Save. | |||||
Step 2 | Add an Input control in the Form Container and bind it to field Field1 in the Data Model. Add a Text control in the Form Container and bind it to field Result in the Data Model. This holds the result from the background task. | |||||
Step 3 | Create an Implementation Class for the System Task. Go to Code to open the Form Life-Cycle dialog. Click the button Auto-Generate Class Name, followed by the button Generate Class. The ABAP logic used by the System Task needs to be added in the ABAP Class that implements the /IQX/IF_SYSTEM_TASK Interface. You may create a dedicated Class for this, or you may use the Implementation Class of your application. In this example, we will use the latter option. | |||||
Step 4 | In the Form Life-Cycle dialog, click the button ABAP Routine next to the Perform System/Background Task to create an implementation and click it again to open the Class editor. Any logic can be implemented in method PERFORM_SYSTEM_TASK, but a boolean value (either ABAP_TRUE or ABAP_FALSE) must be returned in parameter E_SUCCESS. In this example, we will add a logic that generates a random number, log the results, and set the value of E_SUCCESS to ABAP_TRUE. However, in an actual implementation, you might need to use SAP master data or any transactional data.
| |||||
Step 5 | In the Form Life-Cycle dialog, click the button ABAP Routine next to the Determine approvers for Roles Task to create an implementation and click it again to open the Class editor. In this example, we will use the user FABAPPR1 as the Approver and WF-BATCH as the System User.
| |||||
Step 6 | Click the Workflow button to open the FAB Process Designer. Define the Roles. Click the Add button to create 2 custom Roles for the Approvers. In this example, we will use the role Approver1 for the Approve Task and the System User for the Update SAP System Task. Existing Roles can also be used for the System Task. | |||||
Step 7 | Define the Levels. Click the Add button to create the Levels. In this example, we will use the level Update SAP for the Update SAP System Task and Administrator for the Administrator Task. Please note that it is currently a requirement that a System Task is defined in its own Level - it should not be inserted in a Level that has other Tasks in it. | |||||
Step 8 | Define the Tasks using the Template and the Add buttons. System Tasks run in the background. If the processing fails, a dedicated Task can be created to rectify the issue or re-submit the Task. In this example, the Administrator Task can be used when the Update SAP Task fails. | |||||
Step 9 | Define the Roles for each Task. Start - Initiator Draft - Initiator Approve - Approver1 Update SAP - System User Administrator - Administrator Complete - No Role The System Role, Administrator, is assigned to the Administrator Task. This allows the user with an administrator role to carry out the Administrator functions. A User can be configured as an Administrator in transaction /n/IQX/FAB_CONFIG → Roles for Users and the Admin flag should be ticked. A Role can be configured for a specific Form in /n/IQX/FAB_CONFIG → Forms For Roles. Alternatively, the Administrator can also be defined via code in method DETERMINE_APPROVERS_FOR_ROLE. | |||||
Step 10 | Set the Implementing Class of the System Task. Click the Ellipsis button (More Task Settings) of the Update SAP task. Tick the flag for the System Task or Recording and enter the class name in the Implementing Class field. Click OK. | |||||
Step 11 | Define the Outcomes for each Task Action. Go to Actions → Outcomes. Start and Draft Tasks Approve Task Update SAP Task Action Types have to be defined for a System Task. Administrator Task In this example, when the task fails, the action is directed to the Administrator for issue rectification or task resubmission. The Process Flow will be as follows: Click Save & Close. | |||||
Step 12 | Add a FAB Process Flow control by right-clicking on Page → Add Process Flow → Add FAB Process Flow. Click Save. The application will be as follows: |
...