0% found this document useful (0 votes)
38 views4 pages

ABAP Popup Confirmation Implementation

This document describes the object ZMP_ZTMP_LP which contains modules and screens for processing data in structure ZTMP_LP. Module user_command_0001 handles input for screen 0001 and contains logic for actions like add, delete, modify and clear. Module user_command_0002 similarly handles input for screen 0002 and contains logic for actions like retrieve, new search, and navigating to the next screen. The status of screens 0001 and 0002 are controlled by modules status_0001 and status_0002 respectively.

Uploaded by

Lincoln Porta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views4 pages

ABAP Popup Confirmation Implementation

This document describes the object ZMP_ZTMP_LP which contains modules and screens for processing data in structure ZTMP_LP. Module user_command_0001 handles input for screen 0001 and contains logic for actions like add, delete, modify and clear. Module user_command_0002 similarly handles input for screen 0002 and contains logic for actions like retrieve, new search, and navigating to the next screen. The status of screens 0001 and 0002 are controlled by modules status_0001 and status_0002 respectively.

Uploaded by

Lincoln Porta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

*-----------------------------------------------

NOME DO OBJETO
*-----------------------------------------------
ZMP_ZTMP_LP

*-----------------------------------------------
Estruturas Dictionary
*-----------------------------------------------
ZTMP_LP

*-----------------------------------------------
CAMPOS
*-----------------------------------------------
WA_ZTMP_LP

*-----------------------------------------------
MÓDULO PBO
*-----------------------------------------------
MODULE status_0001 OUTPUT.
SET PF-STATUS 'STATUS0001'.
* SET TITLEBAR 'xxx'.
ENDMODULE.

MODULE status_0002 OUTPUT.


SET PF-STATUS 'STATUS0002'.
* SET TITLEBAR 'xxx'.
ENDMODULE.

*-----------------------------------------------
MÓDULO PAI
*-----------------------------------------------
MODULE user_command_0001 INPUT.

CASE sy-ucomm.

WHEN 'BACK'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = 'Deseja sair do programa?'
text_button_1 = 'Sair'
text_button_2 = 'Não'
default_button = '2'
display_cancel_button = ' '
IMPORTING
answer = wa_ztmp_lp
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
LEAVE TO SCREEN 0.
MESSAGE 'SAINDO...' TYPE 'S'.

WHEN 'ADICIONAR'.
MODIFY ztmp_lp FROM wa_ztmp_lp.
IF sy-subrc = 0.
MESSAGE 'RESGISTRO ADICIONADO COM SUCESSO' TYPE 'S'.
ENDIF.

WHEN 'DELETAR'.
DELETE ztmp_lp FROM wa_ztmp_lp.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = 'Deseja deletar este conteúdo?'
text_button_1 = 'Deletar'
text_button_2 = 'Não'
default_button = '2'
display_cancel_button = ' '
IMPORTING
answer = wa_ztmp_lp
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
MESSAGE 'REGISTRO DELETADO COM SUCESSO' TYPE 'S'.

WHEN 'MODIFICAR'.
UPDATE ztmp_lp FROM wa_ztmp_lp.
IF sy-subrc = 0.
MESSAGE 'REGISTRO MODIFICADO COM SUCESSO' TYPE 'S'.
ENDIF.

WHEN 'LIMPAR'.
CLEAR wa_ztmp_lp.
MESSAGE 'TELA LIMPA COM SUCESSO' TYPE 'S'.

WHEN 'VOLTAR0001'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = 'Deseja voltar para a página inicial?'
text_button_1 = 'Voltar'
text_button_2 = 'Não'
default_button = '2'
display_cancel_button = ' '
IMPORTING
answer = wa_ztmp_lp
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
CALL SCREEN 0002.
MESSAGE 'VOLTANDO PARA TELA INICIAL' TYPE 'S'.

ENDCASE.

ENDMODULE.

MODULE user_command_0002 INPUT.

CASE sy-ucomm.

WHEN 'BACK'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
text_question = 'Deseja sair do programa?'
text_button_1 = 'Sair'
text_button_2 = 'Não'
default_button = '2'
display_cancel_button = ' '
IMPORTING
answer = wa_ztmp_lp
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
LEAVE TO SCREEN 0.
MESSAGE 'SAINDO...' TYPE 'S'.

WHEN 'OBTER'.
SELECT SINGLE * FROM ztmp_lp INTO wa_ztmp_lp
WHERE MATNR = wa_ztmp_lp-MATNR.
MESSAGE 'OBTENDO OS DADOS' TYPE 'S'.

WHEN 'NOVA'.
CLEAR wa_ztmp_lp.
MESSAGE 'NOVA PESQUISA...' TYPE 'S'.

