Skip to Content
author's profile photo Former Member
Former Member

Dynamic Dynpro

Hi guys,

i need a suggestion how to realize this in dynpro:

+--------------------------------------------------+
|                     [button]                     |
+--------------------------------------------------+
|                         |                        |
|      grid 1             |          grid 2        |
|                         |                        |
+--------------------------------------------------+

The two grids are in a splitter container.

The CustomControl of the splitter is set to "resizeing enabled (x and y)".

Now i want the button to be in center of the screen (on top of splitter).

If i use the Screen Painter i can only create buttons with fixed position...

...or is it possible to create a button in the splitter container between the two grids??

Thank you for helping!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jun 27, 2007 at 05:59 PM

    Ok, I think you can do this using a picture control instead of

    the toolbar. You can set up some event handlers for the picture, so

    that when the user clicks on it you can do something, just like

    and icon. For example of this, see program sap_picture_demo_icon.

    Here is the modified code of the program from before, this time, it

    is a picture control with an icon in the middle. Again, all you need

    in your screen 100, is a custom container with the same name as before.

    report zrich_0001 .
    
    type-pools: icon.
    
    data: custom           type ref to cl_gui_custom_container,
          sub_cont_top     type ref to cl_gui_container,
          sub_cont_bot     type ref to cl_gui_container,
          splitter_tb      type ref to cl_gui_splitter_container,
          sub_cont_l       type ref to cl_gui_container,
          sub_cont_r       type ref to cl_gui_container,
          splitter_lr      type ref to cl_gui_splitter_container,
          gui_picture      type ref to cl_gui_picture.
    
    call screen 100.
    *&---------------------------------------------------------------------
    *
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------
    *
    *       text
    *----------------------------------------------------------------------
    *
    module status_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
    
      create object custom
                exporting container_name = 'CUSTOM_CONTAINER'.
    
      create object splitter_tb
                    exporting parent = custom
                              rows    = 2
                              columns = 1.
    
      call method:
    
                 splitter_tb->get_container
                    exporting row            = 1
                              column         = 1
                              receiving container = sub_cont_top,
    
                  splitter_tb->set_row_height
                    exporting id             = 1
                              height         = '4',
    
                  splitter_tb->get_container
                    exporting row            = 2
                              column         = 1
                              receiving container = sub_cont_bot.
    
    
      create object gui_picture
                exporting
                      parent             = sub_cont_top.
    
      call method gui_picture->set_display_mode
        exporting
          display_mode = cl_gui_picture=>display_mode_normal_center.
    
      data: icon(4) type c.
      write icon_green_light as icon to icon.
    
      call method gui_picture->load_picture_from_sap_icons
                 exporting
                       icon = icon.
    
      create object splitter_lr
                    exporting parent = sub_cont_bot
                              rows    = 1
                              columns = 2.
    
      call method:
                     splitter_lr->get_container
                       exporting row            = 1
                                 column         = 1
                                 receiving container = sub_cont_l,
    
                     splitter_lr->get_container
                       exporting row            = 1
                                 column         = 2
                                 receiving container = sub_cont_r.
    
    
    
    
    endmodule.                 " STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------
    *
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------
    module user_command_0100 input.
    
      case sy-ucomm.
        when 'BACK'.
          leave program.
      endcase.
    
    endmodule.                 " USER_COMMAND_0100  INPUT

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 27, 2007 at 04:32 PM

    Hi Benjamin,

    I dont see any possiblity of changing the button position at runtime. But I can suggest an weird trick.

    You can create multiple buttons on the screen with the same function code. Store the centre position co-ordinates of each button in an internal table. when the user re-sizes the custom control, you can activate/diaplay the button which matches most with the center of the control. All the other buttons to be in disable/invisible mode.

    Just a idea out of the blue. May be this helps you.

    Regards,

    Prabhas.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 27, 2007 at 05:09 PM

    Check out this sample program, just create screen 100, and add a custom container called "CUSTOM_CONTAINER". THen cut/paste the code. You will see that this container is split from top to buttom, and then the bottom is split left to right. You can then implement the toolbar inside the top split, but at the moment I am having trouble with centerizing the button.

    
    
    report zrich_0001 .
    
    type-pools: icon.
    
    data: custom           type ref to cl_gui_custom_container,
          sub_cont_top     type ref to cl_gui_container,
          sub_cont_bot     type ref to cl_gui_container,
          splitter_tb      type ref to cl_gui_splitter_container,
          sub_cont_l       type ref to cl_gui_container,
          sub_cont_r       type ref to cl_gui_container,
          splitter_lr      type ref to cl_gui_splitter_container,
          gui_tb           type ref to cl_gui_toolbar.
    
    call screen 100.
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    module status_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
    
      create object custom
                exporting container_name = 'CUSTOM_CONTAINER'.
    
      create object splitter_tb
                    exporting parent = custom
                              rows    = 2
                              columns = 1.
    
      call method:
    
                 splitter_tb->get_container
                    exporting row            = 1
                              column         = 1
                              receiving container = sub_cont_top,
    
                  splitter_tb->set_row_height
                    exporting id             = 1
                              height         = '4',
    
                  splitter_tb->get_container
                    exporting row            = 2
                              column         = 1
                              receiving container = sub_cont_bot.
    
    
      create object gui_tb
                exporting
                      parent             = sub_cont_top.
    
      call method gui_tb->add_button
            exporting
               fcode            = 'REFRESH'
                  icon          = icon_refresh
                  butn_type     = '0'
                  text          = ' Refresh'.
    
    
      create object splitter_lr
                    exporting parent = sub_cont_bot
                              rows    = 1
                              columns = 2.
    
      call method:
                     splitter_lr->get_container
                       exporting row            = 1
                                 column         = 1
                                 receiving container = sub_cont_l,
    
                     splitter_lr->get_container
                       exporting row            = 1
                                 column         = 2
                                 receiving container = sub_cont_r.
    
    
    
    
    endmodule.                 " STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    module user_command_0100 input.
    
      leave program.
    
    endmodule.                 " USER_COMMAND_0100  INPUT
    

    Regards,

    RIch Heilman

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.