Home > Default > Adding functionality to the pushbuttons in selection screen

Adding functionality to the pushbuttons in selection screen

November 30Hits:0
Advertisement
Hi,
Where to add the logic to the pushbutton in the selection screen.In the PBO or PAI of that screen.If possible can anyone send an example for that?

Answers

Hey!
  Check out this sample code.
REPORT z_prog.
DATA:
  BEGIN OF fs_spfli,
    carrid   LIKE spfli-carrid,        " Airline Code
    connid   LIKE spfli-connid,        " Flight Connection Number
    airpfrom LIKE spfli-airpfrom,      " Departure airport
    airpto   LIKE spfli-airpto,        " Destination airport
    deptime  LIKE spfli-deptime,       " Departure time
    arrtime  LIKE spfli-arrtime,       " Arrival time
  END OF fs_spfli,
  BEGIN OF fs_sflight,
    carrid   LIKE sflight-carrid,       " Airline Code
    connid   LIKE sflight-connid,       " Flight Connection Number
    fldate   LIKE sflight-fldate,       " Flight date
    seatsmax LIKE sflight-seatsmax,     " Maximum seats in economy class
    seatsocc LIKE sflight-seatsocc,     " Occupied seats in economyclass
  END OF fs_sflight,
  w_checkbox TYPE c,                    " Variable for checkbox
  w_currentline TYPE i,                 " Variable to display current
                                        " line
  w_lines TYPE i,
  w_read TYPE c .
* Internal Table to hold flight schedule information                  *
DATA:
  t_spfli LIKE
    TABLE OF
          fs_spfli.
* Internal Table to hold flight information                           *
DATA:
  t_sflight LIKE
      TABLE OF
            fs_sflight,
  t_sflight1 LIKE t_sflight.
*    START-OF-SELECTION Event                                         *
START-OF-SELECTION.
  PERFORM get_data_spfli.
*    END-OF-SELECTION Event                                           *
END-OF-SELECTION.
  SET PF-STATUS 'MENU'.
  PERFORM display_data_spfli.
*    TOP-OF-PAGE Event                                                *
TOP-OF-PAGE.
  PERFORM header_table_spfli.
*    AT LINE-SELECTION EVENT                                          *
AT LINE-SELECTION.
  SET PF-STATUS space.
  IF sy-lsind EQ 1 AND sy-lilli GE 4.
    PERFORM get_data_sflight.
    PERFORM display_data_sflight.
    PERFORM flag_line.
  ENDIF.                               " IF sy-lsind EQ 1..
*    AT USER-COMMAND                                                  *
AT USER-COMMAND.
  IF sy-lsind EQ 1.
    SET PF-STATUS space.
    CASE sy-ucomm.
      WHEN 'DISPLAY'.
        PERFORM get_data_sflight1.
        PERFORM display_data_sflight.
      WHEN 'SELECTALL'.
        PERFORM select_all.
        PERFORM flag_line.
      WHEN 'DESELECTAL'.
        PERFORM deselect_all.
        PERFORM flag_line.
    ENDCASE.                           " CASE sy-ucomm
  ENDIF.                               " IF sy-lsind EQ 1
*    TOP-OF-PAGE DURING LINE-SELECTION                                *
TOP-OF-PAGE DURING LINE-SELECTION.
  PERFORM sec_list_heading.
*&      Form  get_data_spfli
*  This subroutine fetches the data from SPFLI
* This subroutine does not have parameters to pass
FORM get_data_spfli .
  SELECT carrid                        " Airline Code
         connid                        " Flight Connection Number
         airpfrom                      " Departure airport
         airpto                        " Destination airport
         deptime                       " Departure time
         arrtime                       " Arrival time
    FROM spfli
    INTO TABLE t_spfli.
ENDFORM.                               " GET_DATA_SPFLI
*&      Form  display_data_spfli
* This subroutine displays the data of SPFLI
* This subroutine does not have parameters to pass
FORM display_data_spfli .
  LOOP AT t_spfli INTO fs_spfli.
    WRITE: /02 w_checkbox AS CHECKBOX,
            05 w_read,
               fs_spfli-carrid UNDER text-001,
               fs_spfli-connid UNDER text-002,
               fs_spfli-airpfrom UNDER text-003,
               fs_spfli-airpto UNDER text-004,
               fs_spfli-deptime UNDER text-005,
               fs_spfli-arrtime UNDER text-006.
    HIDE:
      fs_spfli-carrid,
      fs_spfli-connid.
  ENDLOOP.                             " LOOP AT t_spfli..
