Use method UPDATE
to change a unit of measurement. For customer units, the name of the internal unit must start with a ‘Z’ for any changes.
Parameter Name |
Field Name |
Value Help |
---|---|---|
UNIT |
|
Internal unit of measurement |
UNIT_UPD_TS |
|
Structure for updating a unit of measurement |
|
COMMERCIAL |
Commercial/external measurement unit format |
|
TECHNICAL |
Technical measurement unit format |
|
DEC_ROUND |
Number of decimal places to which this measurement unit should be rounded for conversion |
|
NUMERATOR |
Numerator for conversion to SI unit |
|
DENOMINATOR |
Denominator for conversion into SI unit |
|
EXPONENT |
Base ten exponent for conversion to SI unit |
|
CONSTANT |
Additive constant for conversion to SI unit |
|
DEC_DISP |
Number of decimal places with which this measurement unit is displayed |
|
ISOCODE |
ISO code for measurement units. An ISO code can be assigned to several internal measurement units of a dimension. |
|
PRIMARY |
Unit of measure flagged as a primary unit for an ISO code Space: Not primary ‘X’: Set as primary |
|
TEXT |
Description of a unit of measurement |
|
LONG_TEXT |
Long description of a unit of measurement |
Parameter Name |
Value Help |
---|---|
ERROR |
Space: No error ‘X’: Save error |
Class exception
CX_UOM_ERROR
is raised to check the integrity of the data import parameters.
CLASS zcl_uom_unit_update_test DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_uom_unit_update_test IMPLEMENTATION. METHOD if_oo_adt_classrun~main. DATA: lo_uom TYPE REF TO cl_uom_maintenance, ls_unit TYPE cl_uom_maintenance=>ty_uom_upd_ts. cl_uom_maintenance=>get_instance( RECEIVING ro_uom = lo_uom ). ls_unit-commercial = 'ZYA'. ls_unit-technical = 'ZYA'. ls_unit-denominator = '1'. ls_unit-numerator = '1'. ls_unit-dec_disp = '5'. ls_unit-long_text = 'Update Unit'. ls_unit-text = 'Upd Unit'. TRY. lo_uom->update( EXPORTING unit = 'ZYX' unit_upd_ts = ls_unit IMPORTING error = DATA(error) ). CATCH cx_uom_error INTO DATA(lo_error). out->write( |Exception raised| ). out->write( lo_error->get_text( ) ). ENDTRY. ENDMETHOD. ENDCLASS.