Skip to Content
0

CL_DD_DOCUMENT Refresh Issue

Feb 01 at 05:56 AM

183

avatar image

I am using CL_DD_DOCUMENT header to display text.

if user select operation 10, I want to display operation 10 in the display text.

if user select operation 20, I want to display operation 20 in the display text.

But its not getting refresh!! its only displaying first variable only.

I am passing parameters as desired,

ALL METHOD o_dyndoc_id->display_document
EXPORTING
reuse_control = 'X'
container = 'o_cont_topt
EXCEPTIONS

html_display_error = 1.

Regards

Sas

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Sandra Rossi Feb 01 at 08:39 AM
0

There are 2 solutions:

1st proposition: REUSE_CONTROL = 'X' is the right way to do it, but also make sure you don't re-create O_DYNDOC_ID (if two active controls occupy the same container, only the first one is displayed). Do a debug on method DISPLAY_DOCUMENT to make sure the control is not created every time.

2nd proposition: Or use the method FREE of the container every time you leave/reload the screen (it will free the HTML control), but it may be more complex to do.

Show 10 Share
10 |10000 characters needed characters left characters exceeded

Thanks Alot Rossi, So here I am not using any HTML I am using the header text to display the data, I want to data text to be changed when ever I called this piece, but its not refreshing, here is the sample code, let me know how to refresh the container. and also I dont have anything in the containter text, ( there are 4 containers, 2 for header text and 2 for alvs), the second one header text I want to change based on the first alv input action.

DATA:go_dd_otxt2 TYPE REF TO cl_dd_document,

CREATE OBJECT go_dd_otxt2.

LV_TEXT = 'Components'.

go_dd_otxt2->add_text_as_heading(
EXPORTING
heading_level = 2
text = lv_text ).

CALL METHOD go_dd_otxt2->display_document
EXPORTING
reuse_control = 'X'
reuse_registration = 'X'
container = 'C_OTXT2'
* parent =
EXCEPTIONS
html_display_error = 1
others = 2
.
IF sy-subrc <> 0.
ENDIF.
Let me know if anything else to be done, in code i am passing lv_text some runtime value, but its only displaying the existing one(i.e. first one).

0

Sorry, I wasn't clear. The Dynamic Documents are a wrapper of the HTML Viewer.

See this standalone example which refreshes the HTML Viewer with the current time, at each "Enter" ... it creates DD only once (my 1st proposition) :

REPORT.
DATA: go_docking TYPE REF TO cl_gui_docking_container,
      dd TYPE REF TO cl_dd_document.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
  IF go_docking IS INITIAL.
    CREATE OBJECT go_docking
      EXPORTING
        repid     = sy-repid
        dynnr     = sy-dynnr
        side      = cl_gui_docking_container=>dock_at_left
        extension = 180.
    CREATE OBJECT dd.
  ENDIF.
  dd->initialize_document( ).
  dd->add_text( text = |{ sy-uzeit }| ).
  dd->display_document( parent = go_docking reuse_control = abap_true ).

.

1

Thanks alot Sandra Rossy, I gone through your code, its a great example ....but I just like to add on my req pls,

I have a plain custom container in screen painter, I named it as C_OTXT2.

I am expecting this text to be dynamic. there is a alv with fields, I have hotspot assigned to one of the field, when I click the alv, this text need to be displayed accordingly below ALV.

But as I said the text is not changing dynamically.

DATA:go_dd_otxt2 TYPE REF TO cl_dd_document,

CREATE OBJECT go_dd_otxt2.

LV_TEXT = 'Components'.

go_dd_otxt2->add_text_as_heading(
EXPORTING
heading_level = 2
text = lv_text ).

CALL METHOD go_dd_otxt2->display_document
EXPORTING
reuse_control = 'X'
reuse_registration = 'X'
container = 'C_OTXT2'
* parent =
EXCEPTIONS
html_display_error = 1
others = 2
.

0

Did I tell you that you should not create the DD control again if you did not free the previous one, because if two active controls occupy the same container, only the previous one is displayed.

Can't you spend a little time to see why my very small but complete code works, and not yours.

Maybe it will help you if I give you the code which DOES NOT work. My opinion is that yours has the same issue:

