Expand/collapse button functionality on module pool screen

Hi ,
I want to design a module pool screen with a expand/collapse button on it.
The desired functionality associated with this button would be something similiar to that available in ME21N screen. When the expand button is clicked it should open up a section of screen that allows the user to enter some parameter. Based on this parameter some selections from DB can be perfomed and then displayed below it.
Any pointers on how to achieve this? Any kind of help would be appreciated.
Regards-
Harmeet Singh.

example for three pushbutton with expand collapse .
First of all define your push button as output field with icon tick in the pushbutton characteristick,
then define this pushbutton in top_include
include <icon>.
data : push_a1 like icons-l4,
         push_a2 like icons-l4,
         push_a3 like icons-l4.
data : a1 ,
         a2,
         a3.
in pai of the screen
suppose i had assign function code a1 ,a2 , a3 for repective pushbutton
module user_command_9002 input.
  okcd = ok_code.
  clear ok_code.
  case okcd.
    when 'A1'.
      if a1 is initial.
        a1 = 'X'.
      else.
        clear a1.
      endif.
    when 'A2'.
      if a2 is initial.
        a2 = 'X'.
      else.
        clear a2.
      endif.
    when 'A3'.
      if a3 is initial.
        a3 = 'X'.
      else.
        clear a3.
      endif.
  endcase.
endmodule.                 " USER_COMMAND_9002  INPUT
define three seprate screen -group for three pushbutton say a1 a2 a3
during pbo you can directly assign name of icon .
if a1 is initial.
    push_a1 = icon_collapse.
  else.
    push_a1 = icon_expand.
  endif.
  if a2 is initial.
    push_a2 = icon_collapse.
  else.
    push_a2 = icon_expand.
  endif.
  if a3 is initial.
    push_a3 = icon_collapse.
  else.
    push_a3 = icon_expand.
  endif.
loop at screen.
    if screen-group1 = 'A1'.
      if a1 = 'X'.
        screen-invisible = 1.
        screen-input = 0.
        modify screen.
      else.
        screen-active = 1.
        screen-invisible = 0.
        screen-input = 1.
      endif.
    elseif screen-group1 = 'A2'.
      if a2 = 'X'.
        screen-invisible = 1.
        screen-input = 0.
        modify screen.
      else.
        screen-active = 1.
        screen-invisible = 0.
        screen-input = 1.
      endif.
    elseif screen-group1 = 'A3'.
      if a3 = 'X'.
        screen-invisible = 1.
        screen-input = 0.
        modify screen.
      else.
        screen-active = 1.
        screen-invisible = 0.
        screen-input = 1.
      endif.
    endif.
  endloop.
regards,
Alpesh
Edited by: Alpesh on May 28, 2009 10:28 AM

