Display a Popup and Get Values from User

2
6763

Display a Popup and Get Values from User

In some cases, we are needed to get some inputs from the user at run-time of an application based on certain dynamic conditions.

Function Module POPUP_GET_VALUES can be used to display a popup to get inputs from user. The specialty of this function module is we can add as many number of fields as we want. The fields can be of any data type.

Display a Popup and Get Values from User

 

 

 

 

REPORT ztestpopup.

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.

 

 

 

 

 

 

2 COMMENTS

  1. Thank you Robert,
    My requirement is that, I have to add two additional field at sales order header data, for that I want to use pop-up screen in foreground mode and I have to pass that field data to sales item level in condition tab(komv-kbetr)..

    Explanation in depth way..
    My actual requirement is that, I have to calculate freight charges of material and that charges will be determine based on distance (from pin code to To_pin code) and for that I have created a custom table that holdings distance between two cities(Pin-codes) and fright charges as per distance,,
    For above logic I have to go for enhancement, before that I have to add two custom screen fields at sales order header data(using popup get value)..

    Once, I entered sold to party in VA01 then that popup window will come with two fields and select data from table based on customer no and from_pin to To_pin and take the fright charges and pass it to condition tab at item level data..

    Could you guide me, where I have to use that “POPUP GET VALUE” function module in SAPMV45A and which user_exit/include program to use fetch data from database.

    Please help me for above issue..

    Thank you
    sandeep

  2. I am using same function module ‘POPUP_GET_VALUE’ in VA01 but where I have to call this function module in program SAPMV45A means which include program/user_exit I have to use and how to pass that popup field value in select query(where condition)..

LEAVE A REPLY

Please enter your comment!
Please enter your name here