Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

static popup

Former Member
0 Likes
1,668

Hello,

I need to create a static popup, meaning, a popup that can remain/be reduced, etc.. as we continue in the window from which it was started...

How can I accomplish this?

Thanks,

Tim

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
1,530

Hi Tim,

what you want is a GUI control - the only way of popup that does not disable the rest.

try this form to display the contents of any (text) table:


* ...
data:
  go_dialogbox                            type ref to cl_gui_dialogbox_container,
  go_editor                               type ref to cl_gui_textedit.

* ...

*&---------------------------------------------------------------------*
*&      Form  showcontent
*&---------------------------------------------------------------------*
*       Anzeige im Control
*----------------------------------------------------------------------*
form showcontent  using    pt_data        type table.
  if go_dialogbox is initial.
    create object go_dialogbox
       exporting
         width                            = 800
         height                           = 300
         top                              = 50
         left                             = 100
         caption
           = 'Close Window to end Display'.
    set handler lcl_event_receiver=>close for go_dialogbox.
  endif." go_dialogbox is initial.

  if go_editor is initial.
    create object go_editor
      exporting
        parent                            = go_dialogbox
        wordwrap_mode                     =
cl_gui_textedit=>wordwrap_off
        wordwrap_to_linebreak_mode        = cl_gui_textedit=>true.
  endif.
  call method go_editor->set_toolbar_mode
    exporting
      toolbar_mode                        = go_editor->true.

  call method go_editor->set_statusbar_mode
    exporting
      statusbar_mode                      = go_editor->true.
* Set edit mode
  call method go_editor->set_readonly_mode.
*   send table to control
*  call method go_editor->set_font_fixed
*    exporting
*      mode                                = cl_gui_textedit=>true.
  call method go_editor->set_text_as_r3table
    exporting
      table                               = pt_data.
* set focus
  call method go_dialogbox->set_focus
    exporting
      control                             = go_editor.
endform.                    " showcontent

Regards,

Clemens

13 REPLIES 13
Read only

Clemenss
Active Contributor
0 Likes
1,531

Hi Tim,

what you want is a GUI control - the only way of popup that does not disable the rest.

try this form to display the contents of any (text) table:


* ...
data:
  go_dialogbox                            type ref to cl_gui_dialogbox_container,
  go_editor                               type ref to cl_gui_textedit.

* ...

*&---------------------------------------------------------------------*
*&      Form  showcontent
*&---------------------------------------------------------------------*
*       Anzeige im Control
*----------------------------------------------------------------------*
form showcontent  using    pt_data        type table.
  if go_dialogbox is initial.
    create object go_dialogbox
       exporting
         width                            = 800
         height                           = 300
         top                              = 50
         left                             = 100
         caption
           = 'Close Window to end Display'.
    set handler lcl_event_receiver=>close for go_dialogbox.
  endif." go_dialogbox is initial.

  if go_editor is initial.
    create object go_editor
      exporting
        parent                            = go_dialogbox
        wordwrap_mode                     =
cl_gui_textedit=>wordwrap_off
        wordwrap_to_linebreak_mode        = cl_gui_textedit=>true.
  endif.
  call method go_editor->set_toolbar_mode
    exporting
      toolbar_mode                        = go_editor->true.

  call method go_editor->set_statusbar_mode
    exporting
      statusbar_mode                      = go_editor->true.
* Set edit mode
  call method go_editor->set_readonly_mode.
*   send table to control
*  call method go_editor->set_font_fixed
*    exporting
*      mode                                = cl_gui_textedit=>true.
  call method go_editor->set_text_as_r3table
    exporting
      table                               = pt_data.
* set focus
  call method go_dialogbox->set_focus
    exporting
      control                             = go_editor.
endform.                    " showcontent

Regards,

Clemens

Read only

Former Member
0 Likes
1,530

Thanks for your suggestion...

I am in the midst of testing your code, and nothing appears... I did have one issue concerning the following line :

set handler lcl_event_receiver=>close for go_dialogbox.

I had to comment it out because of the following compilation error :

<b>The type "LCL_EVENT_RECEIVER=>CLOSE" is unknown.</b>

Any ideas as to why??

Thanks again,

Tim

Read only

Clemenss
Active Contributor
0 Likes
1,530

Hi Tim,

sorry - I forgot to post something important - although it does not explain the behavior:


