Step 4. Implement the Compound Reusable Part
VFW074 – Create a Compound Reusable Part
In this step you will change your Employee Details command handler to use the new department / section combo box component.
1. Open the Employee Handler (iiiVFW06) in the editor
2. From the
view, delete the department dropdown component (iiiVFW13) and the Department and Section fields3. Switch to
and remove all code which refers to iiiVFW13. You will find that the flow manager items for iiiVFW13, DEPTMENT and SECTION have also been removed, so no further corrections are needed for now.4. Drag and drop your department / sections dropdown component onto the main left hand panel (BODY_HEAD).
a. Change its DEPSEC_DD.
tob. Change its 10.
and to5. Select the DEPSEC_DD component and use the
tab to create a and event handling routine.6. Switch to the
view. In the method routine add code to set the current department and section properties in DEPSEC_DD, after the employee data has been read. Your code should look like the following: New code is shown in red.. . . . .
Fetch Fields(#XG_HEAD) From_File(PSLMST) With_Key(#EMPNO)
#DEPSEC_DD.uCurrDept := #deptment
#DEPSEC_DD.uCurrSection := #Section
The department / section component will position the department dropdown, rebuild the sections dropdown for this department code and position the sections dropdown.
8. Complete the logic for the department and section changed events from DEPSEC_DD.
In each case they simply need to set the command handler field to the related property from DEPSEC_DD. Your code should look like the following:
Evtroutine Handling(#DEPSEC_DD.uDeptChanged)
#deptment := #DEPSEC_DD.uCurrDept
Endroutine
Evtroutine Handling(#DEPSEC_DD.uSectChanged)
#section := #DEPSEC_DD.ucurrsection
Endroutine
9. Compile your command handler.
10. Execute your Framework as an end user. Test the
command handler.a. Ensure that the correct department and sections are displayed when an employee is displayed.
b. Select new department and section values in the dropdowns. Save the change and ensure the file is updated successfully.
c. Check that the sections dropdown is re-populated every time a new department is selected in its dropdown.