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

ALV ..Need Two Heading

ajay_sharma10
Participant
0 Likes
831

Hi Friends , In the Report output of Alv i need double header text

IN THE FIRST HEADER ITS LIKE

-


CONSUMPUTION----- -


PRODUCTION--


AND IN THE 2ND HEADER

-


A--BC--D--E--F--- A-B-CDE-F--


Requirement is need two header and not 2 alv's on same page/

Thanks

Ajay Sharma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
795

By usual way give the heading in ALV, along with that fill the parameter I_GRID_TITLE = '2nd Header' in the function module REUSE_ALV_GRID_DISPLAY.

So the text given over the paramter i_grid_title will act as 2nd header for the report.

Thanks,

Kamani

Hi

Use top of list event for displaying the first header.

use appropriate positions for the write statement for displaying the heading.

like

form top_of_list.

write (40) CONSUMPUTION (80)PRODUCTION .

endform.

regards,

Ramya

5 REPLIES 5
Read only

Former Member
0 Likes
795

Hi

Use top of list event for displaying the first header.

use appropriate positions for the write statement for displaying the heading.

like

form top_of_list.

write (40) CONSUMPUTION (80)PRODUCTION .

endform.

regards,

Ramya

Read only

Former Member
0 Likes
795

Hi *AJAY SHARMA *,

Use the docking container concept then you are able to get that output.

Use the following code to display two ALV girds in the single page.

*&---------------------------------------------------------------------*
*& Report  ZREPDEPBADV
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zrepdepbadv.


DATA:
  w_ltype TYPE zlcu_item-licensetype,
  w_port  TYPE zdepb_master-portno.

CONSTANTS:
  c_pf_basic   TYPE sy-pfkey
              VALUE 'BASICSCR',         " GUI status : DEPB creation scr
  c_fcode_back TYPE sy-ucomm
              VALUE 'BACK'.

DATA:
  ok_code TYPE sy-ucomm,
  w_first TYPE c.

DATA:
  fs_fcat     TYPE lvc_s_fcat,         " Field string for alv fieldcat
  fs_depbdata TYPE zdepb_master.

DATA:
  t_depbdata TYPE STANDARD TABLE OF zdepb_master,
  t_advdata  TYPE STANDARD TABLE OF zadv_master,
  t_fcat     TYPE lvc_t_fcat.           " Table for fieldcatalog

DATA:
  docking  TYPE REF TO cl_gui_docking_container,
  alv_top  TYPE REF TO cl_gui_alv_grid.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.

  SET PF-STATUS c_pf_basic.
  SET TITLEBAR c_pf_basic.

ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CLEAR sy-ucomm.

  CASE ok_code.

    WHEN 'BACK'.
      LEAVE TO SCREEN 0.

    WHEN 'EXC'.
      PERFORM select_data.

      IF t_depbdata IS NOT INITIAL OR
          t_advdata  IS NOT INITIAL.
        CALL SCREEN 101.
      ENDIF.

  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*
*&      Module  STATUS_0101  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0101 OUTPUT.

*  SET TITLEBAR 'xxx'.

  CASE w_ltype.

    WHEN 'DEPB'.

      PERFORM create_dockingtop USING 500.
      PERFORM create_docbottom USING 20.
      CALL METHOD cl_gui_cfw=>flush.

*      CALL METHOD ctld_dock_at_bottom->free.

      CALL METHOD alv_top->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZDEPB_MASTER'
        CHANGING
          it_outtab        = t_depbdata[].


    WHEN 'ADVC'.
      PERFORM create_dockingtop USING 500.
      PERFORM create_docbottom USING 0.


      CALL METHOD alv_top->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZADV_MASTER'
        CHANGING
          it_outtab        = t_advdata[].



    WHEN 'BOTH'.
      PERFORM create_dockingtop USING 220.

      CALL METHOD alv_top->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZDEPB_MASTER'
        CHANGING
          it_outtab        = t_depbdata[].

      PERFORM create_docbottom USING 230.

      CALL METHOD alv_top->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZADV_MASTER'
        CHANGING
          it_outtab        = t_advdata[].

  ENDCASE.

ENDMODULE.                 " STATUS_0101  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0101  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0101 INPUT.

  CASE sy-ucomm.
    WHEN c_fcode_back.
      CALL METHOD alv_top->refresh_table_display.
