2020 Jul 24 1:22 PM
Hello friends,
I have a requirement for the creation of new tab with customer fields in the PO header for me21n transaction using badi.
I have created a badi implementation for ME_GUI_PO_CUST and screen using module pool. I am able to display that custom tab with customer fields in me23n but it is not coming in the ME21N and ME22N transaction.
How to display that tab with fields in ME21N transaction?
Regards,
Rushikesh
Thanks in advanced..!
2020 Jul 24 1:36 PM
Hi,
Maybe have a look at following tutorial and see if you implemented all the required methods:
http://saptechnical.com/Tutorials/ExitsBADIs/ME21N/Index.htm
If it's still not working maybe try debugging the SUBSCRIBE method when using ME21N / ME22N.
Best regards,
Geert-Jan Klaps
2020 Jul 24 5:20 PM
Hi Geert
Thanks for giving your valuable time... i have already used that but still it wont be display when i click Create/Change Mode ..Only it shows in Display Mode...Below is my code plz tell me what i missed in this..
method IF_EX_ME_GUI_PO_CUST~SUBSCRIBE.
DATA: ls_subscriber LIKE LINE OF re_subscribers.
* we want to add a customer subscreen on the Header tab
CHECK im_application = 'PO'.
CHECK im_element = 'HEADER'.
* each line in re_subscribers generates a subscreen. We add one subscreen in this example
CLEAR re_subscribers[].
* the name is a unique identifier for the subscreen and defined in this class definition
ls_subscriber-name = subscreen1.
* the dynpro number to use
ls_subscriber-dynpro = '0100'.
* the program where the dynpro can be found
ls_subscriber-program = 'ZME_GUI_PO_CUST_SCREEN2'.
* each subscreen needs his own DDIC-Structure
ls_subscriber-struct_name = 'CI_EKKODB'.
* a label can be defined
ls_subscriber-label = 'Cust Tab'.
* the position within the tabstrib can be defined
* ls_subscriber-position = 13.
* the height of the screen can be defined here. Currently we suport two screen sizes:
* value <= 7 a sevel line subscreen
* value > 7 a 16 line subscreen
* ls_subscriber-height = 7.
APPEND ls_subscriber TO re_subscribers.
endmethod.
*********************************************************************************
method 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 'ZDATE'. <mapping>-metafield = mmmfd_cust_03.
ENDCASE.
ENDLOOP.
endmethod.
************************************************************************************************ method IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_MODEL.
DATA: l_header TYPE REF TO if_purchase_order_mm,
ls_mepoheader TYPE mepoheader,
ls_customer TYPE CI_EKKODB.
*--------------------------------------------------------------------*
* system asks to transport data from the business logic into the view
*--------------------------------------------------------------------*
CASE im_name.
WHEN subscreen1.
* is it an Header? im_model can be header or item.
mmpur_dynamic_cast l_header im_model.
CHECK NOT l_header IS INITIAL.
* transport standard fields
ls_mepoheader = l_header->get_data( ).
* store info for later use
MOVE-CORRESPONDING ls_mepoheader TO dynp_data_pbo.
WHEN OTHERS.
* ...
ENDCASE.
endmethod.
************************************************************************************************ method IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_DYNP.
CASE im_name.
WHEN subscreen1.
CALL FUNCTION 'Y_MM_MEPOBADI_PUSH'
EXPORTING
im_dynp_data = dynp_data_pbo.
WHEN OTHERS.
ENDCASE.
endmethod.
************************************************************************************************ method IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_DYNP.
CASE im_name.
WHEN subscreen1.
CALL FUNCTION 'Y_MM_MEPOBADI_POP'
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.
endmethod.
************************************************************************************************
method IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_MODEL.
DATA: l_header TYPE REF TO if_purchase_order_mm,
ls_mepoheader TYPE mepoheader,
ls_customer TYPE CI_EKKODB,
l_po_header_handle TYPE REF TO cl_po_header_handle_mm.
*--------------------------------------------------------------------*
* data have to be transported to business logic
*--------------------------------------------------------------------*
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.
ls_mepoheader = l_header->get_data( ).
* standard fields changed?
IF dynp_data_pbo-zdate NE dynp_data_pai-zdate.
* OR dynp_data_pbo-zzproject NE dynp_data_pai-zzproject.
* update standard fields
ls_mepoheader-zdate = dynp_data_pai-zdate.
* ls_mepoheader-zzproject = dynp_data_pai-zzproject.
CALL METHOD l_header->set_data
EXPORTING
im_data = ls_mepoheader.
ENDIF.
WHEN OTHERS.
ENDCASE.
endmethod.
************************************************************************************************
method IF_EX_ME_PROCESS_PO_CUST~FIELDSELECTION_HEADER.
DATA: l_persistent TYPE mmpur_bool,
l_changeable TYPE mmpur_bool.
FIELD-SYMBOLS: <fs> LIKE LINE OF ch_fieldselection.
* if the item is already on the database, we disallow to change field badi_bsgru
l_persistent = im_header->is_persistent( ).
l_changeable = im_header->is_changeable( ).
* IF l_persistent EQ mmpur_yes.
READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_01.
IF sy-subrc IS INITIAL.
IF l_changeable = 'X'.
<fs>-fieldstatus = '.'. " READY FOR INPUT
ELSE.
<fs>-fieldstatus = '*'. " view
endif.
else.
<fs>-fieldstatus = '-'. "SUPRESS IT
ENDIF.
endmethod.
When i tried to execute ME21N it shows an error which says "Field Symbols has not been assigned yet".
Regards,
Rushikesh
2020 Jul 24 4:41 PM
Hi,
Try with BADI ME_PROCESS_PO_CUST this will solve the requirment.
2020 Jul 24 5:23 PM
Hi Abinath,
Thanks for comments...I have used this but again it not affect naything on ME21N
See my code and plz tell me wht i have to do..
method IF_EX_ME_PROCESS_PO_CUST~FIELDSELECTION_HEADER.
DATA: l_persistent TYPE mmpur_bool,
l_changeable TYPE mmpur_bool.
FIELD-SYMBOLS: <fs> LIKE LINE OF ch_fieldselection.
* if the item is already on the database, we disallow to change field badi_bsgru
l_persistent = im_header->is_persistent( ).
l_changeable = im_header->is_changeable( ).
* IF l_persistent EQ mmpur_yes.
READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_01.
IF sy-subrc IS INITIAL.
IF l_changeable = 'X'.
<fs>-fieldstatus = '.'. " READY FOR INPUT
ELSE.
<fs>-fieldstatus = '*'. " view
endif.
else.
<fs>-fieldstatus = '-'. "SUPRESS IT
ENDIF.
endmethod.
Regards,
Rushikesh
2021 Jan 25 10:36 AM
Hi,
as we are facing the same problem right now, I'd like to know how you solved it?
Thanks,
Marco.
2024 Nov 27 2:14 PM
Good morning!
Were you able to resolve this problem?
I created the tab at item level but the tab only appears if I am in view mode.
2024 Nov 27 3:27 PM