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: 

ALV header problem

Former Member
0 Kudos

Hi all,

I am facing problem when tried to display header in alv.

I have One basic Alv report clicking on particular record corresponding data containing another ALV report displays .

Now i want to change the header text info for primary ALV and secondary ALV.

Any suggestion welcome.

Regards,

6 REPLIES 6

Former Member
0 Kudos

Hi,

Do you mean you want to change the column headers ? That can be done by changing the fieldcatalog, attribute COLTEXT.

kr,

Peter

0 Kudos

No i want to change the header text and some colulmns too.

I need solution for header text.

Regards,

0 Kudos

Navdeep singh, Just follow these steps 1. Define 2 events internal tables for 2 output as u r not using same Header text for 2 ALV outputs data :

i_events_p  type slis_t_event, "Primary ALV
i_events_s  type slis_t_event, "for Secondary ALV
w_events  like line of i_events.
2. Build events table .
w_events-name = 'TOP_OF_PAGE' .
w_events-form   = 'TOP_OF_PAGE_P' .
append w_events to i_events_p.
clear w_events.
w_events-name = 'TOP_OF_PAGE' .
w_events-form   = 'TOP_OF_PAGE_S' .
append w_events to i_events_s.
clear w_events.
3. pass this events tables through REUSE_ALV_GRID_DISPLAY in Primary ans Secondary. 4. Callback subroutines for TOP_OF_PAGE event.
*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
FORM top_of_page_p.
 
  DATA :
   li_header TYPE slis_t_listheader,
   w_header  LIKE LINE OF li_header.
 
  w_header-typ  = 'S'.
  w_header-info = 'XYZ Pte Ltd'.
  APPEND w_header TO li_header.
  CLEAR w_header.
 
  w_header-typ  = 'H'.
  w_header-info = sy-repid.
  APPEND w_header TO li_header.
  CLEAR w_header.
 
  w_header-typ  = 'A'.
  w_header-info = sy-title.
  APPEND w_header TO li_header.
  CLEAR w_header.
 
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = li_header.
endform.
*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
FORM top_of_page_s.
 
  DATA :
   li_header TYPE slis_t_listheader,
   w_header  LIKE LINE OF li_header.
 
  w_header-typ  = 'S'.
  w_header-info = 'XYZ Pte Ltd'.
  APPEND w_header TO li_header.
  CLEAR w_header.
 
  w_header-typ  = 'H'.
  w_header-info = sy-repid.
  APPEND w_header TO li_header.
  CLEAR w_header.
 
  w_header-typ  = 'A'.
  w_header-info = sy-title.
  APPEND w_header TO li_header.
  CLEAR w_header.
 
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = li_header.
endform.
5. If you want to change the Columns text manually.build fieldcatalog manually or set text for the field using seltext_m or seltext_l or seltext_s in the fieldcatalog internal table. check below.
w_fieldcat-fieldname = 'ENAME'.
  w_fieldcat-tabname   = 'I_PA0001'.
  w_fieldcat-seltext_m = 'Employee Name'.
  append w_fieldcat to i_fieldcat.
  clear w_fieldcat.
I hope that it helps you. Regards, Venkat.O

Former Member
0 Kudos

Hi,

Supply a different Subroutine to the ALV FM's....in the parameter

I_CALLBACK_TOP_OF_PAGE

Santhosh

0 Kudos

Thanks for quick reply,

i am using that FM just it displays blank and some space is showing for that.

Regards,

0 Kudos

I mean this

Primary ALV

form display_alv_report.

gd_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP_OF_PAGE' "see FORM

i_callback_user_command = 'USER_COMMAND'

  • i_grid_title = outtext

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

  • it_special_groups = gd_tabgroup

it_events = gt_events

is_print = gd_prntparams

i_save = 'X'

  • is_variant = z_template

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

Second ALV

form display_alv_report.

gd_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = gd_repid

i_callback_top_of_page = 'TOP_OF_PAGE2' "see FORM

i_callback_user_command = 'USER_COMMAND'

  • i_grid_title = outtext

is_layout = gd_layout

it_fieldcat = fieldcatalog[]

  • it_special_groups = gd_tabgroup

it_events = gt_events

is_print = gd_prntparams

i_save = 'X'

  • is_variant = z_template

tables

t_outtab = it_ekko

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

Form TOP_OF_PAGE.

use Fm REUSE_ALV_COMMENTARY_WRITE here

EndForm.

Form TOP_OF_PAGE2.

use Fm REUSE_ALV_COMMENTARY_WRITE here

EndForm.

This will work.

santhosh