Skip to Content

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.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply