Skip to content

Latest commit

 

History

History
351 lines (235 loc) · 4.19 KB

File metadata and controls

351 lines (235 loc) · 4.19 KB

Changing a Dimension

Use method UPDATE to change an existing dimension.

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

Field Name

Value Help

DIMID

 

Dimension key

DIM_UPD_TS

 

Structure for updating a dimension

Caution:

Be aware that all the fields belonging to the structure will be updated.

 

TXDIM

Description of the dimension key

 

SI_UNIT

Base unit of a dimension

 

LENGTH

Length exponent of the dimension

 

MASS

Mass exponent of the dimension

 

TIME

Time exponent of the dimension

 

CURRENT

Electric current exponent of the dimension

 

TEMPERATURE

Temperature exponent of the dimension

 

MOLE_QTY

Mole quantity exponent of the dimension

 

LUMINOSITY

Light exponent of the dimension

 

HASUNITSWITHTEMPERATURESPEC

Indicates whether the dimension has units with a temperature specification

 

HASUNITSWITHPRESSURESPEC

Indicates whether the dimension has units with a pressure specification


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_dimension_update_test DEFINITION 
  PUBLIC 
  FINAL 
  CREATE PUBLIC . 
 
  PUBLIC SECTION. 
    INTERFACES if_oo_adt_classrun. 
 
  PROTECTED SECTION. 
  PRIVATE SECTION. 
ENDCLASS. 
 
CLASS zcl_uom_dimension_update_test IMPLEMENTATION. 
  METHOD if_oo_adt_classrun~main. 
   DATA(lo_dim) = cl_uom_dim_maintenance=>get_instance( ).


   TRY.
        lo_dim->read( EXPORTING dimid    = 'ZNEWDI'
              IMPORTING dim_st = DATA(ls_dim) ).

   DATA(ls_upd_dim) = VALUE cl_uom_dim_maintenance=>ty_dim_upd_ts(
                      BASE CORRESPONDING #( ls_dim )
                                            txdim = 'Update Dimension'
                                            mass  = 88
                                            length = 89 ).

    lo_dim->update( EXPORTING dimid      = 'ZNEWDI'
                              dim_upd_ts = ls_upd_dim
                    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 updating the data in the database| ).
   ENDIF.
  ENDMETHOD. 
ENDCLASS.