Thursday, August 12, 2010

Giving a Pop up for multiple selection after PAI

Example: If user wants to print a form from a standard tcode like Orders or Areements -- and based on the status of document he wants to print the document with or without Units on the form. He doesn't want to edit the Tcode to allow the option, instead he likes to get a pop up showing the options as soon as he selects the Print button.

Inside the smartform processing program: call the below FM to give the Pop Up and take the inputs to program based on that.

*&---------------------------------------------------------------------*
*&
****    Popup inside a program to select -- Begin
*&
*&---------------------------------------------------------------------*
DATA: d_endpos_col TYPE int4 VALUE 25,
      d_endpos_row TYPE int4  VALUE 5,
      d_startpos_row TYPE int4  VALUE 10,
      d_startposcol TYPE int4  VALUE 10,
      d_title TYPE char80,
      d_choice LIKE sy-tabix.

DATABEGIN OF int_valtab OCCURS 0,
      data(100),
      END OF int_valtab.

DATA: w_valtab LIKE LINE 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.

READ TABLE int_valtab INTO w_valtab INDEX d_choice.
WRITE:/ 'Selection is -- ',
        w_valtab.
*&---------------------------------------------------------------------*
*&
****    Popup inside a program to select -- End
*&
*&---------------------------------------------------------------------*

No comments:

Post a Comment