Member-only story
Using POPUP_GET_VALUES in ABAP to Retrieve User Input

When developing applications in SAP ABAP, there are scenarios where we need to prompt users for input dynamically. One of the simplest ways to achieve this is by using the function module POPUP_GET_VALUES
. This function displays a popup window where users can enter values for specified fields, which can then be retrieved and processed within the program.
Understanding POPUP_GET_VALUES
The POPUP_GET_VALUES
function module provides a simple way to capture user input by displaying a small window with input fields. The values entered by the user are then returned to the program for further processing.
Sample Code Implementation
Let’s explore how to use POPUP_GET_VALUES
with a practical example. The following ABAP program prompts the user to enter a value for the VBELN
(Sales Document) field from the LIPS
table.
DATA: T_FIELDS LIKE TABLE OF SVAL WITH HEADER LINE.
DATA: S_FIESLD LIKE SVAL.
S_FIESLD-TABNAME = 'LIPS'.
S_FIESLD-FIELDNAME = 'VBELN'.
APPEND S_FIESLD TO T_FIELDS.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
POPUP_TITLE = 'Enter Sales Document Number'
TABLES
FIELDS = T_FIELDS.
IF SY-SUBRC <> 0.
WRITE: 'Error: Unable to retrieve input.'.
EXIT.
ENDIF.
WRITE 'Developed by Sait ORHAN'.
Explanation of the Code
1. Define a Table for Fields:
T_FIELDS
is declared as a table of typeSVAL
, which will store the fields for which input is required.S_FIESLD
is declared as a structure of typeSVAL
.
2. Specify the Field for Input:
- The program sets
TABNAME
as'LIPS'
andFIELDNAME
as'VBELN'
, indicating that the input is for theVBELN
field in theLIPS
table. - This structure is appended to
T_FIELDS
.
3. Call POPUP_GET_VALUES
:
- The function module is called with the popup title
Enter Sales Document Number
. - The
T_FIELDS
table is passed, which defines the fields that will appear in the popup.
- Handle the Return Values:
- If
SY-SUBRC
is not0
, an error message is displayed…