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: 

How to set Default screen when open me21n

Former Member

Hi Friends,

I created one Custom Tab under Header level in me21n using screen exit MM06E005.

It's working fine.And My requirement is, whenever open ME21N t-code it display my custom tab first

So, How to do this?

1 ACCEPTED SOLUTION

arseni_gallardo
Active Participant

Hi,

The ME2xN transactions reads the user settings from table ESDUS using function module ES_READ_USER_SETTINGS, and save them at the end of the transaction using function module ES_APPEND_USER_SETTINGS.

You need to overwrite the displayed header tab number using ES_APPEND_USER_SETTINGS just at the beginning of the transaction. I think that a godd point to do this is in the subroutine INIT_TRANSACTION of report RM_MEPO_GUI. You can do this using the enhacement framework. I have tested it and it works for me. This is the code you should insert:


FORM init_transaction CHANGING ch_document        TYPE mepo_document
                               ch_exit            TYPE mmpur_bool
                               ch_requisitions    TYPE mereq_t_eban_mem
                               ch_requisition_acc TYPE mereq_t_ebkn.
"""""""""""""""""""""""""""""$"$\SE:(1 ) Forma INIT_TRANSACTION, Inicio                                                                                D
*$*$-Start: (1 )-----------------------------$*$*
ENHANCEMENT 1  ZTEST.    "active version
*Expand header------
    CALL FUNCTION 'ES_APPEND_USER_SETTINGS'
      EXPORTING
        iaction  = 'PurchaseOrder'
        ielement = 'DYN_4000-BUTTON     TOGGLE_STATE'
        iactive  = '2'.

*Move to 2nd tab ----
    CALL FUNCTION 'ES_APPEND_USER_SETTINGS'
      EXPORTING
        iaction  = 'PurchaseOrder'
        ielement = 'HEADER-TABSTRIP     SUBVIEW_INDEX'
        iactive  = '2'.

ENDENHANCEMENT.
*$*$-End:   (1 )-----------------------------$*$*

  DATA: l_ebeln  TYPE ekko-ebeln,
        l_ebelp  TYPE ekpo-ebelp,

6 REPLIES 6

Former Member
0 Kudos

Create a screen variant for ME21N in SHD0 transaction

0 Kudos

Hi Vishnu,

Thanks for Reply.

I am using screen variant,this will work on Fields level only.

I don't know how to use Screen variant for setting default screen.

If you know,Share with me.Otherwise any other exit/badi is there for setting default screen.

arseni_gallardo
Active Participant

Hi,

The ME2xN transactions reads the user settings from table ESDUS using function module ES_READ_USER_SETTINGS, and save them at the end of the transaction using function module ES_APPEND_USER_SETTINGS.

You need to overwrite the displayed header tab number using ES_APPEND_USER_SETTINGS just at the beginning of the transaction. I think that a godd point to do this is in the subroutine INIT_TRANSACTION of report RM_MEPO_GUI. You can do this using the enhacement framework. I have tested it and it works for me. This is the code you should insert:


FORM init_transaction CHANGING ch_document        TYPE mepo_document
                               ch_exit            TYPE mmpur_bool
                               ch_requisitions    TYPE mereq_t_eban_mem
                               ch_requisition_acc TYPE mereq_t_ebkn.
"""""""""""""""""""""""""""""$"$\SE:(1 ) Forma INIT_TRANSACTION, Inicio                                                                                D
*$*$-Start: (1 )-----------------------------$*$*
ENHANCEMENT 1  ZTEST.    "active version
*Expand header------
    CALL FUNCTION 'ES_APPEND_USER_SETTINGS'
      EXPORTING
        iaction  = 'PurchaseOrder'
        ielement = 'DYN_4000-BUTTON     TOGGLE_STATE'
        iactive  = '2'.

*Move to 2nd tab ----
    CALL FUNCTION 'ES_APPEND_USER_SETTINGS'
      EXPORTING
        iaction  = 'PurchaseOrder'
        ielement = 'HEADER-TABSTRIP     SUBVIEW_INDEX'
        iactive  = '2'.

ENDENHANCEMENT.
*$*$-End:   (1 )-----------------------------$*$*

  DATA: l_ebeln  TYPE ekko-ebeln,
        l_ebelp  TYPE ekpo-ebelp,

0 Kudos

Hi Arseni Gallardo ,

The above code didn't work.

My requirement is when open me21n t-code, always it will show my custom tab.

It doesn't show last opening that tab.

0 Kudos

What does "didn't work" mean? Didn't it select the 2nd tab? If it did you only have add an IF just to make sure that it only works for ME21n and replace the '2' in the second call to ES_APPEND_USER_SETTINGS by the proper tab index (which I can not know because I have no customer tab in my system).


ENHANCEMENT 1  ZTEST.    "active version
 IF sy-tcode EQ 'ME21N'.
*Expand header------ 
*    CALL FUNCTION 'ES_APPEND_USER_SETTINGS'
*      EXPORTING
*        iaction  = 'PurchaseOrder'
*        ielement = 'DYN_4000-BUTTON     TOGGLE_STATE'
*        iactive  = '2'.
 
*Move to 2nd tab ----
    CALL FUNCTION 'ES_APPEND_USER_SETTINGS'
      EXPORTING
        iaction  = 'PurchaseOrder'
        ielement = 'HEADER-TABSTRIP     SUBVIEW_INDEX'
        iactive  = '2' "<<<<< Replace this by the tab index of your custom dynpro.
 ENDIF.
ENDENHANCEMENT.

By the way, I hve tried it in a ECC 6.0

Edited by: Arseni Gallardo on Nov 30, 2011 12:48 PM

0 Kudos

Hi Arseni Gallardo,

Thanks .

This is exactly working very good.

my requirement is resolved.