Code template for redefinition of DELETE_ENTITY

📟 delete_entity

Placeholder function – replace with the relevant business logic

📟 check_msg_and_raise_exceptions

Take a look at Generic Exception handling (BAPIRET2) in OData

  METHOD <ENTITY>set_delete_entity.
    DATA: lo_message_container TYPE REF TO /iwbep/if_message_container.
    DATA: ls_entity TYPE zcl_..._mpc=>ts_xyz.
    DATA: lt_return TYPE bapiret2_t.

*--- Basic requirements
    lo_message_container = mo_context->get_message_container( ).

*--- read keys
    io_tech_request_context->get_converted_keys(
      IMPORTING
        es_key_values = ls_entity
    ).

*--- delete entity - execute business logic
    delete_entity(
      EXPORTING
        i_id        = ls_entity-id
        i_parameter = ls_entity-parameter
      IMPORTING
        et_return   = lt_return
    ).

*-- check for errors
    check_msg_and_raise_exceptions(
      EXPORTING
        it_messages         = lt_return
        i_message_container = lo_message_container
    ).
    
  ENDMETHOD.

Leave a Reply

Your email address will not be published. Required fields are marked *