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

Multiple Headers in ALV

Former Member
0 Likes
1,090

Hi,

I have a requirement where output result in ALV output shoud as below

-


Sr materila description numbers

-


Line a

-


1

2

3

-


Line b

-


1

2

3

-


Line c

-


1

2

3

4

-


Could you please help me?

Thanks,

Prashanth J R

8 REPLIES 8
Read only

Former Member
0 Likes
1,029

Hi,

A simple way is to define the field "LINE" as a subtotal and hide it. So, it will be show as a line. Dont forget to put the option subtotals on top.

Or use a ALV master-detail ( see alv_keyinfo).

Best regards,

Leandro Mengue

Read only

0 Likes
1,029

Could you please explain me in detail

Read only

Former Member
0 Likes
1,029

Hi,

Use Bolck ALV list.

Regards,

Amitava

Read only

Former Member
0 Likes
1,029

Hi

you can use spliiter to split teh output screen.

DATA: o_split TYPE REF TO cl_gui_easy_splitter_container.

  • Splitting the Docking container

CREATE OBJECT o_split

EXPORTING

parent = o_docking

sash_position = 80 "Position of Splitter Bar (in Percent)

with_border = 0. "With Border = 1 Without Border = 0

  • Placing the containers in the splitter

o_top_container = o_split->top_left_container .

o_bottom_container = o_split->bottom_right_container .

Regards,

Manju

Read only

Former Member
0 Likes
1,029

Hi,

You are using ALV GRID, LIST, or OO ?

Best regards,

Leandro Mengue

Read only

0 Likes
1,029

ALV GRID

Read only

0 Likes
1,029

Hi,

See an example with REUSE_ALV_HIERSEQ_LIST_DISPLAY:

...
  DATA:  alv_keyinfo   TYPE slis_keyinfo_alv.
  ...
  CLEAR alv_keyinfo.
  alv_keyinfo-header01 = 'STAND'.
  alv_keyinfo-item01   = 'STAND'.
  alv_keyinfo-header02 = 'ARBPL'.
  alv_keyinfo-item02   = 'ARBPL'.

 CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
      i_callback_program       = 'ZREPORT'
      i_callback_pf_status_set = 'SET_STATUS'
      is_layout                = alv_layout
      it_fieldcat              = alv_fieldcat
      it_sort                  = alv_sort
      i_save                   = 'A'
      it_events                = xevent[]
      i_tabname_header         = 'I_CAB'
      i_tabname_item           = 'I_DET'
      is_keyinfo               = alv_keyinfo
    TABLES
      t_outtab_header          = i_cab
      t_outtab_item            = i_det
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.

And other with ALV_GRID with subtotals:


* DATA_TAB must have a field WW_BLOCO (ex.: char 100)
* Fill WW_BLOCO with the name of subtotal that you want. And sort data_tab by ww_bloco ...
...
  ls_sort      TYPE   slis_sortinfo_alv,
  i_sort       TYPE   slis_t_sortinfo_alv.
...
  CLEAR ls_fieldcat.
  ls_fieldcat-fieldname     = 'WW_BLOCO'.
  ls_fieldcat-seltext_l     = ''.
  ls_fieldcat-no_out        = 'X'.
  APPEND ls_fieldcat TO p_fieldcat.
...
  ls_sort-fieldname = 'WW_BLOCO'.
  ls_sort-spos = 1.
  ls_sort-up = 'X'.
  ls_sort-expa = ''.
  ls_sort-subtot = 'X'.
  APPEND ls_sort TO i_sort.
...
  alv_layout-totals_before_items = 'X'.
...
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program               = 'ZREPORT'
            i_callback_user_command          = 'USER_COMMAND'
            i_callback_pf_status_set         = 'SET_STATUS'
            is_layout                        =  alv_layout
            it_fieldcat                      =  alv_fieldcat
            it_sort                          =  i_sort[]
            i_save                           = 'X'
*            it_events                        = xevent[]
            i_grid_title                     = w_titulo
       TABLES
             t_outtab                        = data_tab
       EXCEPTIONS
             program_error                   = 1
             OTHERS                          = 2.

Best regards,

Leandro Mengue

Read only

Former Member
0 Likes
1,029

CALL SCREEN 9000.


.

*&---------------------------------------------------------------------*

*&      Module  STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

