Create additional header in purchase order creation For additional header on PO u need to add additional structure in below Include in EKKO table First need to Create a appending structure for adding fields in EKKO table As per need Confidential C Create a function group in SE80. Under function module in top include. FUNCTION-POOL zasidmm_poheader_enh. * INCLUDE LZMM_POHEADER_ENHD... * persistent data "MESSAGE-ID .. " Local class definition * dynpro output structure TABLES: zasidmm_sc_header. *DATA : vinno TYPE zasidmm_sc_header-vin. DATA:ok-code TYPE sy-ucomm. INCLUDE lmeviewsf01. Create a two-function module inside of a function group One for push screen data another one for pop up the data. Confidential C 1.Crete a function module ZASIDMM_POP_POHEADER_DATA with below parameter in export tab. Use below source code : FUNCTION ZASIDMM_POP_POHEADER_DATA . *"---------------------------------------------------------------------*"*"Local Interface: *" EXPORTING *" REFERENCE(EX_DYNP_DATA) TYPE ZASIDMM_SC_HEADER *"---------------------------------------------------------------------ex_dynp_data = zasidmm_sc_header. ENDFUNCTION. 2.Create another function module ZASIDMM_PUSH_POHEADER_DATA in import tab. Use below source code: FUNCTION ZASIDMM_PUSH_POHEADER_DATA. *"---------------------------------------------------------------------*"*"Local Interface: *" IMPORTING *" REFERENCE(IM_DYNP_DATA) TYPE ZASIDMM_SC_HEADER *"---------------------------------------------------------------------- zasidmm_sc_header = im_dynp_data. ENDFUNCTION. Confidential C Create a screen as ur need with required fields. In flow logic add the below code.. PROCESS BEFORE OUTPUT. MODULE EVENT_PBO. “standard code * MODULE STATUS_5000. * PROCESS AFTER INPUT. MODULE EVENT_PAI. ‘standard code * MODULE USER_COMMAND_5000. Once u finished the screen design need to Implement below BADIS ME_GUI_PO_CUST ME_PROCESS_PO_CUST Confidential C Go to se19 Create new implementation for ME_GUI_PO_CUST For ex. ZME_GUI_PO_CUST Then go to se18 give ME_GUI_PO_CUST and select implementation Type as change . Then select ZME_GUI_PO_CUST.. Select any interface and go to class definition In class builder attributes tab. Define below like this Add sub screen name as per your need, Dynp_data_pbo and dynp_data_pai mention structure name u created . Confidential C Inside of Badi implementation choose subscribe method and add below Code Under interface subscribe method add below code. 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 item detail tab CHECK im_application = 'PO'. CHECK im_element = 'HEADER'. * CHECK im_element = 'ITEM'. * 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 Confidential C * ls_subscriber-name = subscreen1. ls_subscriber-name = subscreen2. * the dynpro number to use ls_subscriber-dynpro = '5000'. * the program where the dynpro can be found ls_subscriber-program = 'SAPLZASIDMM_POHEADER_ENH'. * each subscreen needs his own DDIC-Structure ls_subscriber-struct_name = 'ZASIDMM_SC_HEADER'. * a label can be defined ls_subscriber-label = 'Warranty'. * the position within the tabstrib can be defined ls_subscriber-position = 12. * 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. * BREAK-POINT. APPEND ls_subscriber TO re_subscribers. endmethod. Add SAPL before the function group name to call as program in this method. Add below code in MAP_DYNPRO_FIELDS method. 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 'VIN'. <mapping>-metafield = mmmfd_cust_04. WHEN 'MODEL'. "<mapping>-metafield = mmmfd_cust_04. <mapping>-metafield = mmmfd_cust_05. WHEN 'PCODE'. <mapping>-metafield = mmmfd_cust_06. WHEN 'VARIANT'. <mapping>-metafield = mmmfd_cust_07. WHEN 'STYPE'. <mapping>-metafield = mmmfd_cust_08. WHEN 'REDATE'. <mapping>-metafield = mmmfd_cust_09. WHEN 'RFDATE'. <mapping>-metafield = mmmfd_cust_10. ENDCASE. ENDLOOP. Confidential C endmethod. Add below code in TRANSPORT_FROM_MODEL 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 subscreen2. * is it an Header? im_model can be header or item. mmpur_dynamic_cast l_header im_model. CHECK NOT l_header IS INITIAL. BREAK Z022532. * 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. Add below code in TRANSPORT_TO_DYNP method IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_DYNP. CASE im_name. WHEN subscreen2. * * * * CALL FUNCTION 'ZSET_POHEADER_SCRVAL' EXPORTING i_ekko = dynp_data_pbo. . CALL FUNCTION 'ZASIDMM_PUSH_POHEADER_DATA' EXPORTING im_dynp_data = dynp_data_pbo. . Confidential C WHEN OTHERS. ENDCASE. endmethod. Add below code in TRANSPORT_FROM_DYNP method IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_DYNP. CASE im_name. WHEN subscreen2. CALL FUNCTION 'ZASIDMM_POP_POHEADER_DATA' IMPORTING ex_dynp_data = dynp_data_pai. IF dynp_data_pai NE dynp_data_pbo. * something has changed therefor we have to notify the framework * to transport data to the model re_changed = mmpur_yes. ENDIF. WHEN OTHERS. ENDCASE. endmethod. Add below code in 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 subscreen2. * 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-vin NE dynp_data_pai-vin Confidential C OR OR OR OR OR OR dynp_data_pbo-MODEL NE dynp_data_pai-MODEL dynp_data_pbo-PCODE NE dynp_data_pai-PCODE dynp_data_pbo-VARIANT NE dynp_data_pai-VARIANT dynp_data_pbo-STYPE NE dynp_data_pai-STYPE dynp_data_pbo-REDATE NE dynp_data_pai-REDATE dynp_data_pbo-RFDATE NE dynp_data_pai-RFDATE. * update standard fields ls_mepoheader-vin = dynp_data_pai-vin. ls_mepoheader-MODEL = dynp_data_pai-MODEL. ls_mepoheader-PCODE = dynp_data_pai-PCODE. ls_mepoheader-VARIANT = dynp_data_pai-VARIANT. ls_mepoheader-STYPE = dynp_data_pai-STYPE. ls_mepoheader-REDATE = dynp_data_pai-REDATE. ls_mepoheader-RFDATE = dynp_data_pai-RFDATE. * ls_mepoheader-zzproject = dynp_data_pai-zzproject. CALL METHOD l_header->set_data EXPORTING im_data = ls_mepoheader. ENDIF. WHEN OTHERS. ENDCASE. once u finished this BADI need to go next BADI. Go to se19 Create new implementation for ME_PROCESS_PO_CUST For ex. ZME_PROCESS_PO_CUST Add below code in process_header method METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER. * ************************************************************** ******** * CUSTOMER NAME : NMI ************************************************************** ********** * DESCRIPTION : Warranty header in PO creation * CREATED BY : Umabalan Jayabalan (RNTBCI) * CREATED ON : 02/01/2019 ************************************************************** ********** *&-----------------------------------------------------------------------------------------------------* Confidential C * Modification Log *&-----------------------------------------------------------------------------------------------------* * Date Developer Transport # Description * 08/02/2019 Umabalan Jayabalan (RNTBCI) GKAK908965 Initial Version *&-----------------------------------------------------------------------------------------------------* *• *• * * DATA: PO_ITEMS TYPE PURCHASE_ORDER_ITEMS, PO_ITEM TYPE PURCHASE_ORDER_ITEM, PO_DATA TYPE MEPOHEADER, ITEM_DATA TYPE MEPOITEM, EBAN_REC TYPE EBAN. Get Purchase Order Header Data CALL METHOD IM_HEADER->GET_DATA RECEIVING RE_DATA = PO_DATA. Get Line Items on Purchase Order CALL METHOD IM_HEADER->GET_ITEMS RECEIVING RE_ITEMS = PO_ITEMS. po_data-vin = 'test'. po_data-keteg = 'IC'. CALL METHOD IM_HEADER->SET_DATA EXPORTING IM_DATA = PO_DATA. CALL METHOD IM_HEADER->SET_CHANGED. ENDMETHOD. Add below code in field selection header. We add condition here appearing only for ZSPO type orders. METHOD if_ex_me_process_po_cust~fieldselection_header. * ************************************************************** Confidential C ******** * CUSTOMER NAME : NMI ************************************************************** ********** * DESCRIPTION : Warranty header in PO creation * CREATED BY : Umabalan Jayabalan (RNTBCI) * CREATED ON : 02/01/2019 ************************************************************** ********** *&-----------------------------------------------------------------------------------------------------* * Modification Log *&-----------------------------------------------------------------------------------------------------* * Date Developer Transport # Description * 08/02/2019 Umabalan Jayabalan (RNTBCI) GKAK908965 Initial Version *&-----------------------------------------------------------------------------------------------------* DATA: l_persistent TYPE mmpur_bool. DATA: l_changable TYPE mmpur_bool. FIELD-SYMBOLS: <fs> LIKE LINE OF ch_fieldselection. DATA :po_data *• TYPE mepoheader. Get Purchase Order Header Data CALL METHOD im_header->get_data RECEIVING re_data = po_data. ** Shows only for ZSPO type PO only IF po_data-bsart = 'ZSPO'. * l_changable = im_header->is_changeable( ). i_header = im_header->get_data( ). IF l_changable EQ mmpur_yes. READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_01. Confidential C IF sy-subrc IS INITIAL. <fs>-fieldstatus = '*'. ENDIF. READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_05. IF sy-subrc EQ 0. * * <fs>-fieldstatus = '.'. else. <fs>-fieldstatus = '*'. ENDIF. ELSE. READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_05. IF sy-subrc EQ 0. <fs>-fieldstatus = '*'. ENDIF. ENDIF. ENDIF. ENDMETHOD. Confidential C Confidential C