Friday, June 27, 2008

SAP POP UP TABLE CONTENTS ON THE SCREEN

SAP POP UP TABLE CONTENTS ON THE SCREEN

To POP up table contents on the Screen the following function module can be used.

SAP ABAP function module to POP UP Table contents on the screen.

POPUP_WITH_TABLE_DISPLAY
___________________________________________

While developing a report if you wish to display some internal table contents on the screen it can easily be done with the above mentioned function module. While doing so you can define a hot spot or create a button the screen and pop up the internal table contents.

Find the code below.

The input parameters are as follows

ENDPOS_COL            Make sure that you define a value that will accommodate the complete column length.
ENDPOS_ROW           Put a values to ensure that the rows in the internal table should fit in
STARTPOS_COL        Co-ordinates (X-Axis) of the starting position (Column)of the POP UP Table
STARTPOS_ROW       Co-ordinates (Y-Axis) of the starting position (Row)of the POP UP Table
TITLETEXT                Title to be given

__________________________________________________________________________________________


REPORT ZEX_POPUPTABLE .

Data: d_endpos_col(4) value 25,
      d_ENDPOS_ROW(4) value 5,
      d_startpos_row(4) value 10,
      d_startposcol(4) value 10,
      d_title(100),
      d_choice like SY-TABIX.

Data: begin of int_valtab occurs 0,
      data(100),
      end of int_valtab.

move: 'This is row 1' to int_valtab-data.
append int_valtab.
clear int_valtab.

move: 'This is row 2' to int_valtab-data.
append int_valtab.
clear int_valtab.

move: 'Display Table' to d_title.


 CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
   EXPORTING
     ENDPOS_COL         = d_endpos_col
     ENDPOS_ROW         = d_ENDPOS_ROW
     STARTPOS_COL       = d_startposcol
     STARTPOS_ROW       = d_startpos_row
     TITLETEXT          = d_title
 IMPORTING
    CHOISE             = d_choice
   TABLES
     VALUETAB           = int_valtab
  EXCEPTIONS
    BREAK_OFF          = 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.