Determination and allocation of value

Even simple fields are represented as objects, so-called Nullable Values (recognizable by the ending _NV). This makes it possible in the BAdI to differentiate whether a value is to be "zero" or empty. There is also a data object factory for Nullable Values, which is available as an importing parameter in the corresponding BAdIs.

Example

Meaning

Document_value_as_nv =
im_nullable_value_factory->dec_15_2( 0 ).

Value is 0.00.

Document_value_as_nv =
im_nullable_value_factory->dec_15_2( ‘15.23’ ).

Value is 15.23.

Clear document_value_as_nv.

instance is "zero"/null and the value is not interpreted.

DATA:
    items     TYPE /aeb/if_cmp_pb_ec_item_do=>tt_ec_item_do,
    curr_item TYPE REF TO /aeb/if_cmp_pb_ec_item_do,
    prd       TYPE REF TO /aeb/if_cmp_pb_ec_prd_cls_do.

  items = im_value->get_items( ).
  LOOP AT items INTO curr_item.
    IF curr_item->get_material_number( )->v = 'MAT_TEST'.
      prd = im_data_object_factory->new_cmp_pb_ec_prd_cls_do( ).
      prd->set_classification_identcode( im_nullable_value_factory->char_50( 'ClassificationAusfuhrliste') ).
      prd->set_classification_number( im_nullable_value_factory->char_50( '0001' ) ).
      curr_item->add_product_classification( prd ).
    ENDIF.
  ENDLOOP.
DATA:
    new_aom  TYPE REF TO /aeb/if_aes_pb_aom_do,
    value_nv TYPE REF TO /aeb/cl_01_dec_17_2_nv.

  value_nv = im_nullable_value_factory->dec_17_2( '100.25' ).
  new_aom = im_cons_data_object_factory->new_aes_pb_aom_do_v1(
              im_currency_iso = 'EUR'
              im_value        = value_nv ).