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 Heading using it_events

Former Member
0 Likes
1,227

Hi ,

I'm using 'top-of-page' for heading to display in output.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = i_fcat

i_callback_top_of_page = 'TOP-OF-PAGE'

But, i want to display the headings in the output using IT_EVENTS...Can anyone tell me how to proceed...

Thanks

BAlu

Moderator message - Total Posts: 281 Total Questions: 243 (170 unresolved) If you assign po(i)nts and close your old posts, that will encourage people to respond to your new questions.

Edited by: Rob Burbank on May 19, 2009 4:55 PM

Hi ,

I'm using 'top-of-page' for heading to display in output.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = i_fcat

i_callback_top_of_page = 'TOP-OF-PAGE'

But, i want to display the headings in the output using IT_EVENTS...Can anyone tell me how to proceed...

Thanks

BAlu

Moderator message - Total Posts: 281 Total Questions: 243 (170 unresolved) If you assign po(i)nts and close your old posts, that will encourage people to respond to your new questions.

Edited by: Rob Burbank on May 19, 2009 4:55 PM

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
768

Look at this code:


TYPE-POOLS: SLIS.

DATA: ft_alv_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type = 0
    IMPORTING
      et_events   = ft_alv_events.

  READ TABLE ft_alv_events WITH KEY name = slis_ev_top_of_page   "TOP-OF-PAGE event
                       INTO ls_event.
  IF sy-subrc = 0.
    MOVE slis_ev_top_of_page TO ls_event-form.  "slis_ev_top_of_page holds name of procedure which will be called when TOP-OF-PAGE event raised
    APPEND ls_event TO ft_alv_events.
  ENDIF.

  "similary for other events...
  READ TABLE ft_alv_events WITH KEY name = slis_ev_subtotal_text
                       INTO ls_event.
  IF sy-subrc = 0.
    MOVE slis_ev_subtotal_text TO ls_event-form.
    APPEND ls_event TO ft_alv_events.
  ENDIF.

  READ TABLE ft_alv_events WITH KEY name = slis_ev_user_command
                       INTO ls_event.
  IF sy-subrc = 0.
    MOVE slis_ev_user_command  TO ls_event-form.
    APPEND ls_event TO ft_alv_events.
  ENDIF.

  READ TABLE ft_alv_events WITH KEY name = slis_ev_pf_status_set
                       INTO ls_event.
  IF sy-subrc = 0.
    MOVE slis_ev_pf_status_set  TO ls_event-form.
    APPEND ls_event TO ft_alv_events.
  ENDIF.


  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     ....
     it_events                         = ft_alv_events[]

Regards

Marcin

Read only

Former Member
0 Likes
768

Hi

Call the Fm REUSE_ALV_EVENTS_GET to populate the IT_EVENTS itab. Now, read the top of page record from the it events itab and fill the desired form name(subroutine in your program) and modify the itab. When u call the FM 'REUSE_ALV_GRID_DISPLAY', pass the IT_EVENTS itab to the FM. So, when top of page event triggers, the subroutine u mentioned would be called.

Thanks

Neo

Read only

Former Member
0 Likes
768

Hi,

Try this

DATA:lwa_events TYPE slis_alv_event.

CLEAR lwa_events.

lwa_events-name = 'TOP_OF_PAGE'.

lwa_events-form = 'FORM_TOP_OF_PAGE'.

APPEND lwa_events TO i_events.

CLEAR lwa_events.

DATA: lwa_header TYPE slis_listheader,

l_lines(10) TYPE c,

line TYPE i.

CONSTANTS : c_header_type TYPE c VALUE 'H',

c_header_types TYPE c VALUE 'S'.

CLEAR v_header.

FREE v_header.

lwa_header-typ = c_header_types.

IF NOT s_matnr-low IS INITIAL AND NOT s_matnr-high IS INITIAL.

CONCATENATE text-028 text-030 s_matnr-low text-031 s_matnr-high INTO lwa_header-info SEPARATED BY space.

APPEND lwa_header TO v_header.

ELSEIF NOT s_matnr-low IS INITIAL AND line GT '1'.

CONCATENATE text-028 text-030 s_matnr-low text-033 INTO lwa_header-info SEPARATED BY space. APPEND lwa_header TO v_header.

ELSEIF NOT s_matnr-low IS INITIAL .

CONCATENATE text-028 text-030 s_matnr-low INTO lwa_header-info SEPARATED BY space. APPEND lwa_header TO v_header.

ELSEIF s_matnr-low IS INITIAL AND s_matnr-high IS INITIAL.

CONCATENATE text-028 text-030 text-029 INTO lwa_header-info SEPARATED BY space.

APPEND lwa_header TO v_header. ENDIF.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING it_list_commentary = v_header.

Regards

Krishna

Edited by: Krishna Gowrneni on May 20, 2009 2:31 AM