ENDFORM.                               " DISPLAY_DATA_SPFLI
*&      Form  header_table_spfli
* This subroutine diplays the headings of table spfli
* This subroutine does not have parameters to pass
FORM header_table_spfli .
  WRITE: /10 text-001 COLOR 4,
          25 text-002 COLOR 4,
          40 text-003 COLOR 4,
          55 text-004 COLOR 4,
          70 text-005 COLOR 4,
          85 text-006 COLOR 4.
ENDFORM.                               " HEADER_TABLE
*&      Form  get_data_sflight
* This subroutine fetches the data from SFLIGHT
* This subroutine does not have interface parameters to pass
FORM get_data_sflight .
  SELECT carrid                        " Airline Code
         connid                        " Flight Connection Number
         fldate                        " Flight date
         seatsmax                      " Maximum seats in economy class
         seatsocc                      " Occupied seats in economyclass
    FROM sflight
    INTO TABLE t_sflight
   WHERE carrid EQ fs_spfli-carrid
     AND connid EQ fs_spfli-connid.
ENDFORM.                               " GET_DATA_SFLIGHT
*&      Form  display_data_sflight
* This subroutine displays the SFLIGHT data
* This subroutine does not have interface parameters to pass
FORM display_data_sflight .
  LOOP AT t_sflight INTO fs_sflight.
    WRITE: / fs_sflight-carrid UNDER text-001,
             fs_sflight-connid UNDER text-002,
             fs_sflight-fldate UNDER text-007,
             fs_sflight-seatsmax UNDER text-008 LEFT-JUSTIFIED,
             fs_sflight-seatsocc UNDER text-009 LEFT-JUSTIFIED.
  ENDLOOP.
    CLEAR: fs_sflight.
ENDFORM.                               " DISPLAY_DATA_sflight
*&      Form  sec_list_heading
*  This subroutine diplays the headings of table spfli
* This subroutine does not have interface parameters to pass
FORM sec_list_heading .
  WRITE: /2 text-001 COLOR 4,
         15 text-002 COLOR 4,
         33 text-007 COLOR 4,
         45 text-008 COLOR 4,
         60 text-009 COLOR 4.
ENDFORM.                               " SEC_LIST_HEADING
*&      Form  get_data_sflight1
* This subroutine displays the data from SFLIGHT according to checkbox
* clicked.
* This subroutine does not have interface parameters to pass
FORM get_data_sflight1 .
  DATA:
    lw_checkbox TYPE c.
  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_currentline = 3 + sy-index.
    CLEAR:
      w_checkbox,
      fs_spfli.
    READ LINE w_currentline FIELD VALUE
      w_checkbox INTO lw_checkbox
      fs_spfli-carrid INTO fs_spfli-carrid
      fs_spfli-connid INTO fs_spfli-connid.
    IF sy-subrc EQ 0.
      IF lw_checkbox EQ 'X'.
        SELECT carrid                  " Airline Code
               connid                  " Flight Connection Number
               fldate                  " Flight Date
               seatsmax                " Max Seats
               seatsocc                " Occupied Seats
          FROM sflight
          INTO TABLE t_sflight1
         WHERE carrid EQ fs_spfli-carrid
           AND connid EQ fs_spfli-connid.
        IF sy-subrc EQ 0.
          APPEND LINES OF t_sflight1 TO t_sflight.
        ENDIF.                         " IF sy-subrc EQ 0.
      ENDIF.                           " IF lw_checkbox EQ 'X'
    ENDIF.                             " IF sy-subrc EQ 0.
  ENDDO.                               " DO w_lines TIMES
ENDFORM.                               " GET_DATA_SFLIGHT1
*&      Form  select_all
* This subroutine selects all the records of SPFLI
* This subroutine does not have interface parameters to pass
FORM select_all .
  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_currentline = sy-index + 3.
    READ LINE w_currentline FIELD VALUE
    w_checkbox INTO w_checkbox.
    IF sy-subrc = 0.
      MODIFY LINE w_currentline FIELD VALUE
      w_checkbox FROM 'X'.
    ENDIF.                             " IF sy-subrc = 0.
  ENDDO.                               " DO lw_line TIMES.
