Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Added custom screen in PO using BADI ME_GUI_PO_CUST and ME_PROCESS_PO_CUST

Former Member
0 Kudos

Hi All,

I have added custom screen with two z fields at item level using BADI ME_GUI_PO_CUST and ME_PROCESS_PO_CUST i can see my screen in tcodes ME21N , ME22N , ME23N but I am not able to save data.

and also screen is coming in change mode even in ME23N .

thanks.

8 REPLIES 8

martin_voros
Active Contributor
0 Kudos

Hi,

have you checked code samples in SE18 (Goto -> Sample Code -> Display). Both BADIs have code samples. You just need to pass data from and to your new screen in ME_GUI_PO_CUST and then later process your new data in ME_PROCESS_PO_CUST. Both BADIs are well documented as well. The purpose of all methods is well described there.

Good luck

0 Kudos

Hi,

Thanks for ur answer.

I have seen the sample code given in all the methods, instead i copied that only.

but still i am not able to save data.

regards,

Prameela

0 Kudos

Hi,

definitely you need to provide us more information. What exactly does not work? Do you have problems to get data from screen to internal structure or you have problems with saving data to DB?

Cheers

former_member536879
Active Contributor
0 Kudos

Hi Regula,

Can u tell me wht all the things u done in tht.

My last requirement was this only and done tht . So i think i can help u .

First i want to know tht do u have Customer Tab in the header level and in the Item Level.?

When u go for the Item Level or the Headerlevel the First thing will gets trigger is tht the Execute method in the ME_GUI_PO_CUST.

After tht then the Transport to Model & transport from Dynpro and viceversa.

With regds,

Sumodh.P

Edited by: Sumodh P on May 3, 2009 7:49 PM

0 Kudos

Hi,

I have added two xfields at item level.

This is the code i have added in zimplementation ZME_GUI_PO_CUST .

IN Zimplementation ME_PROCESS_PO_CUST I have added code only in method FIELDSELECTION_ITEM . after doing this I can see only screens in ME21N, ME22N, ME23N but when enter data in zfields and trying to save it is giving me message no data has changed.

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 = '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

ls_subscriber-name = subscreen1.

  • the dynpro number to use

ls_subscriber-dynpro = '0001'.

  • the program where the dynpro can be found

ls_subscriber-program = 'SAPLYMEPOBADIEX'.

  • each subscreen needs his own DDIC-Structure

ls_subscriber-struct_name = 'MEPO_BADI_STRUCT'.

  • a label can be defined

ls_subscriber-label = text-001.

  • the position within the tabstrib can be defined

ls_subscriber-position = 4.

  • 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.

ENDIF.

method IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_MODEL.

DATA: l_item TYPE REF TO if_purchase_order_item_mm,

ls_mepoitem TYPE mepoitem,

ls_customer TYPE mepo_badi_exampl.

----


  • system asks to transport data from the business logic into the view

----


CASE im_name.

WHEN subscreen1.

  • is it an item? im_model can be header or item.

mmpur_dynamic_cast l_item im_model.

CHECK NOT l_item IS INITIAL.

  • transport standard fields

ls_mepoitem = l_item->get_data( ).

  • transport customer fields

CALL FUNCTION 'YMEPOBADIEX_GET_DATA'

EXPORTING

im_ebeln = ls_mepoitem-ebeln

im_ebelp = ls_mepoitem-ebelp

IMPORTING

ex_data = ls_customer.

  • store info for later use

MOVE-CORRESPONDING ls_mepoitem TO dynp_data_pbo.

MOVE ls_customer-badi_bsgru TO dynp_data_pbo-badi_bsgru.

MOVE ls_customer-badi_afnam TO dynp_data_pbo-badi_afnam.

WHEN OTHERS.

  • ...

ENDCASE.

endif.

method IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_DYNP.

CASE im_name.

WHEN subscreen1.

CALL FUNCTION 'YMEPOBADIEX_PUSH'

EXPORTING

im_dynp_data = dynp_data_pbo.

WHEN OTHERS.

ENDCASE.

ENDIF.

endmethod.

method IF_EX_ME_GUI_PO_CUST~TRANSPORT_FROM_DYNP.

CASE im_name.

WHEN subscreen1.

CALL FUNCTION 'YMEPOBADIEX_POP'

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.

ENDIF.

endmethod.

method IF_EX_ME_GUI_PO_CUST~TRANSPORT_TO_MODEL.

DATA: l_item TYPE REF TO if_purchase_order_item_mm,

ls_mepoitem TYPE mepoitem,

ls_customer TYPE mepo_badi_exampl.

----


  • 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_item im_model.

CHECK NOT l_item IS INITIAL.

ls_mepoitem = l_item->get_data( ).

  • standard fields changed?

  • IF dynp_data_pbo-matkl NE dynp_data_pai-matkl OR

  • dynp_data_pbo-plifz NE dynp_data_pai-plifz OR

  • dynp_data_pbo-webaz NE dynp_data_pai-webaz.

  • update standard fields

  • ls_mepoitem-matkl = dynp_data_pai-matkl.

  • ls_mepoitem-plifz = dynp_data_pai-plifz.

  • ls_mepoitem-webaz = dynp_data_pai-webaz.

CALL METHOD l_item->set_data( ls_mepoitem ).

  • ENDIF.

CALL FUNCTION 'YMEPOBADIEX_GET_DATA'

EXPORTING

im_ebeln = ls_mepoitem-ebeln

im_ebelp = ls_mepoitem-ebelp

IMPORTING

ex_data = ls_customer.

ls_customer-badi_bsgru = dynp_data_pai-badi_bsgru.

ls_customer-badi_afnam = dynp_data_pai-badi_afnam.

CALL FUNCTION 'YMEPOBADIEX_SET_DATA'

EXPORTING

im_data = ls_customer.

  • ENDIF.

WHEN OTHERS.

ENDCASE.

ENDIF.

method IF_EX_ME_PROCESS_PO_CUST~FIELDSELECTION_ITEM.

DATA: l_persistent TYPE mmpur_bool.

CONSTANTS:

FIELD-SYMBOLS: <fs> LIKE LINE OF ch_fieldselection.

l_persistent = im_item->is_persistent( ).

*IF l_persistent EQ mmpur_yes.

READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY

metafield = MMMFD_YYMAN_NUM."fd_cust_01.

IF sy-subrc IS INITIAL.

  • <fs>-fieldstatus = '*'. " Display <-- this one was as per the sample code given.

<fs>-fieldstatus = '+'. " Input <-- this i added to make the field mandatory.

ENDIF.

READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY

metafield = MMMFD_YYMAN_DES."fd_cust_01.

IF sy-subrc IS INITIAL.

  • <fs>-fieldstatus = '*'. " Display <-- this one was as per the sample code given.

<fs>-fieldstatus = '+'. " Input <-- this i added to make the field mandatory.

ENDIF.

*ENDIF.

ENDIF.

endmethod.

0 Kudos

This message was moderated.

Former Member
0 Kudos

I got Answer

0 Kudos

Hi Regula, how did you solved this?

Thanks.