REPORT.
DATA: go_docking TYPE REF TO cl_gui_docking_container,
      dd TYPE REF TO cl_dd_document.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
  IF go_docking IS INITIAL.
    CREATE OBJECT go_docking
      EXPORTING
        repid     = sy-repid
        dynnr     = sy-dynnr
        side      = cl_gui_docking_container=>dock_at_left
        extension = 180.
  ENDIF.
  CREATE OBJECT dd. " <=== See, I create the DD control every time,
                    "      but I didn't FREE the previous one, so it doesn't SEEM to refresh
  dd->initialize_document( ).
  dd->add_text( text = |{ sy-uzeit }| ).
  dd->display_document( parent = go_docking reuse_control = abap_true ).
1

And this code works by freeing the previous DD control (my 2nd proposition):

REPORT.
DATA: go_docking TYPE REF TO cl_gui_docking_container,
      dd TYPE REF TO cl_dd_document.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
  IF dd IS BOUND.
    go_docking->free( ). " Free the container and its inner controls (DD)
    CLEAR go_docking.    " clear it, so that it's created again in next step
  ENDIF.
  IF go_docking IS INITIAL.
    CREATE OBJECT go_docking
      EXPORTING
        repid     = sy-repid
        dynnr     = sy-dynnr
        side      = cl_gui_docking_container=>dock_at_left
        extension = 180.
  ENDIF.
  CREATE OBJECT dd.
  dd->initialize_document( ).
  dd->add_text( text = |{ sy-uzeit }| ).
  dd->display_document( parent = go_docking reuse_control = abap_true ).
1

Thanks alot for spending your valuable time in explaining, but

I see your code if perfectly working,but I am wondering is that because you are using the docking container and referring the display_document to parent = docking not referring to container = 'Container name' ?

IF dd IS BOUND.
    go_docking->free( ). " Free the container and its inner controls (DD)
    CLEAR go_docking.    " clear it, so that it's created again in next step
  ENDIF.

I am not going to free docking as I dont have , but is there away to free the container DD?

you are using the program, I am using the dynpro is that making the difference? again thanks alot.

Regards

Sas

1

So here is the sample code, where you can probably copy for one time and see why its not working, thanks.

1) In program.

REPORT YTEST_SANDBOX.
START-OF-SELECTION.
call screen 100.
INCLUDE ytest_sandbxo_user_command_i01.

2) In Screen painter ( I.E. in call 100):

Take a container and a button, Name the container as 'ABCD' and button as 'NRCT'.

3) in PAI,

please copy below code.

MODULE user_command_0100 INPUT.
case sy-ucomm.
when 'NRCT'.


DATA:go_dd_otxt2 TYPE REF TO cl_dd_document.
FREE GO_DD_OTXT2.
CREATE OBJECT go_dd_otxt2.
go_dd_otxt2->add_text( text = |{ sy-uzeit }| ).
CALL METHOD go_dd_otxt2->display_document
EXPORTING
reuse_control = 'X'
reuse_registration = 'X'
container = 'ABCD'
* parent =
EXCEPTIONS
html_display_error = 1
others = 2 .
ENDCASE.

ENDMODULE.

Even though I am pressing button many times, still I see the text as is, its static only, let me know if there is any way to become dynamic, if we get changes done.

Regards

Sas

1

Well, dont treat me nasty :) !! I figured out!! Thanksssssss alottttttttttttttttt!! create object only one time is the trick.

MODULE user_command_0100 INPUT.

  CASE sy-ucomm.

    WHEN 'NRCT'.
     DATA:go_dd_otxt2 TYPE REF TO cl_dd_document.

      IF go_dd_otxt2 IS BOUND.

        go_dd_otxt2->initialize_document( ).

      ENDIF.

      IF go_dd_otxt2 IS NOT BOUND.

      CREATE OBJECT go_dd_otxt2.

      ENDIF.

      go_dd_otxt2->add_text( text = |{ sy-uzeit }| ).

      CALL METHOD go_dd_otxt2->display_document

        EXPORTING

          reuse_control      = 'X'

*          reuse_registration = 'X'

          container          = 'ABCD'

*         parent             =

        EXCEPTIONS

          html_display_error = 1

          OTHERS             = 2.

  ENDCASE.

ENDMODULE.
1

Well done! :)

1

Thanks, and initializing document is also must :) !! along with reuse_control = 'X'!!

~ to those who see this thread in future :) !!

Regards

Sas

1
Krishna Murthy Feb 03 at 07:21 AM
0

hi,

i have got same problem, for my problem i have solved differently

that is

1. clear object of container of document display.

2. create document for every time for refresh

3. again create container object.

4. use that created container object for document display

like that i have solved my problem

Share
10 |10000 characters needed characters left characters exceeded