2017 Apr 28 11:09 AM
Hi all.
I have two custom containers in my dynpro. One named CC_YES the other named CC_NO.
I want to display both at the same time with different HTML code.
But, I dont know why, I can show only one at the same time.
If I comment the code of one HTML container the other is displayed and viceversa, but with both at the same time doesnt work.
Do you know what can be the problem? is it necessary to add something in my HTML code?

This is a simplified code to see the problem:
REPORT ztest_html.
START-OF-SELECTION.
DATA:
html TYPE string.
DATA:
lo_container_yes TYPE REF TO cl_gui_custom_container,
lo_container_no TYPE REF TO cl_gui_custom_container.
CALL SCREEN 2000.
*&---------------------------------------------------------------------*
*& Module STATUS_2000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_2000 OUTPUT.
SET PF-STATUS 'STATUS'.
CHECK lo_container_yes IS INITIAL.
*
html = '<HTML><body style="background-color:#ff0000;margin-top:0px;overflow:hidden;"><p>yes</p></BODY></HTML>'.
CREATE OBJECT lo_container_yes
EXPORTING
container_name = 'CC_YES'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
RETURN.
ENDIF.
cl_abap_browser=>show_html(
html_string = html
context_menu = abap_true
modal = abap_false
container = lo_container_yes
check_html = abap_false ).
html = '<HTML><body style="background-color:#ff0000;margin-top:0px;overflow:hidden;"><p>No</p></BODY></HTML>'.
CREATE OBJECT lo_container_no
EXPORTING
container_name = 'CC_NO'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
RETURN.
ENDIF.
cl_abap_browser=>show_html(
html_string = html
context_menu = abap_true
modal = abap_false
container = lo_container_no
check_html = abap_false ).
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_2000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_2000 INPUT.
IF sy-ucomm EQ 'BACK'.
LEAVE TO SCREEN 0 .
ENDIF.
ENDMODULE.
2017 Apr 28 11:29 AM
How about instantiated 2 cl_gui_html_viewers in each container rather than using static methods.
Rich
Hi all.
I have two custom containers in my dynpro. One named CC_YES the other named CC_NO.
I want to display both at the same time with different HTML code.
But, I dont know why, I can show only one at the same time.
If I comment the code of one HTML container the other is displayed and viceversa, but with both at the same time doesnt work.
Do you know what can be the problem? is it necessary to add something in my HTML code?

This is a simplified code to see the problem:
REPORT ztest_html.
START-OF-SELECTION.
DATA:
html TYPE string.
DATA:
lo_container_yes TYPE REF TO cl_gui_custom_container,
lo_container_no TYPE REF TO cl_gui_custom_container.
CALL SCREEN 2000.
*&---------------------------------------------------------------------*
*& Module STATUS_2000 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_2000 OUTPUT.
SET PF-STATUS 'STATUS'.
CHECK lo_container_yes IS INITIAL.
*
html = '<HTML><body style="background-color:#ff0000;margin-top:0px;overflow:hidden;"><p>yes</p></BODY></HTML>'.
CREATE OBJECT lo_container_yes
EXPORTING
container_name = 'CC_YES'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
RETURN.
ENDIF.
cl_abap_browser=>show_html(
html_string = html
context_menu = abap_true
modal = abap_false
container = lo_container_yes
check_html = abap_false ).
html = '<HTML><body style="background-color:#ff0000;margin-top:0px;overflow:hidden;"><p>No</p></BODY></HTML>'.
CREATE OBJECT lo_container_no
EXPORTING
container_name = 'CC_NO'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
RETURN.
ENDIF.
cl_abap_browser=>show_html(
html_string = html
context_menu = abap_true
modal = abap_false
container = lo_container_no
check_html = abap_false ).
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_2000 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_2000 INPUT.
IF sy-ucomm EQ 'BACK'.
LEAVE TO SCREEN 0 .
ENDIF.
ENDMODULE.
2017 Apr 28 11:29 AM
How about instantiated 2 cl_gui_html_viewers in each container rather than using static methods.
Rich
2017 Apr 28 12:02 PM
Ok, I've never used these classes... I've just copied some standard demo.
You are right, with cl_gui_html_viewer works fine.
2017 Apr 28 9:15 PM
2017 Apr 29 9:45 AM
CL_ABAP_BROWSER is a wrapper for cl_gui_html_viewer for simple use cases only. It belongs to the infrastructure of the ABAP keyword documentation and was originally planned for the needs of that package only. For advanced use cases, you have to use the CFW classes itself.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |