*&--------------------------------------------------------------------*
*&      Form DELETE_CHECK_KEYRANGE                                    *
*&--------------------------------------------------------------------*
* check keyrange for delete                                           *
*---------------------------------------------------------------------*
FORM DELETE_CHECK_KEYRANGE.
  LOCAL: EXTRACT, TOTAL, <TABLE1>.
  DATA: DCK_SPECMODE_SAFE LIKE VIM_SPECIAL_MODE.

  CLEAR SY-SUBRC.
  CHECK X_HEADER-CUSTOMAUTH CO SAP_CUST_CTRL_CLASSES OR
        VIM_ALE_KEYSPEC_CHECK NE SPACE.
  DCK_SPECMODE_SAFE = VIM_SPECIAL_MODE.
  PERFORM MOVE_EXTRACT_TO_VIEW_WA.
  IF STATUS-MODE EQ LIST_BILD.
    VIM_SPECIAL_MODE = VIM_DELETE.
  ELSE.
    CLEAR VIM_SPECIAL_MODE.
  ENDIF.
  CLEAR VIM_KEYRANGE_ALR_CHECKED.
  PERFORM CHECK_ALLOWED_KEYRANGES.
* "HCG: In synchronization, Adjust and BC-Set import keyrange-check
*  should be neglected and data should be deleted anyway 24/06/2002
  IF SY-SUBRC NE 0 AND vim_import_profile EQ SPACE.
* synchornization only in BC-Set, only vim_import_profile is enought
* to test, if it is called from BC-Set. XB H594362 07022003
*                   AND DCK_SPECMODE_SAFE NE vim_upgrade.
    IF STATUS-MODE EQ LIST_BILD.
      CASE STATUS-TYPE.
        WHEN EINSTUFIG.
          CALL SCREEN LISTE.
          IF OK_CODE EQ 'IGN '. FUNCTION = OK_CODE. ENDIF.
        WHEN ZWEISTUFIG.
          PERFORM PROCESS_DETAIL_SCREEN USING 'C'.
          STATUS-MODE = LIST_BILD.
      ENDCASE.
    ENDIF.
    IF VIM_ALE_KEYSPEC_CHECK NE SPACE. "never delete ALE-locked keys
      FUNCTION = 'IGN '.
    ENDIF.
    CLEAR: SY-SUBRC, OK_CODE.
    CASE FUNCTION.
      WHEN 'IGN '. SY-SUBRC = 4.
      WHEN 'ABR '. SY-SUBRC = 8.
    ENDCASE.
  ENDIF.
* CLEAR VIM_SPECIAL_MODE.
  VIM_SPECIAL_MODE = DCK_SPECMODE_SAFE.
  FUNCTION = 'DELE'.
ENDFORM.                               "delete_check_keyrange
