![](/cvo_files/imgs_sap_abap/logos/logo_cvo_academy_it.png)
✒️ABAP Los status GUI y los títulos
ABAP Los status GUI y los títulos
![ABAP Los status GUI y los títulos ABAP Los status GUI y los títulos](https://www.cvosoft.com/cvo_files/imgs_sap_abap/og-images/446.jpg)
GUI Status
The GUI Status is an independent component of ABAP programs, providing users with a wide range of functionalities on the program screen. It comprises the Menu Bar for navigation, Standard Toolbar with essential buttons, Application Toolbar/Button Bar for transaction-specific actions, and Function Keys for keyboard shortcuts.
- Menu Bar: The basic tool for navigating through different screens of a system transaction. It includes transaction-specific functionalities and fixed options for all transactions, namely System and Help.
- Standard Toolbar: Of particular interest, as it contains essential buttons for common actions such as save, search, enter, print, etc. This toolbar is always present in any SAP screen, and certain icons may be enabled or disabled based on the transaction.
- Application Toolbar or Button Bar: The functionalities displayed here depend solely on the executed transaction, offering basic options for controlling the current application: create, modify, display, delete, copy, etc.
- Function Keys: Keyboard shortcuts to access various system functionalities.
Steps for Creating a GUI Status:
- Access the standard transaction SE80.
- Enter the program name and press enter.
- Once the program is created, Right-click on it and select Create / GUI Status.
- In the next window, enter the GUI Status name and a description. Leave the "Status type" as "Normal Screen" and click the continue button.
- On the right side of the screen, you'll find the components of the GUI Status.
- Expand the list in the "Application Toolbar", and in the first blank item, input the corresponding function code for the button. Press enter.
- A dialog box will appear, indicating no text assigned to that function; press the continue button to create a new one.
- In teh following dialog box, complete the details for the new button:
-
Function Code: Used to name the button.
-
Function Text: Corresponds to the text displayed to the right of the button icon.
-
Icon Name: The icon displayed within the button, chosen from a variety accessible by pressing F4.
-
Info Text: The help name of the button, visible when the mouse pointer is left still over the button for a few seconds.
- Press continue, and in the next dialog, assign a ShortCut to the button, having the same effect as clicking the button with the mouse pointer.
- With the created button, you'll see the first item in the Button Bar.
Now, insert the code in the report to utilize the new Status GUI. First, declare the usage of the status using the SET PF-STATUS statement within the START-OF-SELECTION event. Then, to capture which button the user clicked, use the AT USER-COMMAND event along with the system variable SY-UCOMM, which contains the function code corresponding to the selected button.
*---------------------------------------------------------------------*
START-OF-SELECTION.
*---------------------------------------------------------------------*
SET PF-STATUS '0100'.
Finally, save the changes, activate the program, and also the Status GUI. The Status GUI is an independent ABAP object that requires activation as well.
You can use the standard transaction SE41 to copy Status GUI from one ABAP program to another.
GUI Titles
GUI Titles in ABAP programs provide a structured and user-friendly interface, enhancing clarity and organization. Here are the steps to create titles for a Z program using SE80:
- In SE80, right-click on the program name.
- Select "Create" / "GUI Titles".
- In the subsequent dialog, assign a title code and description.
- Click Titles (all) to view all created titles.
- Activate titles by clicking on the Titles button.
- Declare title usage in the program with SET TITLEBAR in START-OF-SELECTION.
*---------------------------------------------------------------------*
START-OF-SELECTION.
*---------------------------------------------------------------------*
SET TITLEBAR '0100'.
Including titles enhances user experience, providing clear indications of program sections or functionalities and improving navigation and usability.
E.g
*&---------------------------------------------------------------------*
*& Report ZTEST_ABAP_JEGA_16
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztest_abap_jega_16.
* Constante
CONSTANTS: c_a(1) TYPE c VALUE 'A',
c_i(1) TYPE c VALUE 'I'.
* Declaration of Structure
DATA: it_users TYPE STANDARD TABLE OF zuser_table_jega,
wa_users LIKE LINE OF it_users.
DATA: l_text TYPE string.
*---------------------------------------------------------------------*
START-OF-SELECTION.
*---------------------------------------------------------------------*
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
* 'Select one of the executions options'
WRITE TEXT-001.
*---------------------------------------------------------------------*
AT USER-COMMAND.
*---------------------------------------------------------------------*
* Active users action
IF sy-ucomm EQ 'USU_ACTI'.
SET TITLEBAR '0200'.
PERFORM get_users_data USING c_a.
* Inactive users action
ELSEIF sy-ucomm EQ 'USU_INA'.
SET TITLEBAR '0300'.
PERFORM get_users_data USING c_i.
ELSEIF sy-ucomm EQ 'BACK' OR sy-ucomm EQ 'EXIT' OR sy-ucomm EQ 'CANCEL'.
LEAVE PROGRAM.
ENDIF.
*&---------------------------------------------------------------------*
*& Form get_users_data
*&---------------------------------------------------------------------*
* Users
*----------------------------------------------------------------------*
FORM get_users_data USING VALUE(p_state).
CLEAR it_users.
REFRESH it_users.
SELECT *
FROM zuser_table_jega
INTO TABLE it_users
WHERE estado EQ p_state.
IF sy-subrc EQ 0.
* Print Header
PERFORM print_header.
* Print Data
PERFORM print_data.
ELSE.
* No users found
* MESSAGE i000(ztest_class) WITH p_state.
l_text = TEXT-002.
REPLACE '&1' WITH p_state INTO l_text.
WRITE:/ l_text.
ULINE.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PRINT_HEADER
*&---------------------------------------------------------------------*
* Content of the Users Table
*----------------------------------------------------------------------*
FORM print_header.
WRITE:/1(133) sy-uline.
WRITE:/1(1) sy-vline,
2(8) 'ID', "DNI
11(1) sy-vline,
12(30) 'Name and Surname', "Full Name
43(1) sy-vline,
44(20) 'User Status', "State
65(1) sy-vline,
97(20) 'Date of Birth', "Birthdate
133(1) sy-vline.
WRITE:/1(133) sy-uline.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PRINT_DATA
*&---------------------------------------------------------------------*
* Content of the Users Table
*----------------------------------------------------------------------*
FORM print_data.
LOOP AT it_users INTO wa_users.
WRITE:/1 sy-vline,
2(8) wa_users-dni,
11 sy-vline,
12(30) wa_users-nombre_ape,
43 sy-vline,
44(20) wa_users-estado,
65 sy-vline,
97(20) wa_users-birthdate,
133 sy-vline.
ENDLOOP.
WRITE:/1(133) sy-uline.
ENDFORM.
 
 
 
Sobre el autor
Publicación académica de Jaime Eduardo Gomez Arango, en su ámbito de estudios para la Carrera Consultor ABAP.
Jaime Eduardo Gomez Arango
Profesión: Ingeniero de Sistemas y Computación - España - Legajo: SW34C
✒️Autor de: 149 Publicaciones Académicas
🎓Cursando Actualmente: Consultor en SAP Fiori
🎓Egresado de los módulos:
Disponibilidad Laboral: FullTime
Presentación:
Ingeniero de sistemas y computación con 8 años de experiencia el desarrollo frontend & backend (react/node) y en cloud (aws), actualmente desarrollando habilidades en sap btp, ui5, abap y fiori.
Certificación Académica de Jaime Gomez