‎2007 Nov 08 12:49 PM
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
‎2007 Nov 08 1:25 PM
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
‎2007 Nov 08 1:25 PM
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
‎2007 Nov 08 3:06 PM
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
‎2007 Nov 08 3:11 PM
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
‎2007 Nov 08 3:26 PM
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
‎2007 Nov 08 3:31 PM
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
‎2007 Nov 08 3:35 PM
... see above.
If the problem persists, post your complete code.
Regards,
Clemens
‎2007 Nov 08 3:47 PM
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. " showcontentThanks for any insight...
Tim
‎2007 Nov 08 4:05 PM
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
‎2007 Nov 08 4:10 PM
‎2007 Nov 08 4:15 PM
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
‎2007 Nov 08 4:23 PM
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
‎2007 Nov 12 11:03 AM
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
‎2007 Nov 12 11:25 AM
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