Application Development and Automation 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: 
Read only

menu painter

Former Member
0 Likes
3,937

dear all

how to create menu?

plz help me out.

Edited by: VARUN RAJULE on Mar 1, 2008 12:30 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,441

Hi,

SET PF-STATUS 'STATUS'.

STATUS should be in caps.

define it into the module pool program and double click and Press SAVE, select YES. and It will take you into the Menu painter screen, where you can define your own gui related fields. Actually SE41 is the Tcode to change or display the Menus. but it should not allow you to create.

Reward points is usefull.

Regards,

Sekhar

5 REPLIES 5
Read only

Former Member
0 Likes
2,441

set pf-status 'TEST'.

double click it .

write short desc.

then write....

for menu painter goto tcode se51.

regards,

venkat.

Edited by: venkat appikonda on Mar 1, 2008 12:40 PM

Read only

Former Member
0 Likes
2,441

Hi Varun,

You can create Menu painter by 2 ways.

1. Go to tcode - SE41 give the program name and below that give the status name .

eX: ZPROGRAM

Status name : TEST

Then click create button where u ll find a screen where u can see MENU BAR, APPLICATION TOOL BAR, FUNCTION KEYS.

if you click on menu bar here u can give wht are the functions u want to assagin in menu bar in MENU BAR.

llly if u cllick on the application tool bar where u can give your own function key and u can give the icon name for ur function key.

EX; for enter u give function key as ENTER

double click on that it asks for ICON name search icon name and assgin u can see the icon.

and if u click on function keys u ll see standard tool bar where all the icons are already displayed just u need to give the function key for tha icon.

save and activate.

2. if you are using module pool progarm. in module PBO.

SET PF-STATUS 'TEST'.

In place of test u can give any name.

double click on that u ll go directly to menu painter screen.

suppose if u given ENTER as function key. u can use this key in ur program as follows

Case Sy-ucomm.

When 'ENTER'.

<source code>

endcase.

<b>hope this will help you</b>

Reward if useful.

regards,

sunil kairam.

Edited by: sunil kairam on Mar 1, 2008 6:20 PM

Read only

Former Member
0 Likes
2,442

Hi,

SET PF-STATUS 'STATUS'.

STATUS should be in caps.

define it into the module pool program and double click and Press SAVE, select YES. and It will take you into the Menu painter screen, where you can define your own gui related fields. Actually SE41 is the Tcode to change or display the Menus. but it should not allow you to create.

Reward points is usefull.

Regards,

Sekhar

Read only

Former Member
0 Likes
2,441

http://help.sap.com/saphelp_nw70/helpdata/en/a3/5fc53796421e38e10000009b38f842/content.htm

Go to SE41-> Program Name -> Give PF Status(ZTEST) name

I think your requirement it to create Application Tool bar.

Expand the node Application Tool Bar -> give the desired name for *Function Code(ZSTATUS)* and double click on it. It will ask for Functional Type- leave it blank. Give some text in the Functional texts and Info Text. If you want to a icon to be displayed then select the icon from the dropdown. In the program you need to write code for this Function Code .

Ex. SET-PF Status 'ZTEST'.

case sy-ucomm.

when 'ZSTATUS'.

call transaction 'VA01'.

endcase.

<h2>STATUS ICON</h2>

Status icon is used in screens to indicate visually about the status of the

program.Before the status icon can be used ,it should be placed on the

screen,it is a type of screen element.

To use the status icon we have to write some abap code and also to

change icons whenever required in the program. First step is to create

a variable of type ICONS-TEXT.

e.g. DATA: status TYPE ICONS-TEXT.

The name of the variable in the abap program should be same as that

of in the screen.

Declaring it merely wont show anything , we have to use the function module ICON_CREATE to fill it with the required icon, generally PBO of the screen is used for this purpose. There are 3 parameters to be passed.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

NAME = 'icon name'

TEXT = 'text to be displayed'

INFO = 'tooltip text'

Here name can be anything like ICON_RED_LIGHT,ICON_GREEN_LIGHT etc. Infact any icon can be shown that exists but we should adhere to SAP

recommended style guidelines

<h2>CONTEXT MENU</h2>

Context menu can be used in relation with the various screen elements

like I/O fields, subscreen,group box,table control but not with push buttons,radio,check buttons.

It can be used to show related options when the user right clicks on the screen elements. It is a type of status. SAP automatically creates a default context menu for dialog statuses consisting of all the function codes available.

We can create a context menu statically using the menu painter(SE41)

or dynamically by using the methods of the global class CL_CTMENU.

All context menus are objects of this global class.

There are number of methods which can be used to create and modify context menu dynamically . These are:

LOAD_GUI_STATUS

This method is used to load a static context menu already defined using

menu painter.The exporting parameters are PROGRAM ,STATUS and MENU. Where MENU indicates the menu to which the context menu will be attached .

ADD_FUNCTION

This method adds a function code to the menu ,The exporting parameters are FCODE and TEXT. These are used to specify the function code and the corresponding text in the men.

