07-03-2014 9:27 PM
Hi,
I have a requirement to validate value in field USERF1_TXT (User Field 3) before PO gets saved. I have checked the import parameter IM_HEADER structure and it's sub-structures but cannot find the field USERF1_TXT. This field is visible under Item Services tab and is part of ESLL structure.
Is there way I can read & update its value from this BAdI Interface IF_EX_ME_PROCESS_PO_CUST Method CHECK?
Thanks!
07-08-2014 3:14 AM
You can try to get the itens by the method IM_HEADER-GET_ITEMS...
Then you can read the itens to an object, like IM_ITEM.
Finally you can check the services by the Handle Class cl_po_item_handle_mm.
Example:
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
*** RELEVANT PARAMETERS ***
IMPORTING
*** RELEVANT PARAMETERS ***
EXCEPTIONS
failure = 1
illegal_data = 2
OTHERS = 3.
ENDIF.
At the source example the validation check is at the PROCESS_ITEM, but I think that it doesn't matter (maybe)...
I hope it helps!
07-08-2014 3:14 AM
You can try to get the itens by the method IM_HEADER-GET_ITEMS...
Then you can read the itens to an object, like IM_ITEM.
Finally you can check the services by the Handle Class cl_po_item_handle_mm.
Example:
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
*** RELEVANT PARAMETERS ***
IMPORTING
*** RELEVANT PARAMETERS ***
EXCEPTIONS
failure = 1
illegal_data = 2
OTHERS = 3.
ENDIF.
At the source example the validation check is at the PROCESS_ITEM, but I think that it doesn't matter (maybe)...
I hope it helps!
07-14-2014 1:50 PM
Thanks for your response. With above, I am able to pull ESLL data however I couldn't find a method in the same interface for updating it's value. Is there any other method or interface to update it?
Thanks!
07-14-2014 2:32 PM
Nice!
I think it's better you try to work on PROCESS_ITEM method.
In that method you can modify item data, so I believe that you can change the services data too...
07-24-2014 4:22 PM
Unfortunately I couldn't find any interface method for updating ESLL. I have used User Exit SRVESLL (Exit EXIT_SAPLMLSP_030) for this.
Thanks!