*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class lcl_event_receiver definition.
  public section.
    class-methods:
      close
        for event close
        of cl_gui_dialogbox_container.
endclass.                    "lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class lcl_event_receiver implementation.
  method close.
    call method go_editor->free.
    free go_editor.
    call method go_dialogbox->free.
    free go_dialogbox.
* finally flush
    call method cl_gui_cfw=>flush
      exceptions
        others                            = 1.
  endmethod." close
endclass.                    "lcl_event_receiver IMPLEMENTATION

Try this. If it doesn't help, we will tra again...


Regards,

Clemens

Read only

Clemenss
Active Contributor
0 Likes
1,530

Hi Ti,

I tried on our system.

The popup needs an active screen from where to start. May be that was missing in your try.

I tried this sample program which works fine:


*&---------------------------------------------------------------------*
*& Report  ZZZTEST                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  zzztest                       .

PARAMETERS:
  p_text80 TYPE text80 DEFAULT 'test the popup'.

DATA:
  go_dialogbox                            TYPE REF TO
cl_gui_dialogbox_container,
  go_editor                               TYPE REF TO cl_gui_textedit,
  gt_text80 TYPE TABLE OF text80.

APPEND p_text80 TO gt_text80.

AT SELECTION-SCREEN ON p_text80.
  IF NOT sy-datar IS INITIAL.
    append p_text80 to gt_text80.
    PERFORM showcontent USING gt_text80.
  ENDIF.
*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      close
        FOR EVENT close
        OF cl_gui_dialogbox_container.
ENDCLASS.                    "lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD close.
    CALL METHOD go_editor->free.
    FREE go_editor.
    CALL METHOD go_dialogbox->free.
    FREE go_dialogbox.
* finally flush
    CALL METHOD cl_gui_cfw=>flush
      EXCEPTIONS
        OTHERS                            = 1.
  ENDMETHOD." close
ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION


* ...

*&---------------------------------------------------------------------*
*&      Form  showcontent
*&---------------------------------------------------------------------*
*       Anzeige im Control
*----------------------------------------------------------------------*
FORM showcontent  USING    pt_data        TYPE table.
  IF go_dialogbox IS INITIAL.
    CREATE OBJECT go_dialogbox
       EXPORTING
         width                            = 800
         height                           = 300
         top                              = 50
         left                             = 100
         caption
           = 'Close Window to end Display'.
    SET HANDLER lcl_event_receiver=>close FOR go_dialogbox.
  ENDIF." go_dialogbox is initial.

  IF go_editor IS INITIAL.
    CREATE OBJECT go_editor
      EXPORTING
        parent                            = go_dialogbox
        wordwrap_mode                     =
cl_gui_textedit=>wordwrap_off
        wordwrap_to_linebreak_mode        = cl_gui_textedit=>true.
  ENDIF.
  CALL METHOD go_editor->set_toolbar_mode
    EXPORTING
      toolbar_mode                        = go_editor->true.

  CALL METHOD go_editor->set_statusbar_mode
    EXPORTING
      statusbar_mode                      = go_editor->true.
* Set edit mode
  CALL METHOD go_editor->set_readonly_mode.
*   send table to control
*  call method go_editor->set_font_fixed
*    exporting
*      mode                                = cl_gui_textedit=>true.
  CALL METHOD go_editor->set_text_as_r3table
    EXPORTING
      table                               = pt_data.
* set focus
  CALL METHOD go_dialogbox->set_focus
    EXPORTING
      control                             = go_editor.
ENDFORM.                    " showcontent

You may modify to your needs.

Regards,

Clemens

Read only

Former Member
0 Likes
1,530

Hello again

I added the two classes, but still nothing happens... I debugged and sure enough the code is executed, but with no result.... I supplied a table with data, so thats not the problem. It seems maybe there is no 'display_data' call ... ??...

ANy ideas?

Thanks again,

Tim

Read only

Clemenss
Active Contributor
0 Likes
1,530

... see above.

If the problem persists, post your complete code.

Regards,

Clemens

Read only

Former Member
0 Likes
1,530

No, still doesnt work... when I execute from the selection screen nothing happens.

I see that <b>sy-datar</b> is empty, so i tested without the <b>If/Endif</b> and still nothing .... anyway, here's my code :

REPORT  ztest_tim2.                      .

PARAMETERS:
  p_text80 TYPE text80 DEFAULT 'test the popup'.

DATA:
  go_dialogbox                            TYPE REF TO
