This test program demonstrates how to use a Pop Up Screen with Selection Option using FM POPUP_WITH_TABLE_DISPLAY to select a line and proceed with further processing. There are several ways to meet this requirement, and one of them is by utilizing the function module ‘POPUP_WITH_TABLE_DISPLAY’.
REPORT ztest_rs NO STANDARD PAGE HEADING
LINE-SIZE 400.
* Building type for the pop up window.
TYPES: BEGIN OF t_order,
vbeln TYPE vbeln_va, ” Sales Order
blank1(1),
matnr TYPE matnr, ” Material
blank2(1),
matkl TYPE matkl, ” Material Group
END OF t_order.
* Internal table and work area for pop up
DATA:
i_order TYPE STANDARD TABLE OF t_order INITIAL SIZE 0,
w_order TYPE t_order.
* Store the line number selected from the pop-up
DATA v_choice TYPE sy-tabix.
* Test select just to pick couple of lines
* You need to build i_order table as per your requirement. This will have pop up data
SELECT vbeln matnr matkl UP TO 10 ROWS FROM vbap INTO CORRESPONDING FIELDS OF TABLE i_order .
* Pop up to select from
CALL FUNCTION ‘POPUP_WITH_TABLE_DISPLAY’
EXPORTING
endpos_col = 75 ” Pop up window column end position
endpos_row = 10 ” Pop up window row end position
startpos_col = 40 ” Pop up window column start position
startpos_row = 3 ” Pop up window row start position
titletext = ‘Test popup for our friend Ani :-)’
IMPORTING
choise = v_choice
TABLES
valuetab = i_order
EXCEPTIONS
break_off = 1
OTHERS = 2.
IF sy-subrc = 0.
* Get the line selected/clicked
READ TABLE i_order INTO w_order INDEX v_choice.
* When one line is selected and the choose button is clicked
IF sy-subrc EQ 0.
* Do whatever you need to do with the selected line
ENDIF.
ENDIF.
* Expected result
If you want to receive practical solutions like creating a Pop Up Screen with Selection Option using FM POPUP_WITH_TABLE_DISPLAY directly in your inbox.
YOU MAY BE INTERESTED IN
How to SPLIT Data in FOR LOOP Using Modern ABAP Syntax?