Mass Deletion of Workitems - Logically.

Kouw, FA - SPLXE fa.kouw at td.klm.com
Fri Feb 13 09:55:17 EST 2004


Hi Vinot,
 
We also created such a program recently (see program specifications and instructions below). The program uses an
Excel input file with the instances to be cancelled. The Excel file is first uploaded to the server and is next
processed in the second step. Hope this helps a bit.
 
Regards,
 
Fred Kouw
 
======================================
 
To logically delete multiple workflows:
 
Create 1 column in Excel with instances to be cancelled
 
Start program 'ZWF_WORKITEM_CANCEL_MENU' via SA38
 
Convert MS-Excel file to flat file:
- Select button 'Step 1   Convert MS-Excel file to flat file'
- Specify input file (i.e. 'D:\Fred\Manually synchronize fields to be cancelled.xls')
- Specify output file (i.e. '/tmp/workitems')
- Press button <Execute>
 
Cancel work items (=workflows):
- Select button 'Step 2   Upload flat file to cancel work items'
- Specify input file created in previous step 1(i.e. '/tmp/workitems')
- Press button <Execute>
 
=========================== Main program ============================
 
REPORT zwf_workitem_cancel_menu .
 
CONSTANTS: c_conversion LIKE sy-repid VALUE 'ZWF_CONVERT_XLS_TO_UNIX',
           c_upload     LIKE sy-repid VALUE 'ZWF_WORKITEM_CANCEL'.
 
 
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
 
*---Conversion of xls to flat-file on application server
selection-screen comment 10(8) text-003.
SELECTION-SCREEN PUSHBUTTON 20(50) convert USER-COMMAND convert.
 
SELECTION-SCREEN SKIP 3.
 
*---Upload converted file
selection-screen comment 10(8) text-004.
SELECTION-SCREEN PUSHBUTTON 20(50) upload USER-COMMAND upload.
 
SELECTION-SCREEN END OF BLOCK b1.
 
 
 
INITIALIZATION.
  MOVE 'Convert MS-Excel file to flat file'(001) TO convert.
  MOVE 'Upload flat file to cancel work items'(002) TO upload.
 
 
 
AT SELECTION-SCREEN.
  CASE sy-ucomm.
    WHEN 'CONVERT'.
      SUBMIT (c_conversion) VIA SELECTION-SCREEN AND RETURN.
    WHEN 'UPLOAD'.
      SUBMIT (c_upload)     VIA SELECTION-SCREEN AND RETURN.
  ENDCASE.
 
=========================== Sub program ============================
 
 
REPORT zwf_workitem_cancel
            NO STANDARD PAGE HEADING
            LINE-SIZE  80
            LINE-COUNT 65(0)
            MESSAGE-ID zmm1.
*-----------------------------------------------------------------------
* Owner        : KLM Sap Competence Centre
* Author       :
* Date         :
* Reference    : ND number
* SAP original :
* Purpose      :
*-----------------------------------------------------------------------
* Authorization:
* Type         :
* Input        :
* Process      :
* Output       :
* Relation with:
*-----------------------------------------------------------------------
* Batchjob info:
*
*-----------------------------------------------------------------------
* Changes
*    Date      :
*    Author    :
*    Correction:
*    Purpose   :
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* D E C L A R A T I O N S
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* DDIC Tables
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* Types (T_<type>)
*-----------------------------------------------------------------------
TYPES: BEGIN OF t_input,
        wi_id(12),
       END OF t_input.
*-----------------------------------------------------------------------
* Work area (WA_<name>)
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* Internal Tables (I_<name>)
*-----------------------------------------------------------------------
DATA: i_input TYPE STANDARD TABLE OF t_input WITH HEADER LINE.
*-----------------------------------------------------------------------
* Structures (ST_<name>)
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* Global Data declarations (G_<name>)
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* Constants (C_<name>)
*-----------------------------------------------------------------------
CONSTANTS: c_true VALUE 'X',
           c_false VALUE space,
           c_input VALUE 'I',
           c_output VALUE 'O'.
*-----------------------------------------------------------------------
* Switches (SW_<name>)
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* Classes (CL_<name>)
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* Interfaces (IF_<name>)
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* S E L E C T I O N  S C R E E N (S_<name> and P_<name>)
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file(100) LOWER CASE OBLIGATORY DEFAULT
                                              '/tmp/workitems'.
SELECTION-SCREEN END OF BLOCK b1.
*-----------------------------------------------------------------------
* Initialization
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* At selection screen
*-----------------------------------------------------------------------
 
*-----------------------------------------------------------------------
* Main
*-----------------------------------------------------------------------
START-OF-SELECTION.
 
  PERFORM read_file TABLES i_input
                    USING p_file.
 
 
END-OF-SELECTION.
 
  PERFORM cancel_workitems TABLES i_input.
 
