Application Development 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: 

Title for multiple container

alhanouf94
Discoverer
0 Kudos

I have a splitter container that generates 4 alv report

i need to add title above each alv report like attached file down (green layout)

down is my code and pic of output of my report

MODULE status_9000 OUTPUT.

 
  SET PF-STATUS 'COLLECTION_SYSTEM'.
  SET TITLEBAR 'COLLECTION_SYSTEM'.


  CREATE OBJECT container
    EXPORTING
      container_name = 'CONTAINER'."Pass name of container created in Screen no 9000


*splitting the main container into 1 row & 2 coloum
  CREATE OBJECT splitter_1
    EXPORTING
      parent  = container
      rows    = 1
      columns = 2.


*getting the reference for the splited container (row 1 & col 1 container)
  CALL METHOD splitter_1->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = container_1.


*splitting the 1nd coloum container in to 2 rows & 1 coloum*
  CREATE OBJECT splitter_3
    EXPORTING
      parent  = container_1
      rows    = 2
      columns = 1.


*getting the reference for the splited container (row 1 & col 2 container)
  CALL METHOD splitter_3->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = container_1.

*getting the reference for the splited container (row 1 & col 2 container)
  CALL METHOD splitter_3->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = container_4.




*getting the reference for the splited container (row 1 & col 2 container)
  CALL METHOD splitter_1->get_container
    EXPORTING
      row       = 1
      column    = 2
    RECEIVING
      container = container_2.


*splitting the 2nd coloum container in to 2 rows & 1 coloum*
  CREATE ObJECT splitter_2
    EXPORTING
      parent  = container_2
      rows    = 2
      columns = 1.


*getting the reference for the splited container2 (row 1 & col 2 container)*
  CALL METHOD splitter_2->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = container_2.

*getting the reference for the splited container2 (row 2 & col 1 container)
  CALL METHOD splitter_2->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = container_3.



*POPULATING THE FIELD CATALOG.
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'KUNNR'.
  wa_fcat-ref_table = 'ZSD_CBALANCE'.
  wa_fcat-ref_field = 'KUNNR'.
  wa_fcat-col_pos = 1.
  APPEND wa_fcat TO t_fcat.
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'PLAN_DATE'.
  wa_fcat-ref_table = 'ZSD_CBALANCE'.
  wa_fcat-ref_field = 'PLAN_DATE'.
  wa_fcat-col_pos = 2.
  APPEND wa_fcat TO t_fcat.
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'ACTUAL_DATE'.
  wa_fcat-ref_table = 'ZSD_CBALANCE'.
  wa_fcat-ref_field = 'ACTUAL_DATE'.
  wa_fcat-col_pos = 3.
  APPEND wa_fcat TO t_fcat.
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'WEEK'.
  wa_fcat-ref_table = 'ZSD_CBALANCE'.
  wa_fcat-ref_field = 'WEEK'.
  wa_fcat-col_pos = 4.
  APPEND wa_fcat TO t_fcat.
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'CODE'.
  wa_fcat-ref_table = 'ZSD_CBALANCE'.
  wa_fcat-ref_field = 'CODE'.
  wa_fcat-col_pos = 5.
  APPEND wa_fcat TO t_fcat.
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'ZCOMMENT'.
  wa_fcat-ref_table = 'ZSD_CBALANCE'.
  wa_fcat-ref_field = 'ZCOMMENT'.
  wa_fcat-col_pos = 6.
  APPEND wa_fcat TO t_fcat.
  CLEAR wa_fcat.
  wa_fcat-fieldname = 'HOMEWORK'.
  wa_fcat-ref_table = 'ZSD_CBALANCE'.
  wa_fcat-ref_field = 'HOMEWORK'.
  wa_fcat-col_pos = 7.
  APPEND wa_fcat TO t_fcat.
  CLEAR wa_fcat.


*populating first internal table to the container
  CREATE OBJECT container
    EXPORTING
      container_name = g_container.
  CREATE OBJECT grid1
    EXPORTING
      i_parent = container_1.
  CALL METHOD grid1->set_table_for_first_display
*    EXPORTING
*       it_fieldcatalog = 'ZSD_CBALANCE'
    CHANGING
       it_fieldcatalog = t_fcat
      it_outtab        = it_zsd_cbalance .

*populating second internal table
  CREATE OBJECT container
    EXPORTING
      container_name = g_container.
  CREATE OBJECT grid2
    EXPORTING
      i_parent = container_2.
  CALL METHOD grid2->set_table_for_first_display
*    EXPORTING
*      i_structure_name = 'ZSD_CBALANCE'
    CHANGING
       it_fieldcatalog = t_fcat
      it_outtab        = it_zsd_cbalance .
*populating third internal table
  CREATE OBJECT container
    EXPORTING
      container_name = g_container.
  CREATE OBJECT grid3
    EXPORTING
      i_parent = container_3.
  CALL METHOD grid3->set_table_for_first_display
*    EXPORTING
*      i_structure_name = 'ZSD_CBALANCE'
    CHANGING
      it_fieldcatalog = t_fcat
      it_outtab        = it_zsd_cbalance .
*populating fourth internal table
  CREATE OBJECT grid4
    EXPORTING
      i_parent = container_4.
  CALL METHOD grid4->set_table_for_first_display
