Developer

Implementing DELETE_ENTITY

Use DELETE_ENTITY to delete a single SalesOrder entry.

Procedure

  1. From the Class Builder screen for class ZCL_Z_EPM_RKT_DPC_EXT, scroll down to the SALESORDERS_DELETE_ENTITY method, place the cursor in the row, and click Redefine.
  2. Implement the method with this code:
    method SALESORDERS_DELETE_ENTITY.
    
      DATA: lt_keys TYPE /IWBEP/T_MGW_TECH_PAIRS,
            ls_key TYPE /IWBEP/S_MGW_TECH_PAIR,
            ls_so_id type BAPI_EPM_SO_ID,
            lv_so_id(10) type N.
    
      lt_keys = IO_TECH_REQUEST_CONTEXT->GET_KEYS( ).
    
      READ TABLE lt_keys with key name = 'SO_ID' INTO ls_key.
      lv_so_id = ls_key-value.
      ls_so_id-so_id = lv_so_id.
    
      CALL FUNCTION 'BAPI_EPM_SO_DELETE'
        EXPORTING
          SO_ID             = ls_so_id
    *   TABLES
    *     RETURN            = lt_return
                .
    
    endmethod. 

    The BAPI function BAPI_EPM_SO_DELETE deletes a sales order using the SO_ID key. No data is returned after a successful delete operation, instead, an HTTP response code of 204 is returned, confirming a successful delete operation.

  3. Click the Activate icon.

  4. If you see any warnings, recheck the code, correct any mistakes, then click Activate again.
  5. Click Back to return to the Class Interface screen, and Back again to return to themain Service Builder screen.