WHEN 'EDITAR'.
MESSAGE 'A CAMINHO DA PRÓXIMA PÁGINA' TYPE 'S'.
CALL SCREEN 0001.

ENDCASE.

ENDMODULE.

*-----------------------------------------------
TELAS
*-----------------------------------------------
0001
PROCESS BEFORE OUTPUT.
MODULE STATUS_0001.

PROCESS AFTER INPUT.


MODULE USER_COMMAND_0001.

0002
PROCESS BEFORE OUTPUT.
MODULE STATUS_0002.
MODULE START_ALV.

PROCESS AFTER INPUT.


MODULE USER_COMMAND_0002.

*-----------------------------------------------
STATUS GUI
*-----------------------------------------------
STATUS0001
STATUS0002

*-----------------------------------------------
INCLUDES
*-----------------------------------------------
ZMP_ZTMP_LP_F01

ZMP_ZTMP_LP_I01
-> MODULE user_command_0001 INPUT.
-> MODULE user_command_0002 INPUT.

ZMP_ZTMP_LP_O01
-> MODULE status_0001 OUTPUT.
-> MODULE status_0002 OUTPUT.

*-----------------------------------------------
TRANSAÇÕES
*-----------------------------------------------
ZMP_ZTMP_LP

Common questions

Powered by AI

The document utilizes pop-up confirmations to obtain user verification before performing critical actions such as exiting the program, deleting content, or navigating away from the current screen. For example, the 'BACK' command triggers a pop-up asking, 'Deseja sair do programa?' with options 'Sair' or 'Não', while 'DELETAR' prompts confirmation to delete the content with options 'Deletar' or 'Não' .

The document differentiates user command handling between screens by associating specific modules with each screen. Screen 0001 uses MODULE USER_COMMAND_0001 for processing commands like 'ADICIONAR,' 'DELETAR,' and 'MODIFICAR,' while screen 0002 uses MODULE USER_COMMAND_0002 for commands such as 'OBTER,' and 'EDITAR.' Each module processes commands tailored to the screen's purpose, ensuring context-specific functionality .

The document ensures data integrity during the 'MODIFICAR' command by updating records using UPDATE ztmp_lp FROM wa_ztmp_lp and checking the system return code (sy-subrc). If the command executes without issues (sy-subrc = 0), it confirms the successful modification by displaying the message 'REGISTRO MODIFICADO COM SUCESSO,' thereby verifying that the intended operation was completed successfully .

The document specifies handling unsuccessful function executions by defining exception handling in function calls. For instance, the POPUP_TO_CONFIRM function includes EXCEPTIONS like text_not_found and OTHERS, which handle errors that might occur during function execution. Although specific reporting mechanisms for these exceptions aren’t detailed, the system's use of exceptions suggests capability to report issues when they occur .

Screen navigation in the document is handled through specific function calls like CALL FUNCTION and LEAVE TO SCREEN. The navigation is triggered by user commands such as 'VOLTAR0001,' which calls a confirmation pop-up for returning to the initial screen followed by CALL SCREEN 0002. For exiting, the 'BACK' command results in a similar confirmation pop-up and a LEAVE TO SCREEN 0 command .

The document utilizes the 'LIMPAR' command, which executes the CLEAR command on wa_ztmp_lp to clear the screen data. After clearing, it provides user feedback through the message 'TELA LIMPA COM SUCESSO,' indicating that the screen has been successfully reset .

The document handles user commands for data manipulation through the MODULE user_command_0001, where 'ADICIONAR' (add) and 'DELETAR' (delete) are managed using MODIFY and DELETE SQL-like commands. When 'ADICIONAR' is executed successfully, a success message 'RESGISTRO ADICIONADO COM SUCESSO' is displayed. Similarly, for 'DELETAR', the entry is removed followed by a confirmation popup and a success message 'REGISTRO DELETADO COM SUCESSO' .

The document implements conditional logic for user commands using CASE and WHEN statements within MODULEs, such as user_command_0001. This structure evaluates the system command (sy-ucomm) and routes to appropriate actions like adding, deleting, or modifying records. This approach impacts program flow by providing a structured yet flexible mechanism to execute specific operations based on user interactions, thus directly influencing program outcomes and user experience .

INCLUDES in the document act as linkers to different parts of the program, organizing code into separate sections for better modularization. They connect specific MODULEs to the program's control flow, such as ZMP_ZTMP_LP_I01 linking to INPUT modules like MODULE user_command_0001 and user_command_0002, and ZMP_ZTMP_LP_O01 to OUTPUT modules like MODULE status_0001 and status_0002, streamlining code management .

MODULEs status_0001 and status_0002 in the document's program structure are responsible for setting the user interface status using the SET PF-STATUS command. Each module sets a different status, 'STATUS0001' and 'STATUS0002' respectively, which determines the available user interface elements or commands at that point in the program execution .

You might also like