ABAP Tips - 1 : How to Display a Popup and Get Values from User ?
How to Display a Popup and Get Values from User ?
Function Module POPUP_GET_VALUES can be used to display a popup to get inputs from user. The speciality of this function module is we can add as many number of fields as we want. The fields can be of any data type.
REPORT ztest9910.
DATA: t_fields LIKE sval OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.*--- Prepare Parameters for FM -------------* t_fields-tabname = ’BKPF’.
t_fields-fieldname = ’BUDAT’.
APPEND t_fields.
t_fields-tabname = ’BKPF’.
t_fields-fieldname = ’BLART’.
APPEND t_fields.
*---- Function Module Call -----------------* CALL FUNCTION ’POPUP_GET_VALUES’
EXPORTING
* NO_VALUE_CHECK = ’ ’ popup_title = ’Test Popup’* START_COLUMN = ’5’
* START_ROW = ’5’
* IMPORTING
* RETURNCODE =
TABLES
fields = t_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Display Report ----------------*
LOOP AT t_fields.
WRITE:/ t_fields-value.
ENDLOOP.
Execution of the program gives following screens. It displays the popup with desired fields.
Report output.
The specialities of this Function module are:
Function Module POPUP_GET_VALUES can be used to display a popup to get inputs from user. The speciality of this function module is we can add as many number of fields as we want. The fields can be of any data type.
REPORT ztest9910.
DATA: t_fields LIKE sval OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.*--- Prepare Parameters for FM -------------* t_fields-tabname = ’BKPF’.
t_fields-fieldname = ’BUDAT’.
APPEND t_fields.
t_fields-tabname = ’BKPF’.
t_fields-fieldname = ’BLART’.
APPEND t_fields.
*---- Function Module Call -----------------* CALL FUNCTION ’POPUP_GET_VALUES’
EXPORTING
* NO_VALUE_CHECK = ’ ’ popup_title = ’Test Popup’* START_COLUMN = ’5’
* START_ROW = ’5’
* IMPORTING
* RETURNCODE =
TABLES
fields = t_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*--- Display Report ----------------*
LOOP AT t_fields.
WRITE:/ t_fields-value.
ENDLOOP.
Execution of the program gives following screens. It displays the popup with desired fields.
Report output.
The specialities of this Function module are:
Very helpful!
ReplyDeleteGracias!
good explanation
ReplyDeleteThank you. Keep up the good work.
ReplyDeleteThis is very user friendly... easy to understand... thanks! :)
ReplyDeleteHow to add customize search help here ?
ReplyDeleteCan I use this pop-up at sales order header data level when i will enter sold to party then that pop-up window will come with fields, is this possible in VA01 ?
ReplyDeleteInformative article. You have done great explanation and visualization. Keep up the good work.
ReplyDeleteBEST SAP ABAP TRAINING IN HYDERABAD
Great Post. The information provided is of great use as I got to learn new things. Keep Blogging.
ReplyDeleteSAP ABAP TRAINING IN HYDERABAD
Useful code
ReplyDelete