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:
  1. More than one fields can be added
  2. Fields with any data type can be added to the list
  3. It displays inherent F4 help during the input.


Comments

  1. Very helpful!
    Gracias!

    ReplyDelete
  2. Thank you. Keep up the good work.

    ReplyDelete
  3. This is very user friendly... easy to understand... thanks! :)

    ReplyDelete
  4. How to add customize search help here ?

    ReplyDelete
  5. Can 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 ?

    ReplyDelete
  6. Informative article. You have done great explanation and visualization. Keep up the good work.
    BEST SAP ABAP TRAINING IN HYDERABAD

    ReplyDelete
  7. Great Post. The information provided is of great use as I got to learn new things. Keep Blogging.
    SAP ABAP TRAINING IN HYDERABAD

    ReplyDelete

Post a Comment

Popular posts from this blog

Help on BAPI_ACC_DOCUMENT_POST and BAPI_ACC_DOCUMENT_POST

Few Tips for Transport Request Manipulation