Not once, not twice I've search for a solution to do changes in routings (task lists) in some wise way. I hate BDC but in this case I thought that there is no other solution. Fortunately I was wrong ! While reading one of the post asking about same thing one of the users has mention something really nice - SAPNote 488765 "Do-it-yourself EWB programming". This note shows how to use FM used in CEWB, so we can create/change/delete bom and routings. The example available in the note shows how to change an routing operation description. The rest you have to figure out alone but once you start to use the functions or you'll check "where used" then it became quite easy (but not less time consuming).  When you find the function you're seeking then it's piece of cake.

It was like that also with delete routing function which I share with you today. There is no BAPI_ROUTING_DELETE (yet), so firsty we had to load the task to EWB memory with 'CP_CC_S_LOAD_COMPLEX_BY_TSK' ,then it's time to set deletion indicator in MAPL ('CP_CC_S_DELETE_BY_MTK') and in PLKO ('CP_CC_S_DELETE_BY_TSK'). At the end we have to save the changes  with 'CP_CC_S_SAVE' and dequeue task with 'CP_CL_TSK_UNLOCK'. If you need you may also delete the operations but in my opinion this is not needed here.

ABAP code:

form delete_routing_ewb using f_plnty type plko-plnty
                              f_plnnr 
type plko-plnnr
                              f_plnal 
type plko-plnal
                              f_matnr 
type mapl-matnr
                              f_werks 
type mapl-werks.

  type-poolscpscczcl.
  dataf_classes_in_workarea like classes_in_workarea.
  dataf_tsk_plnty_selection type cpsc_plnty_type.
  dataf_tsk_plnnr_selection type cpsc_plnnr_type.
  dataf_tsk_plnal_selection type cpsc_plnal_type.
  dataf_tsk_selection type cpsc_tsk_sel_type.
  dataf_tsk_ident type  cpcl_tsk_ident_type.
  dataf_mtk_ident type czcl_mtk_type.

* objects for loading
  f_classes_in_workarea-mtk_inarea 'X'.
  f_classes_in_workarea-tsk_inarea 'X'.
  f_classes_in_workarea-seq_inarea 'X'.
  f_classes_in_workarea-opr_inarea 'X'.
  f_classes_in_workarea-suo_inarea 'X'.
  f_classes_in_workarea-prt_inarea 'X'.
  f_classes_in_workarea-com_inarea 'X'.
  f_classes_in_workarea-itm_inarea 'X'.
  f_classes_in_workarea-bom_inarea 'X'.

* fill selection conditions
  concatenate 'I' 'EQ' f_plnty into f_tsk_plnty_selection.
  append f_tsk_plnty_selection to f_tsk_selection-plnty.

  concatenate 'I' 'EQ' f_plnnr into f_tsk_plnnr_selection.
  append f_tsk_plnnr_selection to f_tsk_selection-plnnr.

  concatenate 'I' 'EQ' f_plnal into f_tsk_plnal_selection.
  append f_tsk_plnal_selection to f_tsk_selection-plnal.

* load objects into EWB
  call function 'CP_CC_S_LOAD_COMPLEX_BY_TSK'
    exporting
      i_class                        'P'
      i_classes_in_workarea          f_classes_in_workarea
      i_cpsc_tsk_sel                 
f_tsk_selection
      i_date_from                    
sy-datum
      i_date_to                      
sy-datum
    
exceptions
      workarea_not_found             1
      workarea_wrong_type            2
      class_in_workarea_inconsistent 3
      workarea_not_specified         4
      opr_not_found                  5
      no_selection_criteria          6
      invalid_selection_period       7
      key_date_required_for_ecm      8
      others                         9.

  if sy-subrc eq 0.
 "prepare ident for material task allocation
      f_mtk_ident-mandt sy-mandt.
      f_mtk_ident-plnty f_plnty.
      f_mtk_ident-plnnr f_plnnr.
      f_mtk_ident-plnal f_plnal.
     
f_mtk_ident-zkriz f_plnal.
      f_mtk_ident-matnr f_matnr.
      f_mtk_ident-werks f_werks.
*    f_mtk_ident-vbeln = f_vbeln.
*    f_mtk_ident-posnr = f_posnr.
*  f_mtk_ident-matnr_ext = .

      "delete material-task allocation MAPL-LOEKZ
      call function 'CP_CC_S_DELETE_BY_MTK'
      exporting
*       I_ECN_S                         = I_ECN_S
        i_key_date_s                    sy-datum
        i_mtk_ident                     
f_mtk_ident
*     IMPORTING
*       E_TSK_LOCK                      = E_TSK_LOCK
*       E_ECM_DATA_ERROR_TYPE           = E_ECM_DATA_ERROR_TYPE
*       E_OPR_LOCK                      = E_OPR_LOCK
      exceptions
        no_authority                    1
        no_authority_for_material       2
        no_valid_allocation             3
        no_key_date                     4
        task_not_locked                 5
        path_incomplete                 6
        ecm_data_not_suitable           7
        no_authority_for_qm             8
        opr_not_locked                  9
        others                          10
        .
      if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.

    "prepare Task ident for deletion
    f_tsk_ident-mandt sy-mandt.
    f_tsk_ident-plnty f_plnty.
    f_tsk_ident-plnnr f_plnnr.
    f_tsk_ident-plnal f_plnal.

    "delete routing (PLKO-LOEKZ)
    call function 'CP_CC_S_DELETE_BY_TSK'
    exporting
*   I_ECN_S                       = I_ECN_S
      i_key_date_s                  sy-datum
      i_tsk_ident                   
f_tsk_ident
*   I_FLG_ECM_FILTER              = ' '
* IMPORTING
*   E_TSK_LOCK                    = E_TSK_LOCK
*   E_ECM_DATA_ERROR_TYPE         = E_ECM_DATA_ERROR_TYPE
    exceptions
      no_authority                  1
      no_valid_task                 2
      no_key_date                   3
      task_not_locked               4
      path_incomplete               5
      ecm_data_not_suitable         6
      reference_set_is_in_use       7
      others                        8
      .

    if sy-subrc eq 0.
"save changes
     call function 'CP_CC_S_SAVE'
        exceptions
          error_at_save 1
          others        2.
      if sy-subrc eq 0.
        commit work.
      else.
        rollback work.
      endif.

    endif.

  endif.

  "dequeue Task
  call function 'CP_CL_TSK_UNLOCK'
  exporting
*   MODE_TSK_CLASS_LOCK       = 'E'
*   MANDT                     = SY-MANDT
    plnty                     'N'
    plnnr                     f_plnnr
    plnal                     
f_plnal
*   X_PLNTY                   = ' '
*   X_PLNNR                   = ' '
*   X_PLNAL                   = ' '
    _synchron                 'X'
*   _COLLECT                  = ' '
* IMPORTING
*   E_NAME                    = E_NAME
  exceptions
    foreign_lock              1
    system_failure            2
    others                    3
    .
  if sy-subrc eq 0.

  endif.

endform.                    "delete_routing_ewb

Enjoy it!