MODULE status_9000 OUTPUT.

    SET PF-STATUS 'GUI_9000'.

   SET TITLEBAR  'TITLE_9000'.

   PERFORM f_create_splitter_1.

   PERFORM f_create_splitter_2.

   PERFORM f_display_grid1.

   PERFORM f_display_grid2.

   PERFORM f_display_grid3.

ENDMODULE.


*&---------------------------------------------------------------------*

*&      Form  F_CREATE_SPLITTER_1

*&---------------------------------------------------------------------*

FORM f_create_splitter_1 .

   CREATE OBJECT container

     EXPORTING

       container_name = 'CCONTAINER'.

   CREATE OBJECT splitter_1

     EXPORTING

       parent  = container

       rows    = 2

       columns = 1.

   CALL METHOD splitter_1->get_container

     EXPORTING

       row       = 1

       column    = 1

     RECEIVING

       container = container_1.

   CALL METHOD splitter_1->get_container

     EXPORTING

       row       = 2

       column    = 1

     RECEIVING

       container = container_2.

ENDFORM.


*&---------------------------------------------------------------------*

*&      Form  F_CREATE_SPLITTER_2

*&---------------------------------------------------------------------*

FORM f_create_splitter_2 .

   CREATE OBJECT splitter_2

     EXPORTING

       parent  = container_2

       rows    = 1

       columns = 2.

   CALL METHOD splitter_2->get_container

     EXPORTING

       row       = 1

       column    = 1

     RECEIVING

       container = container_2.

   CALL METHOD splitter_2->get_container

     EXPORTING

       row       = 1

       column    = 2

     RECEIVING

       container = container_3.

   CALL METHOD splitter_1->set_row_height

     EXPORTING

       id     = 1

       height = 35.

   CALL METHOD splitter_2->set_column_width

     EXPORTING

       id    = 1

       width = 70.

ENDFORM.


*&---------------------------------------------------------------------*

*&      Form  F_DISPLAY_GRID1

*&---------------------------------------------------------------------*

FORM f_display_grid1 .

   DATA : lt_fcat          TYPE lvc_t_fcat,

          wa_fcat          LIKE LINE OF lt_fcat,

          lt_fieldcat_slis TYPE slis_t_fieldcat_alv,

          wa_fieldcat_slis TYPE slis_fieldcat_alv,

          ls_layout        TYPE lvc_s_layo.

   REFRESH : lt_fcat, lt_fieldcat_slis.

   IF grid1 IS INITIAL.

     CREATE OBJECT grid1

       EXPORTING

         i_parent = container_1.

     CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

       EXPORTING

         i_program_name     = sy-repid

         i_internal_tabname = 'IT_ALV_1'

         i_inclname         = sy-repid

       CHANGING

         ct_fieldcat        = lt_fieldcat_slis.

     LOOP AT lt_fieldcat_slis INTO wa_fieldcat_slis.

       MOVE-CORRESPONDING wa_fieldcat_slis TO wa_fcat.

       wa_fcat-coltext   =

       wa_fcat-scrtext_l = wa_fieldcat_slis-seltext_l.

       wa_fcat-scrtext_m = wa_fieldcat_slis-seltext_m.

       wa_fcat-scrtext_s = wa_fieldcat_slis-seltext_s.

       IF wa_fcat-fieldname EQ 'TXT30'.

         wa_fcat-coltext   =

         wa_fcat-scrtext_l =

         wa_fcat-scrtext_m =

         wa_fcat-scrtext_s = 'Status'.

         wa_fcat-outputlen = 10.

       ENDIF.

       APPEND wa_fcat TO lt_fcat.

     ENDLOOP.

     CLEAR : ls_layout.

     ls_layout-zebra      = 'X'.

     ls_layout-cwidth_opt = 'X'.

     ls_layout-smalltitle = '1'.

     ls_layout-grid_title = '*****'.

     CALL METHOD grid1->set_table_for_first_display

       EXPORTING

         is_layout       = ls_layout

       CHANGING

         it_fieldcatalog = lt_fcat

         it_outtab       = it_alv_1[].

   ELSE.

     CALL METHOD grid1->refresh_table_display

       EXPORTING

         i_soft_refresh = 'X'

         is_stable      = gs_stable.

   ENDIF.

ENDFORM.