Skip to Content

Get runtime value of PO Header address in badi IF_EX_ME_PROCESS_PO_CUST~CHECK

Hi all,

for ME21N/ME22N, we are implementing the badi ME_PROCESS_PO_CUST for PO validations. we could implement many validations in the method IF_EX_ME_PROCESS_PO_CUST~CHECK.

in ME22N, there for PO Header, there is Address tab, that gets populated with Vendor address by default, that use can change. in the method IF_EX_ME_PROCESS_PO_CUST~CHECK of badi ME_PROCESS_PO_CUST, how can we retrieve this current value.

The im_header->get_data( ), returns header data of type mepoheader, but it does not have runtime address fields.

it has ADRNR field, but that gets saved only after successful save.

Is there any way, to find the current runtime values of address tab of PO Header.

Thanks,
Madhu_1980.

clipboard01.jpg (117.7 kB)
clipboard02.jpg (79.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • May 29, 2017 at 08:33 AM

    Hi Madu,

    This old discussion as well as this one both give useful hints on how to approach the issue.

    CALL METHOD im_header->GET_DATA
    RECEIVING
    RE_DATA = wal_ekko.
    
    ***Widening cast for reference.
    Data:
    zcl_po TYPE REF TO CL_PO_HEADER_HANDLE_MM,
    zim_header TYPE REF TO IF_PURCHASE_ORDER_MM,
    tl_partners type MMPUR_PARTNER_ALL_TAB,
    wal_partners type LINE OF MMPUR_PARTNER_ALL_TAB.
    
    zIM_HEADER = IM_HEADER.
    
    zcl_po ?= zIM_HEADER.
    
    CALL METHOD zcl_po->IF_PURCHASING_DOCUMENT~GET_PARTNERS
    RECEIVING
    RE_PART = tl_partners.

    In your TL_PARTNERS you should have all the addresses you need.

    Add comment
    10|10000 characters needed characters exceeded

  • May 29, 2017 at 08:47 AM

    Hi Simone,

    I tried the method zcl_po->IF_PURCHASING_DOCUMENT~GET_PARTNERS.

    It is providing TL_PARTNERS information, which has all fields of Partners tab in PO Header in ME22N.
    It is not providing any fields like Street/House number in Address tab of PO Header.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Madhu,

      did you try to mix the 2 solutions i linked? Using the read address function (like Raymond suggested) with the ADRNR in header...

      it's what the 1st link of mine did, pointing out the needing information.

  • May 29, 2017 at 08:47 AM

    Once you get ADRNR, you could use the FM or global data of group SZA1 (SAPLSZA1) to read data of currently displayed address from memory. You could also use MM_DELIVERY_ADDRESS_READ (function group MMDA) followed by ADDR_GET_COMPLETE with address handle to read any address from memory.

    Another solution could be use of BAdI ADDRESS_CHECK (checking for transaction code or for BAPI in the Abap stack)

    Add comment
    10|10000 characters needed characters exceeded

  • May 29, 2017 at 09:42 AM

    Hi Raymond,

    DATA:  i_ekko  TYPE  ekko,  
    e_name1 TYPE addr1_val-name1,
    e_address TYPE addr1_val,
    e_sadr TYPE sadr,
    e_addr_complete TYPE szadr_addr1_complete. ls_header = im_header->get_data( ).
    MOVE-CORRESPONDING ls_header TO i_ekko. CALL FUNCTION 'MM_ADDRESS_GET'
    EXPORTING i_ekko = i_ekko
    IMPORTING e_name1 = e_name1
    e_address = e_address
    e_sadr = e_sadr
    e_addr_complete = e_addr_complete.

    we can see the current runtime address in the structure e_address.

    But this is working only in ME22N tcode.

    In ME21N tcode, in the structure e_address, it is showing the vendor address values, but not the current values of PO Header Address tab.

    Add comment
    10|10000 characters needed characters exceeded

    • This FM was provided so you understand that there is not always a PO address (if you don't change any field from default proposal for example) You have to find a FM that read data from memory, so analyze MM_ADDRESS_GET to find ADDR_GET.