ABAP Popup Confirmation Implementation
ABAP Popup Confirmation Implementation
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 .