Skip to Content

Enhancement MM06E005 is already in use. Need to add custom tab in Tcode ME21n,ME22n,ME23n & ME29n.

Hi Abapers,

I need to add a custom tab in Tcode ME21n,ME22n,ME23n & ME29n. My problem is that Enhancement MM06E005 is already in use. Can someone please tell me the process to create a custom screen (not sure whether it should be a screen or subscreen) and then call it as a custom tab for tcode me21n. Need to know the coding part in PAI & PBO for this process. The data from screen should update in ekko table when po is saved from me21n as well as data should flow from table to screen when user views it from me22n & me23n. I have added the 6 zfields in CI_EKKODB.

Can someone please tell me the process how to do this.

Arijit

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Nov 24, 2016 at 10:43 AM

    You should read BAdI ME_GUI_PO_CUST documentation (ME_PROCESS_PO_CUST will also be required). But also read 1910516 - More than one customer data tab on purchase order header level ? So it may be (much) easier to split the customer subscreen of MM06E005 in two block and adapt exit course accordingly.

    Regards,
    Raymond

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 25, 2016 at 11:23 AM

    Hi Raymond,

    As instructed by you and after much struggle i was able to add the custom tab to ME21n but whenever i am clicking there me21n is going in a dump. I will share my complete process and code. Please let me know where i am going wrong. The dump file is attached.me21n-error.jpg

    1. First i created a function group. Then created a subscreen '0101' with program name 'SAPLZMM_ME21N'. In the screen i added 6 dictionary fields with name: CI_EKKODB-ZZSEC_DEPOSIT,CI_EKKODB-ZZMMDATE,CI_EKKODB-ZZDEP_AMT,CI_EKKODB-ZZENGR_INCHRG_NAME,CI_EKKODB-ZZENGR_INCHRG,CI_EKKODB-ZZDEPARTMENT.

    2. Now in BADI ME_GUI_PO_CUST i wrote the following code in different methods.

    i. IF_EX_ME_GUI_PO_CUST~SUBSCRIBE

    CHECK IM_APPLICATION = 'PO'.

    CHECK IM_ELEMENT = 'HEADER'.

    CLEAR: RE_SUBSCRIBERS[], LS_SUBSCRIBER.

    LS_SUBSCRIBER-NAME = SUBSCREEN1.
    LS_SUBSCRIBER-DYNPRO = '0101'.
    LS_SUBSCRIBER-PROGRAM = 'SAPLZMM_ME21N'.
    LS_SUBSCRIBER-STRUCT_NAME = 'CI_EKKODB'.
    LS_SUBSCRIBER-LABEL = 'Security Deposit'.
    LS_SUBSCRIBER-POSITION = 19.
    LS_SUBSCRIBER-HEIGHT = 7.
    APPEND LS_SUBSCRIBER TO RE_SUBSCRIBERS.

    ii. IF_EX_ME_GUI_PO_CUST~MAP_DYNPRO_FIELDS

    FIELD-SYMBOLS: <MAPPING> LIKE LINE OF CH_MAPPING.

    LOOP AT CH_MAPPING ASSIGNING <MAPPING>.

    CASE <MAPPING>-FIELDNAME.
    WHEN 'ZZSEC_DEPOSIT'.
    <MAPPING>-METAFIELD = MMMFD_CUST_01.
    WHEN 'ZZMMDATE'.
    <MAPPING>-METAFIELD = MMMFD_CUST_02.
    WHEN 'ZZDEP_AMT'.
    <MAPPING>-METAFIELD = MMMFD_CUST_03.
    WHEN 'ZZENGR_INCHRG_NAME'.
    <MAPPING>-METAFIELD = MMMFD_CUST_04.
    WHEN 'ZZENGR_INCHRG'.
    <MAPPING>-METAFIELD = MMMFD_CUST_05.
    WHEN 'ZZDEPARTMENT'.
    <MAPPING>-METAFIELD = MMMFD_CUST_06.
    ENDCASE.

    ENDLOOP.

    iii. IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_MODEL

    DATA: L_HEADER TYPE REF TO IF_PURCHASE_ORDER_MM,
    L_MEPOHEADER TYPE MEPOHEADER,
    L_CUSTOMER TYPE CI_EKKODB.

    CASE IM_NAME.

    WHEN SUBSCREEN1.

    * is it an item? im_model can be header or item.
    MMPUR_DYNAMIC_CAST L_HEADER IM_MODEL.
    *CHECK NOT l_header IS INITIAL.

    * transport standard fields
    L_MEPOHEADER = L_HEADER->GET_DATA( ).

    * store info for later use
    MOVE-CORRESPONDING L_MEPOHEADER TO DYNP_DATA_PBO.

    ENDCASE.

    iv. IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_DYNP

    CASE IM_NAME.

    WHEN SUBSCREEN1.

    CALL FUNCTION 'ZMM_POSECTAB_SET'
    EXPORTING
    IM_DYNP_DATA = DYNP_DATA_PBO.

    WHEN OTHERS.
    ENDCASE.

    here ZMM_POSECTAB_SET is a fm which has import parameter as IM_DYNP_DATA type CI_EKKODB

    FUNCTION ZMM_POSECTAB_SET.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *" IMPORTING
    *" REFERENCE(IM_DYNP_DATA) TYPE CI_EKKODB
    *"----------------------------------------------------------------------

    CI_EKKODB = IM_DYNP_DATA.

    ENDFUNCTION.

    v. IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_DYNP

    CASE IM_NAME.
    WHEN SUBSCREEN1.
    CALL FUNCTION 'ZMM_POSECTAB_GET'
    IMPORTING
    EX_DYNP_DATA = DYNP_DATA_PAI.
    IF DYNP_DATA_PAI NE DYNP_DATA_PBO.
    * something has changed therefore we have to notify the framework to transport data to the model
    RE_CHANGED = MMPUR_YES.
    ENDIF.
    WHEN OTHERS.
    ENDCASE.

    here ZMM_POSECTAB_GET is a fm which has export parameter as EX_DYNP_DATA type CI_EKKODB

    FUNCTION ZMM_POSECTAB_GET.
    *"----------------------------------------------------------------------
    *"*"Local Interface:

    *" EXPORTING
    *" REFERENCE(EX_DYNP_DATA) TYPE CI_EKKODB
    *"----------------------------------------------------------------------

    EX_DYNP_DATA = CI_EKKODB.

    ENDFUNCTION.

    vi.IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_MODEL

    DATA: L_HEADER TYPE REF TO IF_PURCHASE_ORDER_MM,
    L_MEPOHEADER TYPE MEPOHEADER,
    L_CUSTOMER TYPE CI_EKKODB,
    L_PO_HEADER_HANDLE TYPE REF TO CL_PO_HEADER_HANDLE_MM.

    CASE IM_NAME.
    WHEN SUBSCREEN1.

    * is it an item? im_model can be header or item.
    MMPUR_DYNAMIC_CAST L_HEADER IM_MODEL.
    CHECK NOT L_HEADER IS INITIAL.
    L_MEPOHEADER = L_HEADER->GET_DATA( ).

    * standard fields changed?
    IF DYNP_DATA_PBO-ZZSEC_DEPOSIT NE DYNP_DATA_PAI-ZZSEC_DEPOSIT
    OR DYNP_DATA_PBO-ZZMMDATE NE DYNP_DATA_PAI-ZZMMDATE
    OR DYNP_DATA_PBO-ZZDEP_AMT NE DYNP_DATA_PAI-ZZDEP_AMT
    OR DYNP_DATA_PBO-ZZENGR_INCHRG_NAME NE DYNP_DATA_PAI-ZZENGR_INCHRG_NAME
    OR DYNP_DATA_PBO-ZZENGR_INCHRG NE DYNP_DATA_PAI-ZZENGR_INCHRG
    OR DYNP_DATA_PBO-ZZDEPARTMENT NE DYNP_DATA_PAI-ZZDEPARTMENT.
    * update standard fields
    L_MEPOHEADER-ZZSEC_DEPOSIT = DYNP_DATA_PAI-ZZSEC_DEPOSIT.
    L_MEPOHEADER-ZZMMDATE = DYNP_DATA_PAI-ZZMMDATE.
    L_MEPOHEADER-ZZDEP_AMT = DYNP_DATA_PAI-ZZDEP_AMT.
    L_MEPOHEADER-ZZENGR_INCHRG_NAME = DYNP_DATA_PAI-ZZENGR_INCHRG_NAME.
    L_MEPOHEADER-ZZENGR_INCHRG = DYNP_DATA_PAI-ZZENGR_INCHRG.
    L_MEPOHEADER-ZZDEPARTMENT = DYNP_DATA_PAI-ZZDEPARTMENT.

    CALL METHOD L_HEADER->SET_DATA
    EXPORTING
    IM_DATA = L_MEPOHEADER.

    ENDIF.

    WHEN OTHERS.
    ENDCASE.

    Please tell me the reason for the dump. I havnt touched THE PAI & PBO of the screen. Just uncommented them both like this.

    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0101.
    *
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0101.

    Regards,

    Arijit

    Add comment
    10|10000 characters needed characters exceeded

    • A form "SET_SUBSCREEN_AND_PROG" is missing in your function group ZMM_ME21N. Did you use function group MEPOBADIEX as a template for your function group, if no look at its TOP include and paste into your FG. Also insure that the whole FG is activated.

      Regards,
      Raymond

  • Nov 26, 2016 at 05:29 AM

    Hi Raymond,

    Thanks a lot for the quick reply. Its working fine now. The tab is showing fine now. Now problem is when data is fed by user when saving po from me21n no data on these 6 fields are getting stored in ekko table (from me21n fields act as input, from me22n fields act as display + input, from me23n fields act only as display ). Also i need to validate/restict the tab fields input to certain document types. Can you please tell me in which methods i should refer in badi ME_PROCESS_PO_CUST to write my code.

    Thanks a lot in advance.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 26, 2016 at 11:49 AM

    Hi Raymond,

    I have one more doubt. Do i need to create all the FM present in MEPOBADIEX in my FG to transfer data from me21n to ekko table.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 29, 2016 at 04:56 PM

    Solved the issue. needed to code in ME_PROCESS_PO_CUST.

    Add comment
    10|10000 characters needed characters exceeded