Implement the GET_ENTITY method for the SalesOrder entity. Since the only sales
order items returned are those in the context of a specific sales order, you first implement
reading a specific sales order using the GET_ENTITY method.
Procedure
- Scroll down to the SALESORDER_GET_ENTITY method, place the cursor in the row, and
click Redefine.
- Implement the method using this code:
method SALESORDERS_GET_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_GET_DETAIL'
EXPORTING
SO_ID = ls_so_id
IMPORTING
HEADERDATA = er_entity
* TABLES
* CONTACTDATA =
* RETURN = lt_return
.
endmethod.
The BAPI function BAPI_EPM_SO_GET_DETAIL returns the sales order header
information by passing in the SO_ID key.
- Click the Activate icon.
- If you see any warnings, recheck the code, correct any mistakes, then click
Activate again.
- Click Back
to return to the Class
Interface screen.