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 Sub-columns Prob

Former Member
0 Likes
759

Hi All,

I need to give sub headings under one main heading in the alv list display.

How to make ALV header like this?

Header long text 1 Header long text 2 Header long text 3

Col_1 Col_2 Col_3 Col_4 Col_5 Col_6 Col_7 Col_8 Col_9

-


Cell conents -


-


Cell conents -


-


Cell conents -


-


Cell conents -


-


Cell conents -


i have tried using FM reuse_alv_commentary_write i did not get the desired results.

help in this reg is very much appreciated. a piece of code will be a great thing.

Thanks in advance.

Ramesh

Hi All,

I need to give sub headings under one main heading in the alv list display.

How to make ALV header like this?

Header long text 1 Header long text 2 Header long text 3

Col_1 Col_2 Col_3 Col_4 Col_5 Col_6 Col_7 Col_8 Col_9

-


Cell conents -


-


Cell conents -


-


Cell conents -


-


Cell conents -


-


Cell conents -


i have tried using FM reuse_alv_commentary_write i did not get the desired results.

help in this reg is very much appreciated. a piece of code will be a great thing.

Thanks in advance.

Ramesh

4 REPLIES 4
Read only

Former Member
0 Likes
649

Try not using COMMENTARY_WRITE FM. You can just write your desired report headings in the event top_of_page. The column headings are defined in the structure. Here is a code sample. Hope this helps.

Regards,

Jason

MOVE 'ZFI_NO_WHOLD' TO structure_name.

MOVE sy-repid TO ls_variant-report.

PERFORM build_event_tab USING lt_events[].

SET PF-STATUS space.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = structure_name

CHANGING

ct_fieldcat = gt_fieldcat2_lvc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = callbk_prog

is_layout = layout

it_fieldcat = gt_fieldcat2_lvc

i_save = 'X'

is_variant = ls_variant

it_events = lt_events

is_print = ls_print

  • IMPORTING

  • e_exit_caused_by caller =

  • es_exit_caused_by_user =

TABLES

t_outtab = null_stcd_itab

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.

ENDIF.

FORM build_event_tab USING rt_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 = rt_events.

READ TABLE rt_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE g_top_of_page TO ls_event-form.

APPEND ls_event TO rt_events.

ENDIF.

ENDFORM. " BUILD_EVENT_TAB

FORM top_of_page.

  • do your write statements here any way you want

ENDFORM. " top_of_page

Read only

Former Member
0 Likes
649

Hi,

Check this out:

http://www.sapdevelopment.co.uk/reporting/alv/alvlist_code.htm

This link gives you how to use the FM:

REUSE_ALV_COMMENTARY_WRITE

This module outputs formatted simple header information at TOP-OF-PAGE.

Example

List <-- Type 'H'

Currency DEM Controlling area currency <-- Type 'S'

Material FGS_TEST Test material <-- Type 'S'

Action info <-- Type 'A'

-


Column headers -


-


List -


Parameter

IT_LIST_COMMENTARY

I_LOGO

I_END_OF_LIST_GRID

Regards,

Anjali

Message was edited by: Anjali Devi Vishwanathan

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
649

Hi,

Check this link.It contains similar sample coding.

http://www.sap-img.com/fu037.htm

Regards,

J.Jayanthi

Read only

Former Member
0 Likes
649

Hi,

The SAP program BALVBT01 provides an example of displying multiple ALV LIST reports on one page.

----


  • Form TOP-OF-PAGE *

----


  • ALV Report Header *

----


Form top-of-page.

*ALV Header declarations

data: t_header type slis_t_listheader,

wa_header type slis_listheader,

t_line like wa_header-info,

ld_lines type i,

ld_linesc(10) type c.

  • Title

wa_header-typ = 'H'.

wa_header-info = 'EKKO Table Report'.

append wa_header to t_header.

clear wa_header.

  • Date

wa_header-typ = 'S'.

wa_header-key = 'Date: '.

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

sy-datum+4(2) '.'

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

append wa_header to t_header.

clear: wa_header.

  • Total No. of Records Selected

describe table it_ekko lines ld_lines.

ld_linesc = ld_lines.

concatenate 'Total No. of Records Selected: ' ld_linesc

into t_line separated by space.

wa_header-typ = 'A'.

wa_header-info = t_line.

append wa_header to t_header.

clear: wa_header, t_line.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_header.

  • i_logo = 'Z_LOGO'.

endform.

Also u can see more solution by searching this forum.

Thanks & Regards,

Judith.