ENDFORM.                               " SELECT_ALL
*&      Form  deselect_all
* This subroutine deselects all the records of SPFLI
* This subroutine does not have interface parameters to pass
FORM deselect_all .
  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_currentline = sy-index + 3.
    READ LINE w_currentline FIELD VALUE
    w_checkbox INTO w_checkbox.
    IF sy-subrc = 0.
      MODIFY LINE w_currentline FIELD VALUE
      w_checkbox FROM ' '.
    ENDIF.                             " IF sy-subrc = 0.
  ENDDO.                               " DO lw_line TIMES.
ENDFORM.                               " DESELECT_ALL
*&      Form  flag_line
* This subroutine flags the line which has been read
* This subroutine does not have interface parameters to pass
FORM flag_line .
  DESCRIBE TABLE t_spfli LINES w_lines.
  DO w_lines TIMES.
    w_checkbox = 'X'.
    READ LINE sy-lilli FIELD VALUE
      w_read INTO w_read
      w_checkbox INTO w_checkbox.
    IF sy-subrc EQ 0.
      MODIFY CURRENT LINE
      FIELD FORMAT w_checkbox INPUT OFF
      FIELD VALUE w_read FROM '*'.
    ENDIF.                             " IF sy-subrc EQ 0
  ENDDO.                               " DO w_lines TIMES
ENDFORM.                               " FLAG_LINE
Regards
Abhijeet
Edited by: Abhijeet Kulshreshtha on Jul 11, 2008 9:10 AM

Read other 7 answers

Tags:

Related Articles

  • Adding functionality to the pushbuttons in selection screenNovember 30

    Hi, Where to add the logic to the pushbutton in the selection screen.In the PBO or PAI of that screen.If possible can anyone send an example for that?Hey!   Check out this sample code. REPORT z_prog. DATA:   BEGIN OF fs_spfli,     carrid   LIKE spfli

  • Calling a screen at pushbutton in selection screenNovember 30

    hii all, please provide me the suitable code for calling a screen on pushbutton in selection screen.... thanks babbalTABLES: SSCRFIELDS. TYPE-POOLS ICON. DATA: FUNCTXT TYPE SMP_DYNTXT. PARAMETERS: P_VBELN LIKE VBAK-VBELN. SELECTION-SCREEN: FUNCTION K

  • Pushbutton in selection screenNovember 30

    Hi all   i want to deactivate a pushbutton in selection screen.   please help me...its urgent    rewards assured..Hi gaurav, 1. So, wats the use of MODIF ID? or wats the flaw in my approach Theres no flaw in your approach. 2. Further, you are right.

  • Adding a new field to the selection screen of a LDBOctober 11

    Hi all, I want to add a new field Clearing date(BSEG-AUGDT) in the dynamic selection screen of  the report RFUMSV00. For adding a new field i have copied the SAP view of a Logical database to CUS view. Next i had added the Clearing date(BSEG-AUGDT) t

  • Adding a message to the variable selection screenNovember 30

    Hi there I have been asked to find a way to add a message to the variable selection screen. It appears that DIVISION needs to be added to the selection screen, as this makes the query run faster. However, they don't actually want the user to enter a

  • Pushbuttons on selection-screenNovember 30

    Hi ,    i have a push button on the selection screen , when press it my list must be displayed. how can i do it. Regards ArunREPORT Z3_SELECTION_SCREEN . Tables : MAKT,SSCRFIELDS. DATA : FLAG VALUE '0'. SELECTION-SCREEN BEGIN OF BLOCK ONE WITH FRAME 

  • Get TEXT OF Pushbutton on selection-screenNovember 30

    HI ,    How can i get the name of the pushbutton on the selection-screen.Dear Arun, First of all Thanks for giving me points for your 'Time Query'. It was my first inauguration in sdn. Regarding this 'Button Name'  Query, It seems to me that your pro

  • Value from Program to Selection screen using pushbutton on Selection ScreenOctober 11

    Sir, I am creating a Selection screen for update some fields using selection screen. I have 6 fields on screen. First 3 Fields are mendaotry for fetching the data to dispay last 3 fields. I have create a push button for fetch the last 3 fields using

  • Adding Radio button & regular button to selection-screen without new guiNovember 30

    Hi, Is there a way to add a radio button & regular button to a selection-screen without having to create a new gui, status and etc? Thanks, JohnHi SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 4(30) TEXT-001 FOR FIELD P_1. SELECTION-SCREEN

  • Adding a new input field on selection screen after input in a select optionNovember 30

    Hi Experts, There are 2 input fields on the selection screen. I would like to add a new select option field when a value is entered in the 2nd field <b>only</b>. If there is an input in the 1st field or both the fields, the new input field sho

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.532 s.