Creating an "Execute Together" Method
The
Business Workplace provides you with the option of executing work items together. This enables you to approve or reject several leave requests at the same time, for example.The following are prerequisites for this function:
The method
Approve of the object type WFTS is an example of a method that can be used for the function Execute together.
BEGIN_METHOD APPROVE CHANGING CONTAINER.
DATA: PROCSTATE LIKE SWXFORMABS-PROCSTATE.
SWC_GET_ELEMENT CONTAINER 'ProcState' PROCSTATE.
IF PROCSTATE IS INITIAL.
" go into dialog and display absence form for approval
CALL FUNCTION 'SWX_FORMABS_APPROVE'
EXPORTING
FORMNUMBER = OBJECT-KEY-NUMBER
IMPORTING
PROC_STATE = PROCSTATE
EXCEPTIONS
FORM_NOT_FOUND = 01
ABORTED = 02
OTHERS = 03.
CASE SY-SUBRC.
WHEN 0. " OK
WHEN 01. EXIT_OBJECT_NOT_FOUND.
WHEN 02. EXIT_CANCELLED.
WHEN OTHERS. " to be implemented
ENDCASE.
SWC_SET_ELEMENT CONTAINER 'ProcState' PROCSTATE.
ELSE. " just change the field in the database
UPDATE SWXFORMABS SET PROCSTATE = PROCSTATE
WHERE FORMNUMBER = OBJECT-KEY-NUMBER.
IF SY-SUBRC NE 0.
EXIT_OBJECT_NOT_FOUND.
ENDIF.
ENDIF.
END_METHOD.