Skip to content

Latest commit

 

History

History
120 lines (83 loc) · 1.91 KB

deleting-a-unit-of-measurement-54ded5b.md

File metadata and controls

120 lines (83 loc) · 1.91 KB

Deleting a Unit of Measurement

Use method DELETE to delete a unit of measurement.

Caution:

Changing the initial set of configurations has implications. Before proceeding with any change, familiarize yourself with the warnings in Units of Measurement.


Parameter Name

Value Help

UNIT

Internal unit of measurement


Parameter Name

Value Help

ERROR

Space: No error

‘X’: Save error

Note:

Class exception CX_UOM_ERROR is raised to check the integrity of the data import parameters.

Sample Code:

CLASS zcl_uom_unit_delete_test DEFINITION 
  PUBLIC 
  FINAL 
  CREATE PUBLIC.
 
  PUBLIC SECTION. 
    INTERFACES if_oo_adt_classrun. 
  PROTECTED SECTION. 
  PRIVATE SECTION. 
ENDCLASS. 
 
CLASS zcl_uom_unit_delete_test IMPLEMENTATION. 
 
  METHOD if_oo_adt_classrun~main. 
    DATA(lo_uom) = cl_uom_maintenance=>get_instance( ). 
 
    TRY. 
        lo_uom->delete( EXPORTING unit = 'ZYX' 
                        IMPORTING error = DATA(lv_error) ). 
                        
      CATCH cx_uom_error INTO DATA(lo_error). 
        out->write( | Exception raised | ). 
        out->write( lo_error->get_text( ) ). 
    ENDTRY. 
    IF lv_error = abap_true.
      out->write( |Error occurred while deleting the data from the database| ).
    ENDIF.
  ENDMETHOD. 
ENDCLASS.