An interactive report starts with basic list where condensed information is stored on basic list and detailed information is stored on secondary list. To implement this kind of reporting, you need to provide the user with things like menu, icons, function keys. You also need to write code, which must react, to the user’s action.
For this, you need to create the interface, which interacts with the user.
The user interface is independent of the program or list or screen. However both interface and list can be associated by means of GUI status. A GUI status groups together the interface components.
• Menu bar
• Application tool bar
• Function keys
• Title bar
The last element of the user interface is independent of the GUI status i.e., titlebar.
To assign status to your list the statement SET PR-STATUS.
Some facts about GUI status are:
• A program can have multiple GUI status and titles for different lists.
• Multiple lists can be assigned to same GUI status.
• Normally both GUI status and title go together.
Function code
An important concept, when working with user interface. Function is a four character alphanumeric code, which the system stores in the system variable called SY-UCOMM for each function key, push button, or menu option. Whenever any push button is clicked or menu option is selected, the code attached to that, is stored in SY-UCOMM and can be handled in your program.
Menu painter
Menu painter is the ABAP/4 workbench tool for creating and maintaining user interface.
Starting Menu Painter
ABAP/4 development workbench menu painter
Or
Transaction SE41 in the command field.
Or
Through program SET PF-STATUS
If you double click on the variable, the system takes you to the menu painter screen.
Creating Menu bar
Steps involved are as follows:
• Enter the name in the first field. It is just a name given to the menu and is not displayed anywhere in the output.
• Enter the name of each menu item. You can create up to six menus (total eight menu items are available, out of which system and help are mandatory).
• Enter name of the menu items and function code. You can have fifteen menu items under one menu.
If you leave function blank, the system assumes that this particular menu item will have submenu. You can create the sub menu items under this menu item. User can go up to three levels.
Creating Application Tool Bar
Assign Function Keys
In Application tool bar you can include icon assigned for function keys.
Procedure:
• Select function key.
• From the menu, more utilities - change text type. The system displays a dialog box, click on icon and presses ENTER.
• Select icon from list of icons displayed
Creating GUI title
From your program, you can set title for your list and SET TITLEBAR is used.
Syntax:
SET TITLEBAR .
Here var can be any three-character name. When developer double clicks on the var, system displays the dialog box in which you enter the title number, the description, and the actual text for title.
Similar to dictionary objects, the GUI status must be generated to be accessible by program.
AT USER-COMMAND
When the user selects the menu item or presses any function key, the event that is triggered is AT USER-COMMAND, and can be handled in the program by writing code for the same. The system variable SY-UCOMM stores the function code for the clicked menu item or for the function key and the same can be checked in the program. Sample code would look like
AT USER-COMMAND.
Case sy-ucomm.
When ‘DISP’.
Select * from sflight.
Write sflight-carrid, sflight-connid.
Endselect.
When ‘EXIT’.
LEAVE.
If GUI status, suppose you have set menu bar for two items and the function code is ‘DISP’ and ‘EXIT’ respectively. If the user clicks the menu item ‘DISPLAY’, then function code ‘DISP’ is stored in the sy-ucomm and whatever is written under the when ‘DISP’, gets executed. This is applicable for EXIT as well.
Sy-lsind for the screen increases when the user clicks the menu item.
Usually you have combination of all the three navigations in your user interface, i.e., you have to create menu bar, assign function code for the function keys and write code to handle all this in addition to handling double clicking.
Things to remember while using all the combinations:
• Sy-lsind increases even if you select menu-item.
• When the user double clicks on particular line, value of sy-ucomm is ‘PICK.
• If you set sy-lsind = 2 for your 4th secondary list, when control is transferred to the 2nd secondary list, all the other lists after 2nd are lost or memory allocated to them is lost.
• Sy-lisel also gives you the value of clicked line but in this case you cannot differentiate between field. To retrieve the exact field, you have to know the field length of each field.
• If you use statement SY-LSIND = 1.
The system reacts to a manipulation of SY-LSIND only at the end of an event, directly before displaying the secondary list. So, if within the processing block, you use statements whose INDEX options access the list with the index SY-LSIND, make sure that you manipulate the SY-LSIND field only after processing these statements. The best way is to have it always at the `as the last statement’ of the processing block.
No comments:
Post a Comment