*      CALL METHOD cl_gui_cfw=>flush.
      CALL METHOD docking->free.
      LEAVE TO SCREEN 0.
  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0101  INPUT

*&---------------------------------------------------------------------*
*&      Form  SELECT_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM select_data .

  REFRESH:
    t_depbdata,
    t_advdata.

  CASE w_ltype.

    WHEN 'DEPB'.
      PERFORM get_depbdata.

    WHEN 'ADVC'.
      PERFORM get_advdata.

    WHEN 'BOTH'.

      PERFORM get_depbdata.
      PERFORM get_advdata.

  ENDCASE.

ENDFORM.                    " SELECT_DATA

*&---------------------------------------------------------------------*
*&      Form  GET_DEPBDATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_depbdata .

  SELECT *
    FROM zdepb_master
    INTO TABLE t_depbdata
   ORDER BY valto DESCENDING.

ENDFORM.                    " GET_DEPBDATA

*&---------------------------------------------------------------------*
*&      Form  GET_ADVDATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM get_advdata .

  SELECT *
    FROM zadv_master
    INTO TABLE t_advdata
   ORDER BY valto DESCENDING.

ENDFORM.                    " GET_ADVDATA

*&---------------------------------------------------------------------*
*&      Form  CREATE_DOCKINGTOP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_500    text
*----------------------------------------------------------------------*
FORM create_dockingtop  USING  pv_size TYPE i.

  CREATE OBJECT docking
    EXPORTING
      repid     = sy-repid
      dynnr     = sy-dynnr
      side      = docking->dock_at_top
      extension = pv_size.

  CREATE OBJECT alv_top
    EXPORTING
      i_parent = docking.


ENDFORM.                    " CREATE_DOCKINGTOP

*&---------------------------------------------------------------------*
*&      Form  CREATE_DOCBOTTOM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_220    text
*----------------------------------------------------------------------*
FORM create_docbottom  USING  pv_size TYPE i.

  CREATE OBJECT docking
    EXPORTING
      repid     = sy-repid
      dynnr     = sy-dynnr
      side      = docking->dock_at_bottom
      extension = pv_size.

  CREATE OBJECT alv_top
    EXPORTING
      i_parent = docking.

ENDFORM.                    " CREATE_DOCBOTTOM

Regards,

Mahi.

Read only

Former Member
0 Likes
795

wa_events-form = 'HEADER'.

wa_events-name = 'TOP_OF_PAGE'.

APPEND wa_events TO it_events.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

i_callback_pf_status_set = 'PFSTATUS'

i_grid_title = 'Report' "#EC NOTEXT

is_layout = it_layout

i_callback_user_command = 'USER_COMMAND'

it_fieldcat = it_fcat

it_events = it_events

TABLES

t_outtab = it_output.

FORM header . "#EC CALLED

DATA : it_header TYPE slis_t_listheader,

wa_header LIKE LINE OF it_header.

wa_header-typ = 'H'.

wa_header-info = 'Human Resource Team KPI'. "#EC NOTEXT

APPEND wa_header TO it_header.

CLEAR wa_header.

wa_header-typ = 'S'.

wa_header-key = 'Date:'. "#EC NOTEXT

CONCATENATE sy-datum+6(2) '.'

sy-datum+4(2) '.'

sy-datum(4) INTO wa_header-info. "Current date

APPEND wa_header TO it_header.

CLEAR wa_header.

wa_header-typ = 'S'.

wa_header-key = 'Total Number of Kpi:'. "#EC NOTEXT

MOVE 5 TO wa_header-info.

APPEND wa_header TO it_header.

CLEAR : wa_header.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_header

i_logo = 'ENTEG'.

CLEAR : it_header[], wa_header.

ENDFORM. " HEADER

Hi, use above logic it will works,

Thanks,

Thiru. R

Read only

Former Member
0 Likes
795

Hi,

See this blog , vijay has given all what u need in this.

Amresh.

Read only

Former Member
0 Likes
796

By usual way give the heading in ALV, along with that fill the parameter I_GRID_TITLE = '2nd Header' in the function module REUSE_ALV_GRID_DISPLAY.

So the text given over the paramter i_grid_title will act as 2nd header for the report.

Thanks,

Kamani