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: 

Problem with customised subscreen in ME21N

Former Member
0 Kudos

I am using BadI ME_GUI_PO_CUST & ME_PROCESS_PO_CUST to add a customized subscreen in the header. But the subscreen is only visible with ME23N & ME22N not with ME21N . I am new to BadI, so help is needed.

I have used the following code:

In BadI ME_GUI_PO_CUST with interface IF_EX_ME_GUI_PO_CUST~SUBSCRIBE the code i ve written .. the following code ..

.

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

* 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 = '0002'.
* the program where the dynpro can be found
* "Created in a module pool program in SE80 to hold the subscreen in 
*the tcode me21n, me22n, me23n*
ls_subscriber-program = 'ZME_GUI_PO_CUST_SCREEN'.
* each subscreen needs his own DDIC-Structure
ls_subscriber-struct_name = 'CI_EKKODB'.
* a label can be defined
ls_subscriber-label = text-001.
* the position within the tabstrib can be defined
ls_subscriber-position = 13.
* the height of the screen can be defined here. Currently we support 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.

.

********************************************************************

In IF_EX_ME_GUI_PO_CUST~MAP_DYNPRO_FIELDS i ve changed the follwoing .......


type-pools : MMMFD.
FIELD-SYMBOLS: <mapping> LIKE LINE OF ch_mapping.

LOOP AT ch_mapping ASSIGNING <mapping>.

CASE <mapping>-fieldname.
WHEN 'ZZPAYMENT'. <mapping>-metafield = mmmfd_cust_03.
ENDCASE.

ENDLOOP.

In the badi ME_PROCESS_PO_CUST, their is a method called FIELDSELECTION_HEADER


method IF_EX_ME_PROCESS_PO_CUST~FIELDSELECTION_HEADER .
DATA: l_persistent 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_item->is_persistent( ).

IF l_persistent EQ mmpur_yes.
READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_03.
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.

I have figured out the issue but do not the idea to fix the issue. I have put a break-point in the badi ME_PROCESS_PO_CUST, having the method called FIELDSELECTION_HEADER & run the tcode ME21N. In the line l_persistent = im_item->is_persisten & IF l_persistent EQ mmpur_yes and found out that the value of mmpur_yes equal to 'X', l_persistent is blank.

Suggestion is widely accepted.

Thanks & regards

Feluda

1 REPLY 1

Former Member
0 Kudos

Try like this.


method IF_EX_ME_PROCESS_PO_CUST~FIELDSELECTION_HEADER .
DATA: l_persistent 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_item->is_persistent( ).
 
IF l_persistent EQ mmpur_yes.
READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_03.
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.
ELSE.
READ TABLE ch_fieldselection ASSIGNING <fs> WITH TABLE KEY metafield = mmmfd_cust_03.
IF sy-subrc IS INITIAL.
 <fs>-fieldstatus = '*'. " Display <-- this one was as per the sample code given.
ENDIF.
ENDIF.

Let me know if you still have the problem.

Thanks,

Jyothi