Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow
How to Open PopUp_To_Confirm Screen When Delete Function Key is Pressed for Confirmation
In this ABAP tutorial, ABAP developers will find a sample ABAP report which displays a popup confirmation screen when delete function key is pressed.
In the below SAP screenshot, you can see 4 function keys each for Create, Change, Display and Delete.
Function keys are declared using : SELECTION-SCREEN: FUNCTION KEY 1. ABAP code.
Here is the ABAP codes block used for function key declaration.
The icons and the text of each function key is set using : sscrfields-functxt_01
Here is the ABAP code for text and icon settings of each function key.
For example icon_create is "@0Y@" and maps to create new document icon.
For more information about SAP icons please refer to SAP tutorial Display Icons using ABAP Code - SAP Icon List.
In the ABAP codes section AT SELECTION-SCREEN, the value of ABAP field sscrfields-ucomm is controlled to define which SAP function key is pressed.
In our example to display the delete confirmation screen before deleting the ABAP table record from database table, I used the popup_to_confirm function call code where the sscrfields-ucomm value which stores the returned function key code is "FC04"
The ABAP function call returns the value of the pressed button at the delete confirm screen.
In order to check which button is pressed on the delete confirm screen, I defined a local variable lv_answer as type c with length 1.
For the above screen shot if the value of the local variable lv_answer is equal to 1 then this means the YES button is clicked.
A value of 2 means NO button is pressed.
And if the value of lv_answer is 3 then the CANCEL button is pressed by the user on the confirm delete screen.
Sample ABAP Code for PopUp_To_Confirm
Here is the ABAP codes of the example ABAP report which uses the Call Function POPUP_TO_CONFIRM for confirming delete operation when DELETE function key is pressed.