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

ABAP - Split container with dynamic heading

Former Member
0 Likes
1,745

Hi All,

I created a 2 custom containers one for Heading and the other for displaying data as below . For displaying the header content I created a reference variable HEAD1 of the class CL_DD_DOCUMENT. Later i build the content of the content of the header using method ADD_TABLE and displayed the header using MERGE and DISPLAY_DOCUMENT and placed in the custom container HEADING1.

Now my issue is i want to change the content of the header dynamically based on the PUSH button but using the same code. Means i want to display different content inthe header when i toggle a push button in the previous screen .I even refreshed the reference varaible once i come back ftom this screen. But the content is not getting refreshed. I am making a major mistake somewhere. Please help to corect this.

  HEADING1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

  CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER,

  HEAD1 TYPE REF TO CL_DD_DOCUMENT,

 

  CALL METHOD HEAD1->ADD_TABLE

  CALL METHOD HEAD1->MERGE_DOCUMENT.
 

  CALL METHOD HEAD1->DISPLAY_DOCUMENT
      EXPORTING
        CONTAINER = 'HEADING1'.

Regards

Siva.

1 REPLY 1
Read only

0 Likes
941

Hi Siva,

I had exactly the same situation today in the morning and I have done 2 mistakes.

a.) If you use the coding inside an own class method you have to declare the head1 as an class attribute and not inside the method as a local object reference

The coding for this part in my method is now:

   IF mr_dd_document IS NOT BOUND.
    CREATE OBJECT mr_dd_document.
  ELSE.
    mr_dd_document->initialize_document( ).
  ENDIF.

  ....... "here is then the coding to add a table, put in text, icons, pictures and so on

"and finally
 
CALL METHOD mr_dd_document->MERGE_DOCUMENT.
  CALL METHOD mr_dd_document->DISPLAY_DOCUMENT
      EXPORTING
        CONTAINER = 'HEADING1'.

 

b.) that the above coding works also for a refresh I had to change the coding with
     additionial the EXPORTING parameter reuse_control = 'X'

     (I call my method in the same way independend if it is for first display or a refresh and I store the  container inside the class attribute mr_container )

    "merge the new document
  CALL METHOD mr_dd_document->merge_document.
  lv_container_nam = mr_container->get_name( ).
  lv_container_name = lv_container_nam.
  "display the new document in the container
  CALL METHOD mr_dd_document->display_document
    EXPORTING
      reuse_control      = 'X'
      reuse_registration = 'X'
      container          = lv_container_name
      parent             = mr_container
    EXCEPTIONS
      html_display_error = 1.