ADD push button in selection-screen

Hi Guys,
I have a requirement.
In the selection screen on the report, I need a push button "Click".
When i "Click"  First Time this it should display all the selection screen Blocks B1,B2,B3 from my selection screen.
For second "Click" it should Hide the Blocks B1,B2,B3.
I am doing the following code in my report:
But for first Click it is displaying the Blocks.And for the Second click it is not Hiding.
Please suggest on this.....
initialization.
  if screen-group1 = 'A1' .
            screen-active = 0.
            modify screen.
          endif.
        endloop.
        loop at screen.
          if screen-group1 = 'A2' .
            screen-active = 0.
            modify screen.
          endif.
        endloop.
        loop at screen.
          if screen-group1 = 'A3' .
            screen-active = 0.
            modify screen.
          endif.
        endloop.
I am using " At selection screen:
at selection-screen.
if gv_flag = space.
        loop at screen.
          if screen-group1 = 'A1' .
            screen-active = 1.
            modify screen.
          endif.
        endloop.
        loop at screen.
          if screen-group1 = 'A2' .
            screen-active = 1.
            modify screen.
          endif.
        endloop.
        loop at screen.
          if screen-group1 = 'A3' .
            screen-active = 1.
            modify screen.
          endif.
        endloop.
        gv_flag = 'X'.
      elseif gv_flag = 'X'.
              loop at screen.
          if screen-group1 = 'A1' .
            screen-active = 0.
            modify screen.
          endif.
        endloop.
        loop at screen.
          if screen-group1 = 'A2' .
            screen-active = 0.
            modify screen.
          endif.
        endloop.
        loop at screen.
          if screen-group1 = 'A3' .
            screen-active = 0.
            modify screen.
          endif.
        endloop.
        gv_flag = space.
endif.

You are hiding it in INITIALIZATION block which means it hides only once before PBO. If you want to show/hide it in turn simply place all your code in PAI, not just part of it.
Regards
Marcin
Sorry didn't notice part of the code in the bottom
The logic should go like
at selection-screen.
if gv_flag = space.
loop at screen.
  case screen-group1.
     when 'A1' or 'A2' or 'A3'    
        screen-active = 1.
        modify screen.
     when others.
   endcase.
endloop.
gv_flag = 'X'.
elseif gv_flag = 'X'.
   loop at screen.
      case screen-group1.
           when 'A1' or 'A2' or 'A3'.
            screen-active = 0.
            modify screen.
         when others.
    endcase.
endloop.
  gv_flag = space.
endif.
Regards
Marcin
Edited by: Marcin Pciak on Apr 1, 2011 12:33 PM