TOP-OF-PAGE.
 
  INCLUDE zbcx_klm_heading_900a.        " Header processing
*-----------------------------------------------------------------------
* FORM's
*-----------------------------------------------------------------------
*&---------------------------------------------------------------------*
*&      Form  read_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_I_INPUT  text
*      -->P_P_FILE  text
*----------------------------------------------------------------------*
FORM read_file TABLES   p_in  STRUCTURE i_input
               USING    p_file.
 
  PERFORM open_file USING p_file
                          c_input.
 
  DO.
    READ DATASET p_file INTO p_in.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
    APPEND p_in.
    CLEAR p_in.
  ENDDO.
 
  PERFORM close_file.
 
ENDFORM.                    " read_file
 
*&---------------------------------------------------------------------*
*&      Form  close_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM close_file.
 
  CLOSE DATASET p_file.
  IF sy-subrc <> 0.
    MESSAGE e017 WITH p_file.
  ENDIF.
 
ENDFORM.                    " close_file
*&---------------------------------------------------------------------*
*&      Form  open_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_P_FILE  text
*      -->P_C_INPUT  text
*----------------------------------------------------------------------*
FORM open_file USING    p_file
                        p_io.
 
  CASE p_io.
    WHEN c_input.
      OPEN DATASET p_file FOR INPUT IN TEXT MODE.
      IF sy-subrc <> 0.
        MESSAGE e016 WITH p_file.
      ENDIF.
    WHEN c_output.
*---just in case old file is still present -> delete
      DELETE DATASET p_file.
      OPEN DATASET p_file FOR APPENDING IN TEXT MODE.
      IF sy-subrc <> 0.
        MESSAGE e016 WITH p_file.
      ENDIF.
  ENDCASE.
 
ENDFORM.                    " open_file
*&---------------------------------------------------------------------*
*&      Form  cancel_workitems
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_I_INPUT  text
*----------------------------------------------------------------------*
FORM cancel_workitems TABLES   p_in STRUCTURE i_input.
 
  LOOP AT p_in.
    PERFORM cancel USING p_in-wi_id.
  ENDLOOP.
 
ENDFORM.                    " cancel_workitems
 
*&---------------------------------------------------------------------*
*&      Form  cancel
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_P_IN_WI_ID  text
*----------------------------------------------------------------------*
FORM cancel USING    p_wi_id.
 
  DATA: l_wi_id LIKE swwwihead-wi_id.
 
  l_wi_id = p_wi_id.
 
  CALL FUNCTION 'SWW_WI_ADMIN_CANCEL'
    EXPORTING
      wi_id                             = l_wi_id
     do_commit                         = c_true
     authorization_checked             = ' '
     preconditions_checked             = ' '
     called_by_proxy                   = ' '
* IMPORTING
*   NEW_STATUS                        =
   EXCEPTIONS
     update_failed                     = 1
     no_authorization                  = 2
     infeasible_state_transition       = 3
     OTHERS                            = 4
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  else.
    message i019 with l_wi_id.
  ENDIF.
 
========================================================
 
Vinod Ramchandani wrote:
 