Similar Messages

  • Creating buttons dynamically in module pool screen

    Hi friends,
    I have one screen .
    It has two input fields .
    Say : Sales order no & Bin no .
    based on this i found some batches from database table using select query .
    Now the number of buttons depends on the no of batches i found .
    If I get 5 batches , then I will create 5 Push Buttons on screen .
    Please let me know , How to create these buttons dynamically on screen .
    Regards ,
    Manoj

    Hey ,
    I tried using custom container and then a toolbar in it .
    But this toolbar create buttons either vertically OR horizonatally .
    I want buttons all over the screen to be created dynmically .
    Please help ...

  • How to add TAB functionality in module pool screen

    Hi,
    I have created a screen with two fields(input/output).My requirement is generally cursor is in the first field when user pressed TAB key then cursor has to move to second field.How can i fulfil this requirment.
    Thanks,
    shyla

    Hi,
    If u have created your input filed (Input/Output-Se51) field in screen layout then it will automatically jump to next input field when u press enter.
    Chk it out.

  • How to handle The Back button on Module Pool screen

    Hi Gurus,
                  I have created a module pool screen. In that screen I have used some input/output fields(text box) which i have marked mandatory by making the input field as "required" under program tab.
    now when running the screen if no data is entered into these mandatory input field then BACK button does not work. First I have to enter some data into the input filed only then the BACK button works. How should i code so that the back button works even without entering the data into these mandatory fields.

    hi,
    use AT EXIT-COMMAND with the module.
    eg. module user_command at exit command.
    then there will be no problem.

  • 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

  • Module pool / Screen Prog is there any standard SAP functionality ?

    Hi I am creating a Module pool / Screen Prog. On this screen I have nearly 100 fileds , now I want to take print out of all the information shown on the screen for the same is there any standard SAP functionality ?
    Does SAP provides any standarar ready made functionality for the same. ?

    No, there is no standard functionality for this.  dynpros are not designed to "print out".  This is what list displays are for.  That said, you will need to write your logic to kick off  a list display with all of your field values there,  then the user can print.
    Regards,
    Rich Heilman

  • Trigger a workflow from module pool screen at save button

    Hi,
    I am new to workflow.Please help me.My requirement is trigger a custom workflow from module pool screen at save button.
    Scenario is: Create a Z screen for material creation and after pressing save button workflow should trigger to approver and approver emailid should be fetch from Z table and have to provide a link in work flow for Z t-code which displays a report of material pending for approval..
    Please suggest me process how i can acheive this..
    Thanks

    Hi,
    If you're using standard bapi's to save the material, you can then use either the standard events which are already triggered or you coul add a change document for material changes or creation.
    Then this event can be the trigger of your custom workflow.
    Kind regards, Rob Dielemans

  • Expand/Collapse a block in a selection screen

    Hey Folks,
    I have a requirement , where I have a selection screen, with 3 selection blocks. I have a requirement that I need to make 2 of these blocks expandible/collapsible on the toggle of a button.. How can this be achieved.
    In case of a normal screen, I would have had to create the blocks as subscreens (one type of screen for expanded state...another for collapsed state) and called it from the main screen. But how do I achieve the same using the selection screens?
    I was considering creating the blocks as subscreens in the selection screen and calling them in the PBO of the main selection screen. However, I am unsure if thats a wise thing to do since the screen is generated automatically in case of a selection screen and I do believe its not a good idea to manually alter it.
    Does anyone has any pointers on this?
    Thanks and Best Regards,
    Puja.

    Hi,
    I have modified the code to show the expand/collapse ICON accordingly..Please check..
    TABLES sscrfields.
    TYPE-POOLS icon.
    * Expand/collapse buttons.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 2(23)  b1 USER-COMMAND usr1.
    SELECTION-SCREEN END OF LINE.
    * Block 1
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    PARAMETERS: p_test1 TYPE char10  MODIF ID m1,
                p_test2 TYPE char10  MODIF ID m1.
    SELECT-OPTIONS  s_date  FOR sy-datum MODIF ID m1.
    SELECTION-SCREEN END OF BLOCK b1.
    * Block 2
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 2(23)  b2 USER-COMMAND usr2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF BLOCK b2.
    PARAMETERS: p_test3 TYPE char10  MODIF ID m2,
                p_test4 TYPE char10  MODIF ID m2.
    SELECTION-SCREEN END OF BLOCK b2.
    * Declarations
    DATA: v_flag, v_flag1.
    INITIALIZATION.
      b1 = 'Button1'.
      b2 = 'Button2'.
      v_flag = 'X'.
      v_flag1 = 'X'.
    AT SELECTION-SCREEN.
    * Check the user command.
      IF sy-ucomm = 'USR1'.
        IF v_flag IS INITIAL.
          v_flag = 'X'.
        ELSE.
          CLEAR v_flag.
        ENDIF.
      ELSEIF sy-ucomm = 'USR2'.
        IF v_flag1 IS INITIAL.
          v_flag1 = 'X'.
        ELSE.
          CLEAR v_flag1.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN OUTPUT.
      IF v_flag1 = 'X'.
        CALL FUNCTION 'ICON_CREATE'
          EXPORTING
            name   = icon_expand
            text   = 'Button 2'
            info   = 'Button 2'
          IMPORTING
            RESULT = b2
          EXCEPTIONS
            OTHERS = 0.
      ELSEIF v_flag1 IS INITIAL.
        CALL FUNCTION 'ICON_CREATE'
          EXPORTING
            name   = icon_collapse
            text   = 'Button 2'
            info   = 'Button 2'
          IMPORTING
            RESULT = b2
          EXCEPTIONS
            OTHERS = 0.
      ENDIF.
      IF v_flag = 'X'.
        CALL FUNCTION 'ICON_CREATE'
          EXPORTING
            name   = icon_expand
            text   = 'Button 1'
            info   = 'Button 1'
          IMPORTING
            RESULT = b1
          EXCEPTIONS
            OTHERS = 0.
      ELSEIF v_flag IS INITIAL.
        CALL FUNCTION 'ICON_CREATE'
          EXPORTING
            name   = icon_collapse
            text   = 'Button 1'
            info   = 'Button 1'
          IMPORTING
            RESULT = b1
          EXCEPTIONS
            OTHERS = 0.
      ENDIF.
      LOOP AT SCREEN.
    * Expand collapse block1
        IF v_flag = 'X' AND screen-group1 = 'M1'.
          screen-active = 0.
        ELSEIF v_flag IS INITIAL AND screen-group1 = 'M1'.
          screen-active = 1.
        ENDIF.
    * Expand collapse block2
        IF v_flag1 = 'X' AND screen-group1 = 'M2'.
          screen-active = 0.
        ELSEIF v_flag1 IS INITIAL AND screen-group1 = 'M2'.
          screen-active = 1.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    Thanks
    Naren

  • How to do ICON_EXPAND and ICON_COLLAPSE input fields in module pool screen?

    hi frnds.
    My problem is in module pool screen how to do ICON_EXPAND and ICON_COLLAPSE input fields in module pool screen?And how to do GUI STATUS and GUI TITLE? IN SE80.
      ITS URGENT.POINTS WILL BE REWADED.THANKS  IN ADVANCE.

    Hi,
    Go through this thread.
    [expand and collapse|expand and collapse]
    Cheers,
    Simha.

  • Getting select options in module pool screen

    hi experts,
    can any one suggest me how to provide select options in module pool screen.
    thank you,
    regards
    vijay

    Hi,
    Take two fields on screen first for low value and other for high value (say vbeln_low and vbeln_high) also design a button next to the high textbox for select-option button used to display popup.
    Using these two input fields append a range (say r_vbeln for vbap-vbeln) for the field to be used (either in query or anywhere).
    ranges : r_vbeln for vbap-vbeln.
      IF NOT vbeln_high IS INITIAL.
        IF NOT vbeln_low LE vbeln_high.
          MESSAGE e899 WITH text-007. "high value is smaller than low value
        ENDIF.
      ENDIF.
      r_vbeln-sign = 'I'.
      r_vbeln-low = vbeln_low.
      IF vbeln_high IS INITIAL.
        r_vbeln-option = 'EQ'. "if user takes only a singlr value
      ELSE.
        r_vbeln-option = 'BT'. "if user takes both low & high value
        r_vbeln-high = vbeln_high.
      ENDIF.
      APPEND r_vbeln. "append range
      CLEAR r_vbeln.
    On the button click call this FM to call a popup for select-options.
    DATA : tab TYPE rstabfield.
    tab-tablename = 'VBAP'.
    tab-fieldname = 'VBELN'.
      CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
       EXPORTING
         title                   = text-002
         text                    = ' '
         signed                  = 'X'
    *         lower_case              = ' '
    *         no_interval_check       = ' '
    *         just_display            = ' '
    *         just_incl               = ' '
    *         excluded_options        =
    *         description             =
    *         help_field              =
    *         search_help             =
         tab_and_field           = tab
        TABLES
          range                   = r_vbeln
       EXCEPTIONS
         no_range_tab            = 1
         cancelled               = 2
         internal_error          = 3
         invalid_fieldname       = 4
         OTHERS                  = 5.
      IF sy-subrc EQ 2.
        MESSAGE s899 WITH text-003. "no value selected
      ELSEIF sy-subrc <> 0 AND sy-subrc <> 2.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    This whole code will append your range r_vbeln to be used in program.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • Regarding exit from the module pool screen

    h experts,
    i have developed a module pool report in which in the selection screen i have four fields which are mandatory ,when i execute the program without entering in the selection screen it do not allow to come out of the module pool screen ...what i want that without entering any input in the selection screen if i press exit button push button it will allow to come out of the screen for this what sud i do plz help me....

    Hi
    keep a button called <b>EXIT</b> on the screen
    Make the function type of that field as <b>E</b>
    in Flow logic write
    PROCESS AFTER INPUT.
    Forced Exit from the transaction from screen
      MODULE exit AT EXIT-COMMAND.
    double click on exit module and
    then in PAI write
    *&      Module  exit  INPUT
    Exit from the Transaction
    MODULE exit INPUT.
      CASE okcode.
        WHEN 'EXIT' OR 'CANCEL'.
          CLEAR okcode.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " exit  INPUT
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Variants for module pool screena

    Hi,
    I tried creating a variant for module pool screen by using the FM : RS_CREATE_VARIANT.
    For this i created a dummy report which has the same parameters as the fields in the screen.
    CALL FUNCTION 'RS_VARIANT_CONTENTS'
            EXPORTING
              report                      = gc_dummy_rep
              variant                     = 'variant5'
            MOVE_OR_WRITE               = 'W'
            NO_IMPORT                   = ' '
            EXECUTE_DIRECT              = ' '
          IMPORTING
            SP                          =
            tables
            L_PARAMS                    =
            L_PARAMS_NONV               =
            L_SELOP                     =
            L_SELOP_NONV                =
              valutab                     = lt_params
            OBJECTS                     =
            FREE_SELECTIONS_DESC        =
            FREE_SELECTIONS_VALUE       =
          EXCEPTIONS
            VARIANT_NON_EXISTENT        = 1
            VARIANT_OBSOLETE            = 2
            OTHERS                      = 3
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    but when i try to retrieve the values stored in the variant using FM : RS_VARIANT_CONTENTS.
    CALL FUNCTION 'RS_VARIANT_CONTENTS'
            EXPORTING
              report                      = gc_dummy_rep
              variant                     = 'variant5'
            MOVE_OR_WRITE               = 'W'
            NO_IMPORT                   = ' '
            EXECUTE_DIRECT              = ' '
          IMPORTING
            SP                          =
            tables
            L_PARAMS                    =
            L_PARAMS_NONV               =
            L_SELOP                     =
            L_SELOP_NONV                =
              valutab                     = lt_params
            OBJECTS                     =
            FREE_SELECTIONS_DESC        =
            FREE_SELECTIONS_VALUE       =
          EXCEPTIONS
            VARIANT_NON_EXISTENT        = 1
            VARIANT_OBSOLETE            = 2
            OTHERS                      = 3
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    I get an error message : variant5 not found.
    is there anything that i miss here?
    or is the way i use to create variant for module pool screen not right?
    Regards,
    Kamini

    Hi,
    To avail save variant option in module pool screen,
    1. You need to create a data base table similar to INDX table with the fields RELID, VARI_NAME
    PROG_NAME
    UNAME
    SRTF2, MEMORYID, CLUSTR,  CLUSID. And the remaining fields can be anything.
    2. Enable the Save button in the Function keys part of GUI Status. And Add a push button for Get variant.
    3. When Save button clicked call a screen with a single field for variant (let us say g_var). After g_var entered, in the PAI of the initial screen export all the screen values to the created database index using the statement .
                         EXPORT: g_characteristics_tab TO DATABASE zav0257(ch) ID g_var,
                                       s_auart TO DATABASE zav0257(au) ID g_var.
                         So that the values will be exported to database.
                         Then update the fields(VARI_NAME,PROG_NAME,UNAME) of  the database table using modify from work area. 
                         So that you will have the history of variance existence.
    4. Next time , when the user clicks on Get Variant option, call another screen to enter the variant name. Then import the values for that variant from the memory id in the database table.
    It worked for me.

  • How to use table maintenance view in module pool screen

    hi ,
    want to use table maintenance view in a module pool screen so that i can edit, insert, delete and update date in to the ztable.please help.

    You can simply call it via SM30.   Or you can call the table maintence view from any program(report or module pool) using a function module.
      call function 'VIEW_MAINTENANCE_CALL'
           exporting
                action                       = 'U'
                view_name                    = 'Z_Table_Name'
           exceptions
                client_reference             = 1
                foreign_lock                 = 2
                invalid_action               = 3
                no_clientindependent_auth    = 4
                no_database_function         = 5
                no_editor_function           = 6
                no_show_auth                 = 7
                no_tvdir_entry               = 8
                no_upd_auth                  = 9
                only_show_allowed            = 10
                system_failure               = 11
                unknown_field_in_dba_sellist = 12
                view_not_found               = 13
                others                       = 14.
    Regards,
    RIch Heilman

  • How to insert tabstrip control in module pool screen painter

    Hi all!
    plz tell e how to use tabstrip control in module pool screen painter.Also plz give me an example program using tabstrip control.

    To insert tabstrip just open layout of screen and press on the tabstrip button there .
    Use this souce code further to activate it .
    CONTROLS tabstrip TYPE TABSTRIP.
    DATA: okcode TYPE sy-ucomm,
    dynnr TYPE sy-dynnr,
    flag type flag,
    active like tabstrip-activetab .
    call SCREEN 100.
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE USER_COMMAND_0100 INPUT.
    data: lv_okcode type syucomm.
    lv_okcode = okcode.
    clear okcode.
    case lv_okcode.
    WHEN 'TAB1'.
    dynnr = '0110'.
    WHEN 'TAB2'.
    dynnr = '0120'.
    WHEN 'TAB3'.
    dynnr = '0130'.
    WHEN 'TAB4'.
    dynnr = '0140'.
    WHEN 'TAB5'.
    "check authorization, if authorization fails
    flag = 'X'. "set the global flag
    active = 'TAB1'. "store active tab in global variable
    dynnr = '0110'. "set the screen number
    WHEN 'BACK' or 'EXIT'.
    leave program.
    ENDCASE.
    IF lv_okcode(3) = 'TAB'.
    tabstrip-activetab = lv_okcode.
    ENDIF.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module STATUS_0100 OUTPUT
    text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'MAIN'.
    SET TITLEBAR 'xxx'.
    IF tabstrip-activetab IS INITIAL OR
    dynnr IS INITIAL.
    tabstrip-activetab = 'TAB1'.
    dynnr = '0110'.
    ENDIF.
    "set the activetab explicilty here
    if flag eq 'X'. "from authorization failure
    tabstrip-activetab = active. "'TAB1'
    clear flag.
    endif.
    ENDMODULE. " STATUS_0100 OUTPUT

  • How to add logo in module pool screen

    Hi Expert,
    I need to display company logo in the module pool screen
    how this can be added ?
    Regards
    Bikas

    Hi,
    create a custom control called 'CUSTOM_CONTROL'
    CONSTANTS: CNTL_TRUE  TYPE I VALUE 1,
          CNTL_FALSE type i value 0.
    data:h_picture       type ref to cl_gui_picture,
         h_pic_container type ref to cl_gui_custom_container.
    data: graphic_url(255),
          graphic_refresh(1),
          g_result like cntl_true.
    data: begin of graphic_table occurs 0,
            line(255) type x,
          end of graphic_table.
    data: graphic_size type i.
    data: g_stxbmaps type STXBITMAPS,
          l_bytecnt  type i,
          l_content   TYPE  standard table of bapiconten initial size 0.
    g_stxbmaps-tdobject = 'GRAPHICS'.
    g_stxbmaps-tdname = 'ENJOY'.
    g_stxbmaps-tdid = 'BMAP'.
    g_stxbmaps-tdbtype = 'BMON'. 
    call function 'SAPSCRIPT_GET_GRAPHIC_BDS'
         exporting
              i_object       = g_stxbmaps-tdobject
              i_name         = g_stxbmaps-tdname
              i_id           = g_stxbmaps-tdid
              i_btype        = g_stxbmaps-tdbtype
         importing
              e_bytecount    = l_bytecnt
         tables
              content        = l_content
         exceptions
              not_found      = 1
              bds_get_failed = 2
              bds_no_content = 3
              others         = 4.
    call function 'SAPSCRIPT_CONVERT_BITMAP'
         exporting
              old_format               = 'BDS'
              new_format               = 'BMP'
              bitmap_file_bytecount_in = l_bytecnt
         importing
              bitmap_file_bytecount  = graphic_size
         tables
              bds_bitmap_file        = l_content
              bitmap_file            = graphic_table
         exceptions
              others                 = 1.
    call function 'DP_CREATE_URL'
         exporting
            type                 = 'image'           
            subtype              = cndp_sap_tab_unknown
            size                 = graphic_size
            lifetime             = cndp_lifetime_transaction
         tables
            data                 = graphic_table
         changing
            url                  = graphic_url
         exceptions
            others               = 4 .
    create object h_pic_container
           exporting container_name =  'CUSTOM_CONTROL'.
    create object h_picture exporting parent = h_pic_container.
    call method h_picture->set_display_mode
         exporting
              display_mode = cl_gui_picture=>display_mode_normal.
    call method h_picture->load_picture_from_url
         exporting url    = graphic_url
         importing result = g_result.
    or you can check the program RSDEMO_CUSTOM_CONTROL
    check link :
    How to insert Image on Screen
    thanks
    Parvathi

Maybe you are looking for