*    EXPORTING
*      i_structure_name = 'ZSD_CBALANCE'
    CHANGING
      it_fieldcatalog = t_fcat
      it_outtab        = it_zsd_cbalance .
endmoudle.
   
4 REPLIES 4

alhanouf94
Discoverer
0 Kudos

this is how i'm expecting my output with header

alhanouf94
Discoverer
0 Kudos



  CREATE OBJECT container

    EXPORTING

      container_name = 'CONTAINER'."Pass name of container created in Screen no 9000





*splitting the main container into 1 row & 2 coloum

  CREATE OBJECT splitter_1

    EXPORTING

      parent  = container

      rows    = 1

      columns = 2.









*getting the reference for the splited container (row 1 & col 1 container)

  CALL METHOD splitter_1->get_container

    EXPORTING

      row       = 1

      column    = 1

    RECEIVING

      container = container_1.







*splitting the 1nd coloum container in to 2 rows & 1 coloum*

  CREATE OBJECT splitter_3

    EXPORTING

      parent  = container_1

      rows    = 2

      columns = 1.



*getting the reference for the splited container (row 1 & col 2 container)

  CALL METHOD splitter_3->get_container

    EXPORTING

      row       = 1

      column    = 1

    RECEIVING

      container = container_1.





*getting the reference for the splited container (row 1 & col 2 container)

  CALL METHOD splitter_3->get_container

    EXPORTING

      row       = 2

      column    = 1

    RECEIVING

      container = container_4.







*getting the reference for the splited container (row 1 & col 2 container)

  CALL METHOD splitter_1->get_container

    EXPORTING

      row       = 1

      column    = 2

    RECEIVING

      container = container_2.







*splitting the 2nd coloum container in to 2 rows & 1 coloum*

  CREATE OBJECT splitter_2

    EXPORTING

      parent  = container_2

      rows    = 2

      columns = 1.



*getting the reference for the splited container2 (row 1 & col 2 container)*

  CALL METHOD splitter_2->get_container

    EXPORTING

      row       = 1

      column    = 1

    RECEIVING

      container = container_2.

*getting the reference for the splited container2 (row 2 & col 1 container)

  CALL METHOD splitter_2->get_container

    EXPORTING

      row       = 2

      column    = 1

    RECEIVING

      container = container_3.







  cl_salv_table=>factory(

EXPORTING

r_container = container_1

IMPORTING

r_salv_table = gr_table

CHANGING

t_table = it_zsd_cbalance

).



  cl_salv_table=>factory(

EXPORTING

r_container = container_2

IMPORTING

r_salv_table = gr_table1

CHANGING

t_table = it_zsd_cbalance

).



  cl_salv_table=>factory(

EXPORTING

r_container = container_4

IMPORTING

r_salv_table = gr_table2

CHANGING

t_table = it_ZSD_GENERAL_COMM

).



  cl_salv_table=>factory(

EXPORTING

r_container = container_3

IMPORTING

r_salv_table = gr_table3

CHANGING

t_table = it_zsd_cbalance

).


  "Titre 1

  gr_function = gr_table->get_functions( ).

  gr_function->set_all( abap_true ).

  gr_columns = gr_table->get_columns( ).

  gr_columns->set_optimize( c_col_x ).

  MOVE 'Balance Confirmation Comments' TO g_title.

  gr_display = gr_table->get_display_settings( ).

  gr_display->set_striped_pattern( if_salv_c_bool_sap=>true ).

  gr_display->set_list_header( g_title ).

  CALL METHOD gr_table->display.

  gr_function = gr_table1->get_functions( ).

  gr_function->set_all( abap_true ).

  gr_columns = gr_table1->get_columns( ).

  gr_columns->set_optimize( c_col_x ).



  "Title 2

  MOVE 'Missing Document Comments' TO g_title.

  gr_display = gr_table1->get_display_settings( ).

  gr_display->set_striped_pattern( if_salv_c_bool_sap=>true ).

  gr_display->set_list_header( g_title ).

  CALL METHOD gr_table1->display.

  gr_function = gr_table2->get_functions( ).

  gr_function->set_all( abap_true ).

  gr_columns = gr_table2->get_columns( ).

  gr_columns->set_optimize( c_col_x ).



  "Titre 3

  MOVE 'General Comments ' TO g_title.

  gr_display = gr_table2->get_display_settings( ).

  gr_display->set_striped_pattern( if_salv_c_bool_sap=>true ).

  gr_display->set_list_header( g_title ).

  CALL METHOD gr_table2->display.

  gr_function = gr_table3->get_functions( ).

  gr_function->set_all( abap_true ).

  gr_columns = gr_table3->get_columns( ).

  gr_columns->set_optimize( c_col_x ).



  "Titre



  MOVE 'Title4' TO g_title.

  gr_display = gr_table3->get_display_settings( ).

  gr_display->set_striped_pattern( if_salv_c_bool_sap=>true ).

  gr_display->set_list_header( g_title ).

  CALL METHOD gr_table3->display.









ENDMODULE.                 " STATUS_9000  OUTPUT

0 Kudos

solved ,,,

Sandra_Rossi
Active Contributor

TL;DR (excerpt of Alhanouf Alolayt answer)

gr_display = gr_salv_table->get_display_settings( ).
gr_display->set_list_header( 'Balance Confirmation Comments' ).

cf screenshot in Alhanouf Alolayt answer