> Praveen,
>
> This FM is exist in 4.6C.
> When we press "Delete Logically" - button this FM will get executed.
> And I have checked that all child workitems are removed with this as well.
>
> Vinod.
>
> -----Original Message-----
>> From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU]On Behalf Of
> 'Praveen Johri'
> Sent: Thursday, February 12, 2004 12:56 PM
> To: SAP-WUG at MITVMA.MIT.EDU
> Subject: Re: Mass Deletion of Workitems - Logically.
>
> Vinod,
>
> that FM is there in 4.7 enterprise, u just check ur version.
> Regarding "SWW_WI_ADMIN_CANCEL" i m not pretty sure whether it will delete
> all the child Wf instances if parent is deleted and what will it do if we
> ask it to delete single step task. just check it out before u proceed
> further, but the other WAPI i told does all that.
>
> Cheers
> praveen
> (Embedded image moved to file: pic09576.pcx)
>
>                       Vinod Ramchandani
>                       <vinod.ramchandani@        To:
> SAP-WUG at MITVMA.MIT.EDU
>                       patni.com>                 cc:
>                       Sent by: SAP               Subject:  Re: Mass Deletion
> of Workitems - Logically.
>                       Workflow
>                       <Owner-SAP-WUG at MITV
>                       MA.MIT.EDU>
>
>                       02/12/2004 01:00 PM
>                       Please respond to
>                       SAP Workflow Users'
>                       Group
>
> Thanks Praveen.
>
> I have got the hint.I should write an ABAP.
>
> There is no any FM named "SAP_WAPI_ADM_WORKFLOW_CANCEL",
> but we have "SWW_WI_ADMIN_CANCEL" that cancels Workflow.
>
> Vinod Ramchandani.
>
> -----Original Message-----
>> From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU]On Behalf Of
> 'Praveen Johri'
> Sent: Thursday, February 12, 2004 12:32 PM
> To: SAP-WUG at MITVMA.MIT.EDU
> Subject: Re: Mass Deletion of Workitems - Logically.
>
> Hi Vinod ,
> have a look at tranx-SWPR to restart Workflow, i belive the interface
> provided in it is good and u can use itinstead of restarting to logically
> deleteWorkItem.
> make a copy if that and change FM of restarting to a WAPI to delete them
> logically. u can use SAP_WAPI_ADM_WORKFLOW_CANCEL for this purpose.
> As far as i know there is no straight transection which will go for mass
> logical deletion, u have to create ur own.
> cheers,
> Praveen
> (Embedded image moved to file: pic00610.pcx)
>
>                       Vinod Ramchandani
>                       <vinod.ramchandani@        To:
> SAP-WUG at MITVMA.MIT.EDU
>                       patni.com>                 cc:
>                       Sent by: SAP               Subject:  Mass Deletion of
> Workitems - Logically.
>                       Workflow
>                       <Owner-SAP-WUG at MITV
>                       MA.MIT.EDU>
>
>                       02/12/2004 11:48 AM
>                       Please respond to
>                       SAP Workflow Users'
>                       Group
>
> Hi All,
>
> Few months back, We have moved to the NEW Workflow System.
> We need to delete all the Workitems & Workflow-Logs which refers to OLD
> Workflow system.
>
> I do not want to delete the Workitems & Workflow Logs PHYSICALLY from the
> system using SWWL and SWWH.
> I want to delete them LOGICALLY (Cancel Workflow).
>
> Approach is:
> 1) SWI1 : enter WS task id
> 2) Select Workitem -> Display
> 3) Go to -> Technical Workitem Display
> 4) Edit -> Change
> 5) Delete Logically
>
> This approach cancels the Workflow and removes all the related Workitems
> from all the Inboxes.
>
> Following This approach for all the OLD Workflows in Production System does
> not look feasible.
> Does anyone have any idea how we can have mass-logical-delete? as we do
> with
> SWWL & SWWH.
>
> Any inputs are very appreciated.
>
> Thanks in advance.
> Vinod Ramchandani.
>
> Whilst this email has been checked for all known viruses, recipients should
> undertake their own virus checking as Xansa will not accept any liability
> whatsoever.
>
> This email and any files transmitted with it are confidential and protected
> by client privilege.  It is solely for the use of the intended recipient.
> Please delete it and notify the sender if you have received it in
> error. Unauthorised use is prohibited.
>
> Any opinions expressed in this email are those of the individual and not
> necessarily the organisation.
>      Xansa, Registered Office: 420 Thames Valley Park Drive,
>      Thames Valley Park, Reading, RG6 1PU, UK.
>      Registered in England No.1000954.
>      t  +44 (0)8702 416181
>      w  www.xansa.com
>
> Whilst this email has been checked for all known viruses, recipients should
> undertake their own virus checking as Xansa will not accept any liability
> whatsoever.
>
> This email and any files transmitted with it are confidential and protected
> by client privilege.  It is solely for the use of the intended recipient.
> Please delete it and notify the sender if you have received it in
> error. Unauthorised use is prohibited.
>
> Any opinions expressed in this email are those of the individual and not
> necessarily the organisation.
>      Xansa, Registered Office: 420 Thames Valley Park Drive,
>      Thames Valley Park, Reading, RG6 1PU, UK.
>      Registered in England No.1000954.
>      t  +44 (0)8702 416181
>      w  www.xansa.com
>
> _________________________________________________________________________________________
> This inbound message from KPN has been checked for all known viruses by KPN IV-Scan, powered by MessageLabs.
> For further information visit: http://www.veiliginternet.nl
> _____________________________________________________________________________________________
 
 
**********************************************************************
This e-mail and any attachment may contain confidential and privileged
material intended for the addressee only. If you are not the addressee, you
are notified that no part of the e-mail or any attachment may be disclosed,
copied or distributed, and that any other action related to this e-mail or
attachment is strictly prohibited, and may be unlawful. If you have received
this e-mail by error, please notify the sender immediately by return e-mail,
and delete this message. Koninklijke Luchtvaart Maatschappij NV (KLM), its
subsidiaries and/or its employees shall not be liable for the incorrect or
incomplete transmission of this e-mail or any attachments, nor responsible
for any delay in receipt.
**********************************************************************
 
_____________________________________________________________________________________________
This outbound message from KPN has been checked for all known viruses by KPN IV-Scan, powered by MessageLabs.
For further information visit: http://www.veiliginternet.nl
_____________________________________________________________________________________________
 


More information about the SAP-WUG mailing list