Similar Messages

  • How to Add Push Button On Selection Screen

    Hi Experts,
    How to add Push button on Selection Screen.
    Points will b rewarded for useful help.
    Bohra.

    Hi,
    To create a pushbutton on the selection screen, you use:
    SELECTION SCREEN PUSHBUTTON [/]<pos(len)> <push>
    USER-COMMAND <ucom> [MODIF ID <key>].
    The [/]<pos(len)> parameters and the MODIF IF addition have the same function as for the formatting options for underlines and comments.
    <push> determines the pushbutton text. For <push>, you can specify a text symbol or a field name with a maximum length of eight characters. This character field must not be declared with the DATA statement, but is generated automatically with length <len>. The field must be filled before the selection screen is called.
    For <ucom>, you must specify a code of up to four characters. When the user clicks the pushbutton on the selection screen, <ucom> is entered in the UCOMM of the SSCRFIELDS interface work area. You must use the TABLES statement to declare the SSCRFIELDS structure. The contents of the SSCRFIELDS-UCOMM field can be processed during the AT SELECTION-SCREENevent.
    Ex.
    REPORT DEMO.
    TABLES SSCRFIELDS.
    DATA FLAG.
    SELECTION-SCREEN:
    BEGIN OF SCREEN 500 AS WINDOW TITLE TIT,
    BEGIN OF LINE,
    PUSHBUTTON 2(10) BUT1 USER-COMMAND CLI1,
    PUSHBUTTON 12(10) TEXT-020 USER-COMMAND CLI2,
    END OF LINE,
    BEGIN OF LINE,
    PUSHBUTTON 2(10) BUT3 USER-COMMAND CLI3,
    PUSHBUTTON 12(10) TEXT-040 USER-COMMAND CLI4,
    END OF LINE,
    END OF SCREEN 500.
    AT SELECTION-SCREEN.
    CASE SSCRFIELDS.
    WHEN 'CLI1'.
    FLAG = '1'.
    WHEN 'CLI2'.
    FLAG = '2'.
    WHEN 'CLI3'.
    FLAG = '3'.
    WHEN 'CLI4'.
    FLAG = '4'.
    ENDCASE.
    START-OF-SELECTION.
    TIT = 'Four Buttons'.
    BUT1 = 'Button 1'.
    BUT3 = 'Button 3'.
    CALL SELECTION-SCREEN 500 STARTING AT 10 10.
    CASE FLAG.
    WHEN '1'.
    WRITE / 'Button 1 was clicked'.
    WHEN '2'.
    WRITE / 'Button 2 was clicked'.
    WHEN '3'.
    WRITE / 'Button 3 was clicked'.
    WHEN '4'.
    WRITE / 'Button 4 was clicked'.
    WHEN OTHERS.
    WRITE / 'No Button was clicked'.
    ENDCASE.
    This example defines four pushbuttons on a selection screen that is displayed as a
    dialog box. The selection screen is defined in a statement chain for keyword
    SELECTION-SCREEN.
    If the text symbols TEXT-020 and TEXT-040 are defined as 'Button 2' and 'Button 4',
    the four pushbuttons appear as follows on the selection screen displayed as a dialog box.
    Regards,
    Bhaskar

  • Error during creation of push button on selection screen

    Hi,
    I wanted to create push buttons on selection screen,
    Code:
    DATA DB1 TYPE VBAP-WERKS.
    DATA DB2 TYPE MARA-MATNR.
    SELECT-OPTIONS : SPLANT FOR DB1,
                                    SCLASS FOR DB2.
    SELECTION-SCREEN:  FUNCTION KEY 1,
                                        FUNCTION KEY 2,
                                        FUNCTION KEY 3.
    INITIALIZATION.
    DATA FUNCTXT TYPE SMP_DYNTXT.
    CLEAR FUNCTXT.
    DATA: FUNCTXT_01 TYPE SSCRFIELDS-FUNCTXT_01.
    FUNCTXT-TEXT = 'DEL'.
    SSCRFIELDS-FUNCTXT_01 = FUNCTXT.
    CLEAR FUNCTXT.
    FUNCTXT-TEXT = 'EDIT'.
    SSCRFIELDS-FUNCTXT_02 = FUNCTXT.
    CLEAR FUNCTXT.
    FUNCTXT-TEXT = 'CRE'.
    SSCRFIELDS-FUNCTXT_03 = FUNCTXT.
    But during activating, I'm getting the error as : Field "SSCRFIELDS-FUNCTXT_01" is unknown. It is neither in one of the specified tables nor defined by "DATA" statement.
    Please suggest solutions to overcome this error.
    Regards
    Darshan MS

    Hi,
    trans. for examples of selection screen : BIBS
    regards
    Fred

  • Creating push button on Selection screen application toolbar

    Hi Friends,
    this is a HR-ABAP report. I have to create a push button on Selection screen. when user clicks on that push button 'MODAL DIALOG BOX' has to be displayed containing some data.
    plz kindly give some sample code to do this.
    Regards,
    Radhika Dasharatha.

    Hi,
    1)Use SELECTION-SCREEN  PUSHBUTTON /10(20) PUSH USER-
      COMMAND 'ABC'. in selection screen.
    2) Give the static name to button in INITIALIZATION event like PUSH = 'PRESS'.
    3) At selection screen.
      if sy-ucomm eq 'ABC'.
    call FM HR_BE_GE_MODAL_DIALOG
    endif.
    Thanks
    Sandeep
    Reward if useful

  • Push button on selection screen

    Hi,
    I have provided push button on selection screen after input fields I mean just below to input fields by using the syntax selection screen pushbutton…..   And it is appearing on the selection screen.  As per the requirement I need to enter material number on the selection screen and if I press corresponding push button I need to call one transaction using bdc program.  I wrote case sy-comm and corresponding user command ( whatever is there in the selection screen syntax) in when condition under start of selection event.
    But the control is not going to that place after I press push button. If I put that code inside of at selection screen it is going. But I can not write all the bdc program and select queries inside of at selection screen event if so please suggest me how I can proceed.
    I will give the points.
    Thanks a lot in advance.

    Hi,
    SELECTION-SCREEN BEGIN OF BLOCK b_2 WITH FRAME TITLE text-018.
    SELECT-OPTIONS s_fields FOR qpmk-mkmnr NO-DISPLAY.
    SELECTION-SCREEN PUSHBUTTON /1(24) name USER-COMMAND flds.
    SELECTION-SCREEN END OF BLOCK b_2.
    AT SELECTION-SCREEN.
    IF sscrfields-ucomm = 'FLDS'.
        PERFORM display_fields.
      ENDIF.

  • Display output list by pressing a push button on selection screen.

    Hi All,
    Is there any possibility of displaying the output list by pressing a push button on the selection screen.
    Thanks,
    Neslin.

    Hi,
    Just write the code like this
    Case sy-ucomm.
    when 'PRE'.
    Here write the output list
    " leave to list-processing. Write this statement
    endcase.
    Regards
    Sarves

  • Radio button in selection screen and push button

    Hi experts,
    I want to give radio button in selection screen side by side.
    how we can do this on slection screen.
    secondly i want to resize push button on selection screen.
    please provide me the exact solution.
    thanks
    babbal

    Hi babbal,
    For Your Requriment yo can go to tcode se51 & then give ur program name & give screen number as 1000 because 1000 is default screen for all the programs and in se51 Press Layout button & then you can make changes to the Selection screen according to your requriment
    Hope it will be Helpfull.......!!
    Thanks & Regards,
    Bhushan

  • Command Button on selection screen application tool bar

    Hi All,
    I want to add command Button on selection screen application bar.
    it is my z progarm .
    please suggest one sample code .
    regards,
    Ajay reddy

    Goto SE41, create a Status and the call it in your app.
    SET PF-STATUS 'TEST'.
    Greetings,
    Blag.

  • Button in selection screen

    Hello Gurus ,
    I want to insert data from selection screen into my ztable , I have activated save button in menu bar , with function text SAVE and function type , E , S ,  null , H , P all I have tesated , but it is not working , with case sy-ucomm , when 'SAVE' .
    In same way Print is working but not save .I am not getting the prob .
    Is there any problem , plz help me , I m in hurry .
    I am waiting for  all of your valuable reply .
    Regards,
    Joy .

    Hi Joy,
    Check out the below related threads for placing the push buttons ... Frame logic accordingly as per your requirement ..
    push button in selecion screen
    Push button on selection screen
    push button on selection screen\
    PUSH Button in Selection Screen

  • How to add push buttons in out put screen of ALV

    Hai,
    How to add push buttons in out put screen of ALV (tool bar) with out using classes or methods .I want to know using normal ALV .
    Thanks in advance .
    kiran

    Hi Kiran,
    Here is the sample code.If you are using reuse_alv_grid_display, no need to write code in PBO.
    Just double click the 'TEST' which is written in code.Then create a GUI Status.In Application toolbar,type the name of the button you want(say BUTTON).Then double click that name.Then enter the ICON name and function text.Activate it.This itself will work.If you want all the functionalities,then try to do as Vinod told.
    TYPE-POOLS: slis.
    DATA: i_qmel LIKE qmel OCCURS 0.
    data v_repid type repid.
    SELECT * FROM qmel INTO TABLE i_qmel.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = v_repid
       I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
       i_structure_name                  = 'QMEL'
      TABLES
        t_outtab                          = i_qmel
      EXCEPTIONS
        program_error                     = 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.
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status '<b>TEST</b>'.
    endform.
    FORM user_command USING ucomm LIKE sy-ucomm
                             selfield TYPE slis_selfield.
    data lv_ucomm type sy-ucomm.
    lv_ucomm
    = sy-ucomm.                                        
      CASE lv_ucomm.
        WHEN 'BUTTON'.                              "Double Click line Item
          call transaction 'MM01'.
      endcase.
    endform.

  • Add a button on normal screen ?

    hi,
    what's the screen for showing the content of ' write' statement,  and i want to add a button on this screen, how ?
    thanks

    Hi Zhang,
    Please refer this code from help.sap.com
    TABLES sscrfields.
    TYPE-POOLS icon.
    SELECTION-SCREEN:
      BEGIN OF SCREEN 500 AS WINDOW TITLE title,
        PUSHBUTTON 2(10)  but1 USER-COMMAND cli1,
        PUSHBUTTON 12(30) but2 USER-COMMAND cli2
                               VISIBLE LENGTH 10,
      END OF SCREEN 500.
    AT SELECTION-SCREEN.
      CASE sscrfields.
        WHEN 'CLI1'.
        WHEN 'CLI2'.
      ENDCASE.
    START-OF-SELECTION.
      title  = 'Push button'.
      but1 = 'Button 1'.
      CALL FUNCTION 'ICON_CREATE'
        EXPORTING
          name   = icon_information
          text   = 'Button 2'
          info   = 'My Quickinfo'
        IMPORTING
          RESULT = but2
        EXCEPTIONS
          OTHERS = 0.
      CALL SELECTION-SCREEN '0500' STARTING AT 10 10.
    Reward points if useful.
    Regards,
    Atish

  • How to add push button in function module

    I want to add Push button( yes/no) in same screen. I used POPUP_TO_CONFIRM,
    but this popup is coming on next screen when I click on cancel button.

    There is no scope to create a push button in application tool bar. Instead of that we can add in a menu bar.

  • How to add push button in alv display with out class or method

    Hai,
    How to add push buttons in out put screen of ALV (tool bar) with out using classes or methods .I want to know using normal ALV .
    Thanks in advance .
    kiran

    You should post your question in the ABAP forum.
    ABAP Development

  • Custom button at selection screen toolbar

    Hi All,
    I have a requirement to add button at selection screen toolbar. Once this button was hit another program should be called.
    Do you have any idea on how to do this. Appreciate your help.
    Thanks in advance.

    Hi,
    To add custom Button to your selection screen see the below example-
    TABLES: SSCRFIELDS.
    TYPE-POOLS ICON.
    PARAMETERS: p_bukrs TYPE bukrs.
    INITIALIZATION:
      V_FUNCTXT-ICON_ID = ICON_XXX.                          " Add Icon to button if you want.
      V_FUNCTXT-QUICKINFO = 'xxxx'.                            " Text to be displayed when you hover mouse over the button
      V_FUNCTXT-ICON_TEXT = 'yyyy'.                           " Text to be dsipalyed on button.
      SSCRFIELDS-FUNCTXT_01 = V_FUNCTXT.
    AT SELECTION-SCREEN.
      CASE SSCRFIELDS-UCOMM.
        WHEN 'FC01'.                                                           " Handle the click on button. By default this function code will be
    to your
          "Your logic
      ENDCASE.

  • How to print the Module pool screen using a push button in the screen

    Hi Every one,
                         i have developed a module program , which have a selection screen and it display the output in a structured way.
    output includes boxes, texts etc...
    my problem is :---
    How to print the Module pool screen using a push button in the screen.

    When the "Print" button is pressed:
    leave to list-processing and return to screen 100.  "(current screen)
    Call a transaction that runs your print program.
    Rob

