Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Requirement


My customer asked me to add controls on "Services" and "Limits" Purchase Requisition tabs.

Services tab:


Limits tab:


For me the BADI ME_PROCESS_REQ_CUST is the good solution but in the method PROCESS_ITEM these datas are not accessible directly.

In the import parameters, the object im_item has type IF_PURCHASE_REQUISITION_ITEM and in this interface there is not method to get back these datas.

In debug we can see that the calling class is LCL_REQ_ITEM from include LMEREQF01.


This local class uses global interface IF_SERVICES_MM:

And this interface has a method (GET_SRV_DATA) who returns "Limits" and "Services" data. The goal will be to cast the import parameter into a IF_SERVICES_MM object and use the method get_srv_data on it.

Solution


  DATA: lo_services TYPE REF TO if_services_mm,
ls_item TYPE mereq_item,
lt_esll TYPE mmsrv_esll,
lt_esuh TYPE mmsrv_esuh,
lt_esuc TYPE mmsrv_esuc,
lt_eskl TYPE mmsrv_eskl.

* Get current item data
CALL METHOD im_item->get_data
RECEIVING
re_data = ls_item.

TRY.
* Casting
lo_services ?= im_item.
CATCH cx_sy_move_cast_error.
RETURN.
ENDTRY.

* Get data from Services and Limits tabs
CALL METHOD lo_services->get_srv_data
EXPORTING
im_packno = ls_item-packno
* im_limit = abap_true
IMPORTING
ex_esll = lt_esll
ex_esuh = lt_esuh
ex_esuc = lt_esuc
ex_eskl = lt_eskl
EXCEPTIONS
failure = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.

Use flag im_limit depending on the needs.

Hope that will help you, and if you have questions about it i will try to answer it.
1 Comment
Labels in this area