This test program shows how to use pop up window to select a line and use it for further processing. There are several ways to meet this requirement and one of them is to use function module ‘POPUP_WITH_TABLE_DISPLAY’.
REPORT ztest_rs NO STANDARD PAGE HEADING
* Building type for the pop up window.
TYPES: BEGIN OF t_order,
vbeln TYPE vbeln_va, ” Sales Order
matnr TYPE matnr, ” Material
matkl TYPE matkl, ” Material Group
END OF t_order.
* Internal table and work area for pop up
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’
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 :-)’
choise = v_choice
valuetab = i_order
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
If you want to get such practical issues and resolutions straight to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.
If you liked this post, please hit the share button at the left side of your screen.
Thank you very much for your time!!
Image source : www.highsnobiety.com