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: 

BAdI Interface IF_EX_ME_PROCESS_PO_CUST Method CHECK Get USERF1_TXT Value

Former Member
0 Kudos

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!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

Source:

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!

4 REPLIES 4

Former Member
0 Kudos

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.

Source:

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!

0 Kudos

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!

0 Kudos

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

0 Kudos

Unfortunately I couldn't find any interface method for updating ESLL. I have used User Exit SRVESLL (Exit EXIT_SAPLMLSP_030) for this.

Thanks!