ADD_MENU

This method adds a context menu to another one.

ADD_SEPARATOR

This method adds a separator line.

ADD_SUBMENU

This method adds a menu to another one as a sub menu the exporting parameters are MENU and the TEXT that will be displayed.

HIDE_FUNCTIONS

SHOW_FUNCTIONS

DISABLE_FUNCTIONS

ENABLE_FUNCTIONS

These functions are used to modify the context menu by hiding,enabling etc them.

SET_DEFAULT_FUNCTION

This method will mark a particular menu item as the default one ,the corresponding function code is passed as an exporting parameter.

The context menu should be linked to the screen element in the screen painte(SE51) by specifying an ID which is known as CONTEXT in the context menu field.

We can specify the same context for different screen elements or different context for different elements.

For each context specified in the screen painter a special call back

subroutine is used in the abap program. the syntax of this special routine

is:

FORM ON_CTLMENU_context USING menu TYPE REF TO CL_CTMENU

...

ENDFORM

This subroutine can be used to modify or load or create a context menu at runtime when the user right clicks the screen element.

In the above subroutine the context is the context assigned to the screen element and menu is the menu object that was passed to this call back routine which is initially blank, we have to use methods of the class as stated above to create a working menu or load an existing static context menu previously build in the menu painter.

e.g. To load an existing context menu

FORM on_ctmenu_text USING menu TYPE REF TO cl_ctmenu.

CALL METHOD menu->load_gui_status

EXPORTING program = prog

status = 'CON_MENU'

menu = menu .

CALL METHOD menu->set_default_function

EXPORTING fcode = 'list'.

ENDFORM.

e.g. CREATING A NEW CONTEXT MENU DYNAMICALLY.

FORM on_ctmenu_text USING menu TYPE REF TO cl_ctmenu.

DATA new_menu TYPE REF TO cl_ctmenu.

CREATE OBJECT new_menu.

CALL METHOD new_menu->add_function

EXPORTING fcode = 'list'

text = text-001.

CALL METHOD new_menu->add_function

EXPORTING fcode = 'add'

text = text-002. CALL METHOD new_menu->add_function

EXPORTING fcode = 'delete'

text = text-003.

CALL METHOD new_menu->add_submenu

EXPORTING menu = new_menu

text = text-005.

ENDFORM.

The ABAP program should check for the OK_CODE field to find out whichmenu item was selected by the user. Selecting a function code will trigger a PAI while right clicking will not trigger the PAI.

SCREEN KEYWORDS

Screen language is used to create Screen Flow Logic, It is similar to ABAP but with limited functionality .Only certain keywords can be used

and these are:

PROCESS

MODULE

FIELD

ON

LOOP

ENDLOOP

CHAIN

ENDCHAIN

CALL

SCREEN EVENTS

Screen Flow Logic serves as the cotainer for screen processing blocks.There are four events processing block supported out of which

FIRST two are automatically inserted when we create a new screen. The 4 events are:

PROCESS BEFORE OUTPUT

This event is fired just before the screen is displayed .

e.g. MODULE LOAD_STATUS_1000 .

PROCESSS AFTER INPUT

This event is fired when user selects a function code or presses enter key

e.g. MODULE USER_COMMAND_1000 .

PROCESS ON HELP-REQUEST

This event is fired when the user presses F1 key.

PROCESS ON VALUE-REQUEST

This event is fired when the user presses F4 key.

These events are triggered by the runtime environment.The ABAP

program serves as the container for the processing blocks associated with

these events.Each processing block in ABAP starts with the keyword MODULE .

PBO modules have OUTPUT keyword attached to them while for remaining 3 events there associated modules have INPUT keyword attached to them in the ABAP program.

e.g. MODULE LOAD_STATUS_1000 OUTPUT.

MODULE USER_COMMAND_1000 INPUT.

MODULE name AT EXIT-COMMAND

The specified module is called when the user selects a function code of type E like BACK,EXIT and CANCEL in PAI all other dialog modules are bypassed.

GUI STATUS & TITLE

SET PF-STATUS status OF PROGRAM prog EXCLUDING f statement is used

to set the status of a ABAP program.The status provides user interface.It consists

of standard toolbar,application toolbar and menu.When ever the user selects a function the function code is placed in the OK_CODE field and structure SYST-UCOMM. The status is set in PBO event.

The title is set using

SET TITLEBAR title OF PROGRAM program WITH p1 p2

where the values for p1 p2 can be specified at run time. Menu Painter (SE41) is used to create GUI status and titlebar.

SCREEN FIelds & OK_CODE

Screen fields are fields in the working memory of the screen ,these are attached

to the screen elements.There contents are passed to similarly named fields in abap program during PAI and viceversa in PBO.

OK_CODEeld is a 20 char field which is found in every screen , it stores the function code selected by the user.It's contents are same as that of SY_UCOMM.It is a screen element.

Please reward points if useful.

Cheers,

Chandru

Read only

Former Member
0 Likes
2,441

thanks