Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Get services data in BADI ME_PROCESS_REQ_CUST when creating or modifying a PR via BAPI

ltirado
Discoverer
0 Kudos
1,565

Hi there,

We are using the method GET_SRV_DATA of interface IF_SERVICES_MM in order to get the services data in the method CHECK of BADI ME_PROCESS_REQ_CUST. This works correctly when the PR is being created or modified from transactions ME51N or ME52N.

DATA: lo_services TYPE REF TO if_services_mm.

* 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.

But the method GET_SRV_DATA does not return data when the PR is being created or modified via BAPI (BAPI_PR_CREATE or BAPI_PR_CHANGE). Is there an alternative way to obtain the service data in this case?

Thanks!

Regards,

1 REPLY 1

bharatbajaj
Active Participant
0 Kudos
786

Did you find any solution to this ?

I am facing the same problem in my project.