on 12-12-2007 3:48 PM
Hi all,
I´m Trying to make a validation in the services line for tx me21n, i´m using the badi PROCESS_PO_CUST~PROCESS_ITEM and i need get the services lines. When use the declaration code posted by Rurik Ian Santos in another tread
DATA: item_serv TYPE REF TO if_services_mm.
DATA: ltmmsrv TYPE mmsrv_esll.
DATA: lsmmsrv TYPE LINE OF mmsrv_esll.
item_serv->GET_SRV_DATA(
EXPORTING
im_packno = ls_mepoitem-packno "globa variable
IMPORTING
ex_esll = ltmmsrv ).
i get a dump, and before enter the line item_serv->GET_SRV_DATA in the debugg the variable item_serv display the value **illegal reference ** somebody can tell me what is wrong ??
Thanks
Class : me_process_po_sust .
Method : process item .
Requirement : If Indicator Unlimited Overfulfillment( field esll-uebtk ) = 'X' in create/change purchase order using transaction me21n/me22n - set message error
*Problem : Empty table with Service Lines*What is wrong ?Please , help me .
method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.
DATA: ls_mepoitem TYPE mepoitem,
ls_mepoitemx type mepoitemx,
ls_customer TYPE mepo_badi_exampl,
ls_tbsg TYPE tbsg.
INCLUDE mm_messages_mac. "useful macros for message handling
*here we get item data
ls_mepoitem = im_item->get_data( ).
DATA : lr_po_item_handle TYPE REF TO cl_po_item_handle_mm ,
lf_limit type MMPUR_BOOL value 'X' ,
lt_db_esll TYPE MMSRV_ESLL ,
Lt_db_esuh TYPE MMSRV_ESUH ,
lt_db_esuc TYPE MMSRV_ESUC ,
lt_db_eskl TYPE MMSRV_ESKL .
lr_po_item_handle ?= im_item.
CALL METHOD lr_po_item_handle->if_services_mm~get_srv_data
EXPORTING
im_packno = ls_mepoitem-packno
im_limit = lf_limit
IMPORTING
ex_esll = lt_db_esll
ex_esuh = lt_db_esuh
ex_esuc = lt_db_esuc
ex_eskl = lt_db_eskl
EXCEPTIONS
failure = 1
OTHERS = 2.
READ TABLE lt_db_esll INTO L_ESLL WITH KEY UEBTK = 'X' .
IF sy-subrc = 0 .
MESSAGE E000(ZA) WITH 'Indicator Unlimited Overfulfillment Allowed ' .
ENDIF .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is an option to validate services lines in purchase orders:
METHOD if_ex_me_process_po_cust~process_item.
DATA lr_po_item_handle TYPE REF TO cl_po_item_handle_mm.
DATA: lt_esll TYPE TABLE OF esll,
ls_esll TYPE esll,
lt_imputaciones TYPE TABLE OF ueskn,
ls_imputacion TYPE ueskn.
DATA: ls_mepoitem TYPE mepoitem.
lr_po_item_handle ?= im_item.
CALL METHOD lr_po_item_handle->get_data
IMPORTING
ex_data = ls_mepoitem
EXCEPTIONS
failure = 1
OTHERS = 2.
----
CALL METHOD lr_po_item_handle->if_services_mm~get_srv_data
EXPORTING
im_packno = ls_mepoitem-packno
IMPORTING
ex_esll = lt_esll
ex_esuh =
ex_esuc =
ex_eskl =
EXCEPTIONS
failure = 1
OTHERS = 2.
----
CALL METHOD lr_po_item_handle->if_services_mm~get_data
EXPORTING
im_limit =
IMPORTING
ex_comsrv =
ex_acc_tab = lt_imputaciones
EXCEPTIONS
failure = 1
illegal_data = 2
OTHERS = 3.
----
LOOP AT lt_esll INTO ls_esll WHERE mwskz IS NOT INITIAL.
READ TABLE lt_imputaciones INTO ls_imputacion INDEX 1.
CHECK sy-subrc = 0.
u201Cvalidation
IF ( ls_mepoitem-knttp = 'F' OR ls_mepoitem-knttp = 'K' ) AND
ls_mepoitem-pstyp = '9'.
CALL FUNCTION 'ZABC' u201C it has an E message if false
EXPORTING
p_mwskz = ls_esll-mwskz
p_kostl = ls_imputacion-kostl
p_mod = 'TX'.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
hi Patrick,
thanks for yuor answer, but the interfases can not be created, anyway i change the declaration to
DATA: l_item TYPE REF TO cl_po_item_handle_mm. and then used this call method
CALL METHOD l_item->if_services_mm~get_srv_data
EXPORTING
im_packno = ls_mepoitem-packno
im_limit = lf_limit
IMPORTING
ex_esll = lt_db_esll
ex_esuh = lt_db_esuh
ex_esuc = lt_db_esuc
ex_eskl = lt_db_eskl
EXCEPTIONS
failure = 1
OTHERS = 2.
but now i got a problem with null reference, because the l_item is empty...i used some methods but always gets dumps
Anybody have an example to how obtain the serivces lines into a badi IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM for me22n ? i don´t know how reach this lines
Martin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We're in three I got the exact same problem too...
DATA IM_SRV TYPE REF TO IF_SERVICES_MM.
...
CALL METHOD IM_SRV->get_srv_data
EXPORTING
IM_PACKNO = im_data_new-packno
IM_LIMIT = 'X'
IMPORTING
EX_ESLL = EX_ESLL
EX_ESUH = EX_ESUH
EX_ESUC = EX_ESUC
EX_ESKL = EX_ESKL.
and get exactly the same dump (illegal reference). Anyone solved it?
Found a workaround, maybe can solve your problem (it solved mine, even tho is not that "clean").
The one that follows is the implementation of GET_SRV_DATA:
DATA: my_esuh TYPE LINE OF mmsrv_esuh.
IF im_limit EQ mmpur_no.
get ESLL for specific package number
CALL FUNCTION 'MS_READ_SERVICES'
EXPORTING
i_hpackno = my_im_data-packno
TABLES
t_esll = ex_esll.
* ENDIF.
* get Limit information for package number
CALL FUNCTION 'MS_READ_LIMITS'
EXPORTING
packno = my_im_data-packno
IMPORTING
e_esuh = my_esuh
TABLES
limit_tab = ex_esuc
EXCEPTIONS
no_limits_found = 1
OTHERS = 2.
IF sy-subrc EQ 2.
RAISE failure.
ENDIF.
* Limits ESUH
IF my_esuh-packno NE space.
INSERT my_esuh INTO TABLE ex_esuh.
ENDIF.
* get account assignment information
CALL FUNCTION 'MS_ACCOUNT_READ_ESKL'
EXPORTING
i_packno = my_im_data-packno
TABLES
t_eskl = ex_eskl.
Just copy this chunk of code and substitute it to the call of GET_SRV_DATA. Remember to change my_im_data, ex_esuh, ex_eskl, ex_esll, ex_esuc according to your variable's names.
Hope that helps,
Matteo
Hi Martin,
Another workaround to solve your problem be to use Function Exit EXIT_SAPLMLSP_031 of Enhancement SRVESLL to retrieve the ESLL data.
The the ESLL data can be exported from this Function Exit and can then be imported to Method PROCESS_ITEM of BADI ME_PROCESS_PO_CUST. This will solve your purpose of validating other fields/data based on ESLL data.
Hope this helps.
Regards,
Abhisek.
Hi All
The parameter IM_ITEM is itself an object of type CL_PO_ITEM_HANDLE_MM but has been passed to the method via the interface IF_PURCHASE_ORDER_ITEM_MM. All you need to do is cast the method parameter to the class type and then you can call the GET_SRV_DATA method. eg.
DATA lr_po_item_handle TYPE REF TO cl_po_item_handle_mm.
lr_po_item_handle ?= im_item.
CALL METHOD lr_po_itemhandle->if_services_mm~get_srv_data
etc....
It's probably best to add some exception handling, particularly around the type casting statement... just in case.
(That works for GET ting the service data... now if I could only work out how to SET the service data as per the SET_DATA method for the item...)
Regards
Glen
Hi Martin,
You get a dump because you have not instantiated the item_serv object. Try:
create object item_serv.
Before you call get_srv_data( ).
Regards,
Patrick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
97 | |
10 | |
9 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.