cancel
Showing results for 
Search instead for 
Did you mean: 

Delivery address updating based on Plant in ME21N

sandeep_reddy24
Participant
0 Kudos

Dear All,

My requirement: I have a plant consider 0900, we have updated the plant address in MEAN Tcode.

I can see an entry in ADRC table, but while creating the PO in ME21N by giving the plant as 0900, system is fetching

the old address, not the new address.

Please suggest me the solution and if any code.

Thanks in Advance

Sandeep.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sandeep,

The trx ME21n gets the address from t001w coded in section below...

LMEGUICIM

* plant
     CALL METHOD my_converter->convert_plant_output
       EXPORTING
         im_werks = im_item-werks
       IMPORTING
         ex_name1 = l_item_data_entry-data-name1.


I am assuming you are referring to the plant field on the items details


sandeep_reddy24
Participant
0 Kudos

Hi Abhijit,

Thanks for the reply.

We need the data to be pulled from ekpo-adrn2, which we have created in MEAN tcode.

this address will be the default address for plant 0900.

I found one badi ME_PROCESS_PO_CUST~PROCESS_ITEM.

but my logic is unable to display delivery address it in ME21N.

Please send me the logic how to display new address in PO.

Former Member
0 Kudos

In the badi ME_PROCESS_PO_CUST method PROCESS_ITEM has the parameter IM_ITEM (interface IF_PURCHASE_ORDER_ITEM_MM).

You should use two methods of that interface,  the method GET_DATA to get items data, change the field ADR2 (put the new Address number) then use method SET_DATA.

Regards,

Felipe

sandeep_reddy24
Participant
0 Kudos


Hi Felipe,

I did in the sam way as you mentioned. I am facing new issue " Address doesn't exist 91647"

But the address exist in ADRC table.

Please suggest me.

Former Member
0 Kudos

Have you pass the address number with leading zeros?

sandeep_reddy24
Participant
0 Kudos

Yes i passed with leading zeros.

If you have any sample code please send me.

Its very urgent requirement.

Former Member
0 Kudos

Could you please go to ME21n/ME22n (tab Delivery Address) and check if you could find the address number using the match code as below?

sandeep_reddy24
Participant
0 Kudos

Hi Felipe,

I have done the coding like this, please let me know if i am wrong.

  DATA: ls_mepoitem    TYPE mepoitem,

        ls_mepoitemx   TYPE mepoitemx,

        ls_mepoheader  TYPE REF TO if_purchase_order_mm,

        ls_mepoheader2 TYPE mepoheader,

        header         TYPE ekko,

        lv_adrnr       TYPE adrnr,

        ls_ekpo        TYPE ekpo,

        ls_adrc        TYPE adrc,

        ls_cmmda       TYPE cmmda.

  ls_mepoheader  im_item->get_header( ).

  ls_mepoheader2 ls_mepoheader->get_data( ).

  ls_mepoitem    im_item->get_data( ).

  IF ls_mepoitem-adrn2 IS INITIAL AND

     ls_mepoitem-lgort IS NOT INITIAL AND

     ls_mepoitem-werks = '0900'.

    SELECT SINGLE *

     FROM ekpo

     INTO ls_ekpo

      WHERE werks = ls_mepoitem-werks

*      AND ekgrp = ls_mepoheader2-ekgrp

      AND wepos = ls_mepoitem-wepos.

*      and adrn2 = ls_mepoitem-adrn2.

    ls_ekpo-adrn2 = '00091647'.

    IF sy-subrc = 0.
    
      ls_mepoitem-adrn2 = ls_ekpo-adrn2.
    
      CALL METHOD im_item->set_data

        EXPORTING

          im_data = ls_mepoitem.

    ENDIF.

Former Member
0 Kudos

As your are getting that error message seems that the problem is not with your code. Please check if you are able to change the address using the matchcode as I suggested.

sandeep_reddy24
Participant
0 Kudos

Hi Felipe,

I am able to see the address using match code.

Former Member
0 Kudos

Use im_item->get_data( ) with an internal table to retrieve the data, as you are using a structure you will get only one item.

sandeep_reddy24
Participant
0 Kudos

I am able to change the address using match code, and its updating.

Former Member
0 Kudos

Maybe your are missing 2 zeros in the address number, try using CONVERSION_EXIT_ALPHA_INPUT

sandeep_reddy24
Participant
0 Kudos

Hi Felipe,

Thank you very much!!!

Its working after using CONVERSION_EXIT_ALPHA_INPUT.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sandeep,

Try changing the address from the path below:

SPRO >>Enterprise Structure>>Definition>>Logistics General>>Define Copy Check Plant >>Define Plant

Regards,

Ashvin

sandeep_reddy24
Participant
0 Kudos

Hi Nanreshsing,

Thanks for the reply.

I dont want to change the address in SPRO >>Enterprise Structure>>Definition>>Logistics General>>Define Copy Check Plant >>Define Plant

but i need to fetch from ADRC table.

Former Member
0 Kudos

Is the address correct in tcode OX10? where are you getting the incorrect address? is it in the plant match code?

I have just done a test changing the plant address in OX10 and in ME21n looks good.

Regards,

Felipe