Maybe you are looking for

  • Minimize and Maximize are missing

    I now have 2 users who have been using Acrobat version 7.1 for at least a year each and for some reason the minimize and maximize buttons have disappeared.  They are visible on the main program window but they are not visible on the file window.  I h

  • Session or Cookies

    I'm creating a Forum for a society, What's better sessions? or cookies? Cookies seem to be secure enough, but might I get in trouble if someone sets a browser to disable cookies? Octavian

  • Playlists, songs not displaying on nano

    I am unable to see any new playlist or song in my iPod nano. I just purchased a 4GB black nano, installed iTunes 5.01. To try it out, I purchased 1 album and 3 individual songs. iTunes created a playlist called "Purchased". All songs were downloaded

  • Issue logging to infoview after siteminder webagent re-registration

    Hi All, We are on BOXIR2 SP5 ,IIS.We have configured Siteminder in our environment. We have recenty re-registered the webagent in our boxi server,we did as we moved the policy stores location to new LDAP server. Now when we login to infoview we get "

  • What inheritance mapping strategy would you use here, if any?

    [Scenario] I have a somewhat unusual problem. I have a set of entities, like Movie, Book etc. that all inherit Item class and that are perfectly identical in their structure (as none of them has any specific fields on it's own). They all have Id, Nam