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

Hierarchy

Former Member
0 Likes
524

Hi all,

I want to be able to create a report with 1 header and underneath these I want to be able to have 3 hierarchical items(because they will have more than one line) where I will be able to open it just like in the FM 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'.

Help anyone!!

Thanks

4 REPLIES 4
Read only

Former Member
0 Likes
497

Hi,

Check this simple example

TYPE-POOLS: slis.

DATA: BEGIN OF itab OCCURS 0,

vbeln TYPE vbeln,

expand,

END OF itab.

DATA: BEGIN OF itab1 OCCURS 0,

vbeln TYPE vbeln,

posnr TYPE posnr,

matnr TYPE matnr,

netpr TYPE netpr,

END OF itab1.

DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.

DATA: s_fieldcatalog TYPE slis_fieldcat_alv.

s_fieldcatalog-col_pos = '1'.

s_fieldcatalog-fieldname = 'VBELN'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'VBELN'.

s_fieldcatalog-outputlen = '12'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '1'.

s_fieldcatalog-fieldname = 'VBELN'.

s_fieldcatalog-tabname = 'ITAB1'.

s_fieldcatalog-rollname = 'VBELN'.

s_fieldcatalog-outputlen = '12'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '2'.

s_fieldcatalog-fieldname = 'POSNR'.

s_fieldcatalog-tabname = 'ITAB1'.

s_fieldcatalog-rollname = 'POSNR'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '3'.

s_fieldcatalog-fieldname = 'MATNR'.

s_fieldcatalog-tabname = 'ITAB1'.

s_fieldcatalog-rollname = 'MATNR'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '4'.

s_fieldcatalog-fieldname = 'NETPR'.

s_fieldcatalog-tabname = 'ITAB1'.

s_fieldcatalog-rollname = 'NETPR'.

s_fieldcatalog-do_sum = 'X'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

DATA: s_layout TYPE slis_layout_alv.

s_layout-subtotals_text = 'SUBTOTAL TEXT'.

s_layout-key_hotspot = 'X'.

s_layout-expand_fieldname = 'EXPAND'.

SELECT vbeln UP TO 100 ROWS

FROM

vbak

INTO TABLE itab.

IF NOT itab[] IS INITIAL.

SELECT vbeln posnr matnr netpr

FROM vbap

INTO TABLE itab1

FOR ALL ENTRIES IN itab

WHERE vbeln = itab-vbeln.

ENDIF.

DATA: v_repid TYPE syrepid.

v_repid = sy-repid.

DATA: s_keyinfo TYPE slis_keyinfo_alv.

s_keyinfo-header01 = 'VBELN'.

s_keyinfo-item01 = 'VBELN'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

is_layout = s_layout

it_fieldcat = t_fieldcatalog

i_tabname_header = 'ITAB'

i_tabname_item = 'ITAB1'

is_keyinfo = s_keyinfo

TABLES

t_outtab_header = itab

t_outtab_item = itab1

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.

Thanks,

Naren

Read only

0 Likes
497

Hi,

basically what i want is to have 3 hierachical ALV right after the header.

Read only

Former Member
0 Likes
497

Hi,

You mean to say..Three sections under one header..

Thanks

Naren

Read only

0 Likes
497

yes!