cl_gui_dialogbox_container,
  go_editor                               TYPE REF TO cl_gui_textedit,
  gt_text80 TYPE TABLE OF text80.

APPEND p_text80 TO gt_text80.

AT SELECTION-SCREEN ON p_text80.
  IF NOT sy-datar IS INITIAL.
    APPEND p_text80 TO gt_text80.
    PERFORM showcontent USING gt_text80.
  ENDIF.
*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      close
        FOR EVENT close
        OF cl_gui_dialogbox_container.
ENDCLASS.                    "lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*       CLASS lcl_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD close.
    CALL METHOD go_editor->free.
    FREE go_editor.
    CALL METHOD go_dialogbox->free.
    FREE go_dialogbox.
* finally flush
    CALL METHOD cl_gui_cfw=>flush
      EXCEPTIONS
        OTHERS = 1.
  ENDMETHOD." close
ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION


* ...

*&---------------------------------------------------------------------*
*&      Form  showcontent
*&---------------------------------------------------------------------*
*       Anzeige im Control
*----------------------------------------------------------------------*
FORM showcontent  USING    pt_data        TYPE table.
  IF go_dialogbox IS INITIAL.
    CREATE OBJECT go_dialogbox
      EXPORTING
        width   = 800
        height  = 300
        top     = 50
        left    = 100
        caption = 'Close Window to end Display'.
    SET HANDLER lcl_event_receiver=>close FOR go_dialogbox.
  ENDIF." go_dialogbox is initial.

  IF go_editor IS INITIAL.
    CREATE OBJECT go_editor
      EXPORTING
        parent                     = go_dialogbox
        wordwrap_mode              = cl_gui_textedit=>wordwrap_off
        wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
  ENDIF.
  CALL METHOD go_editor->set_toolbar_mode
    EXPORTING
      toolbar_mode = go_editor->true.

  CALL METHOD go_editor->set_statusbar_mode
    EXPORTING
      statusbar_mode = go_editor->true.
* Set edit mode
  CALL METHOD go_editor->set_readonly_mode.
*   send table to control
*  call method go_editor->set_font_fixed
*    exporting
*      mode                                = cl_gui_textedit=>true.
  CALL METHOD go_editor->set_text_as_r3table
    EXPORTING
      table = pt_data.
* set focus
  CALL METHOD go_dialogbox->set_focus
    EXPORTING
      control = go_editor.
ENDFORM.                    " showcontent

Thanks for any insight...

Tim

Read only

Clemenss
Active Contributor
0 Likes
1,530

Hi Tim,

I just trued your code: Whenever I hit Enter, the popup comes up. The SY-DATAR registers any changes in the input field. So the popup comes only after a change in the field has been done AND enter has been pressed.

Don't try with F8 because this will leave the screen and the popup has no base where to start from (all GUI controls are placed in or started from an existing screen).

What is your version? I tried on R/3 Release 4.6C, but it works in all later releases the same way. I know for sure because I use a test program unchanged since nearly 5 years using this technology.

Regards,

Clemens

Read only

0 Likes
1,530

Clemens,

Thanks for nice code

a®

Read only

Former Member
0 Likes
1,530

Ah yes... it works ....

Thanks for the solution.

One thought, I need to implement this from within a BADI (for an action button in CRM)... will this work? Or does it only work with enter upon a select parameter??

Thanks,

Tim

Read only

Clemenss
Active Contributor
0 Likes
1,530

Hi Tim,

it works with any event which is triggered during screen processing. If your BADI is triggered during screen processing, it should work. Check your situation and try.

I remember (not too clear) I played araound with the controls a while ago. Youn may call a static minimized screen and use it as popup base. Not nice but working. Honestly said: I don't know.

Regards,

Clemens

Read only

Former Member
0 Likes
1,530

Hi again,

I've implemented the popup with the code you supplied and it works nicely...thanks alot!

The last thing I want to do (and don't find exactly how to do) is to find the method in CL_GUI_CONTROL which allows me to re-expand (bring back up) the window if the user has minimized it... any idea? (I tried SET_POSITION... and it brings the window back up, but in minimized size... no in the original.)

Thanks,

Tim

Read only

Clemenss
Active Contributor
0 Likes
1,530

Hi Tim,

sorry I don't know. Nothing is documented by SAP -:(

Tried SET_ALIGNMENT?

Regards,

Clemens

P.S.: Let me know if you find out