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: 

hierarchial list display

Former Member
0 Kudos
93

hi all,

please send me some programs for hierarchial list display in ALVs.

thanks in advance,

hema.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
72

hi, chk this material, will be of some help.

Don't make your thread with Multiple Questions.

BLOCK ALV is used for Multiple Lists.

Difference Between Alv grid and List Display :

Some differences:

a) from abap coding point of view,

alv list is done with Function modules,

alv gris can also be done with FM,

but can also be done using OO concepts.

b) Alv grid (using oo concept) requires

designing the screen layout .

Hence, in one screen, we can show more

then one alv grid

(we cannot show more than

one alv list on one screen)

c) ALV grid uses ActiveX controls

present on the Presentation Server.

Hence, it consumes More Memory

on the presentation server.

d) ALV LIST is Display Only.

Whereas

ALV Grid Can Be made EDITABLE for entry purpose.

e) In alv grid, these options are possible,

but not in alv list.

without horizontal lines

without vertical lines

without cell merging during sorts

display total lines above the entries

ALV LIST Can be coded using only FMs

ALV GRID Can be coded using FMs and object oriented concepts

ALV LIST Can be displayed hieraicharlly

ALV GRID cannot be displayed hierarichally

bye, madhavi.

3 REPLIES 3

Former Member
0 Kudos
73

hi, chk this material, will be of some help.

Don't make your thread with Multiple Questions.

BLOCK ALV is used for Multiple Lists.

Difference Between Alv grid and List Display :

Some differences:

a) from abap coding point of view,

alv list is done with Function modules,

alv gris can also be done with FM,

but can also be done using OO concepts.

b) Alv grid (using oo concept) requires

designing the screen layout .

Hence, in one screen, we can show more

then one alv grid

(we cannot show more than

one alv list on one screen)

c) ALV grid uses ActiveX controls

present on the Presentation Server.

Hence, it consumes More Memory

on the presentation server.

d) ALV LIST is Display Only.

Whereas

ALV Grid Can Be made EDITABLE for entry purpose.

e) In alv grid, these options are possible,

but not in alv list.

without horizontal lines

without vertical lines

without cell merging during sorts

display total lines above the entries

ALV LIST Can be coded using only FMs

ALV GRID Can be coded using FMs and object oriented concepts

ALV LIST Can be displayed hieraicharlly

ALV GRID cannot be displayed hierarichally

bye, madhavi.

Former Member
0 Kudos
72

hi,

this is used to specify that according to which field u want hierarchy....

means i want that according to material number i want hierarchical display than i have to pass matnr in this

and

key_info-header01 = 'MAT'.

key_info-item01 = 'MAT'.

In this we passing field name of header table and item table....

Now see this example..

In this i want hierarchy depend on Material and palnt both..

so my code will be

TYPE-POOLS : slis.

TABLES : mseg.

DATA : BEGIN OF itab_head OCCURS 0,

mat LIKE mseg-matnr,

matnr LIKE mseg-matnr,

werks LIKE mseg-werks,

END OF itab_head.

DATA : BEGIN OF itab_item OCCURS 0,

mat LIKE mseg-matnr,

matnr LIKE mseg-matnr,

werks LIKE mseg-werks,

mblnr LIKE mseg-mblnr,

menge LIKE mseg-menge,

END OF itab_item.

DATA : t_fcat TYPE slis_t_fieldcat_alv,

key_info TYPE slis_keyinfo_alv,

t_eve TYPE slis_t_event,

gt_subtot TYPE slis_t_sortinfo_alv,

subtot LIKE LINE OF gt_subtot,

t_listhead TYPE slis_t_listheader,

st_line TYPE slis_listheader.

DATA : t_mtdoc LIKE mseg-mblnr.

SELECT-OPTIONS : mat FOR mseg-matnr.

INITIALIZATION.

PERFORM build_cat USING t_fcat.

PERFORM build_eve.

START-OF-SELECTION.

PERFORM get_data.

PERFORM dis_data.

&----


*& Form build_cat

&----


text

-


-->TEMP_FCAT text

-


FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.

DATA : wa_fcat TYPE slis_fieldcat_alv.

wa_fcat-tabname = 'ITAB_HEAD'.

wa_fcat-fieldname = 'MAT'.

wa_fcat-seltext_m = 'Material'.

APPEND wa_fcat TO temp_fcat.

CLEAR wa_fcat.

wa_fcat-tabname = 'ITAB_HEAD'.

wa_fcat-fieldname = 'WERKS'.

wa_fcat-seltext_m = 'Plant'.

APPEND wa_fcat TO temp_fcat.

CLEAR wa_fcat.

wa_fcat-tabname = 'ITAB_ITEM'.

wa_fcat-fieldname = 'MBLNR'.

wa_fcat-seltext_m = 'Material Doc.'.

APPEND wa_fcat TO temp_fcat.

CLEAR wa_fcat.

wa_fcat-tabname = 'ITAB_ITEM'.

wa_fcat-fieldname = 'MENGE'.

wa_fcat-seltext_m = 'Quantity'.

wa_fcat-do_sum = 'Y'.

APPEND wa_fcat TO temp_fcat.

CLEAR wa_fcat.

subtot-spos = 1.

subtot-fieldname = 'MAT'.

subtot-tabname = 'ITAB_HEAD'.

subtot-up = 'X'.

subtot-group = 'X'.

subtot-subtot = 'X'.

subtot-expa = 'X'.

APPEND subtot TO gt_subtot.

ENDFORM. "build_cat

&----


*& Form build_eve

&----


text

-


FORM build_eve.

DATA : wa_eve TYPE slis_alv_event.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = t_eve

EXCEPTIONS

LIST_TYPE_WRONG = 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.

ENDFORM. "build_eve

&----


*& Form get_data

&----


text

-


FORM get_data.

SELECT matnr AS mat werks mblnr menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab_item

WHERE matnr IN mat.

ENDFORM. "get_data

&----


*& Form dis_data

&----


text

-


FORM dis_data.

key_info-header01 = 'MAT'.

key_info-item01 = 'MAT'.

key_info-header02 = 'WERKS'.

key_info-item02 = 'WERKS'.

REFRESH itab_head.

LOOP AT itab_item.

ON CHANGE OF itab_item-mat OR itab_item-werks.

MOVE-CORRESPONDING itab_item TO itab_head.

APPEND itab_head.

ENDON.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = 'ZALV_PRDS'

it_fieldcat = t_fcat

it_sort = gt_subtot

it_events = t_eve[]

i_tabname_header = 'ITAB_HEAD'

i_tabname_item = 'ITAB_ITEM'

is_keyinfo = key_info

TABLES

t_outtab_header = itab_head

t_outtab_item = itab_item

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.

ENDFORM. "dis_data

cheers,

madhavi.

Former Member
0 Kudos
72

hi hema,

also chk this,

REUSE_ALV_HIERSEQ_LIST_DISPLAY

Text

Hierarchical sequential list output

Functionality

This module outputs two internal tables as a formated hierarchical-sequential list.

Principle:

Pass an internal table containing the set of header information to be output.

Pass an internal table containing the set of item information to be output.

Pass a structure containing the general list layout details

Pass a field catalog in the form of an internal table. The field catalog describes the fields to be output in the list.

Notes

All interactions which are performed on the list refer directly to the internal output tables, e.g. sorting the list also sorts the passed internal output tables (passed by reference).

The expected output data quantity is an important consideration for the use of the tool or various generic functions (totals, subtotals).

The application must take account of this.

Further Information

Parameters

ES_EXIT_CAUSED_BY_USER

Meaning

See the documentation of parameter .

REUSE_ALV_LIST_DISPLAY ES_EXIT_CAUSED_BY_USER> ES_EXIT_CAUSED_BY_USER .

Range

Default

E_EXIT_CAUSED_BY_CALLER

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY E_EXIT_CAUSED_BY_CALLER> link to REUSE_ALV_LIST_DISPLAY E_EXIT_CAUSED_BY_CALLER

Range

Default

IS_KEYINFO

Meaning

This structure contains the header and item table field names which link the two tables (shared key).

Enter the foreign key field names in the fields KEYINFO-HEADERxx and KEYINFO-ITEMxx. The foreign key field names of the header and item tables are usually identical.

The item table has other key fields as well as the header table foreign key. These other key fields should also be named in this structure. The corresponding header table field (HEADERxx) must be SPACE.

Naming the other key fields guarantees a stable item table sort sequence.

Range

Default

IS_LAYOUT

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IS_LAYOUT> link to REUSE_ALV_LIST_DISPLAY IS_LAYOUT

IS_PRINT

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IS_PRINT> link to REUSE_ALV_LIST_DISPLAY IS_PRINT

Range

Default

IS_REPREP_ID

IS_SEL_HIDE

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IS_SEL_HIDE> link to REUSE_ALV_LIST_DISPLAY IS_SEL_HIDE

Range

Default

IS_VARIANT

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IS_VARIANT> link to REUSE_ALV_LIST_DISPLAY IS_VARIANT

Range

Default

IT_EVENTS

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IT_EVENTS> link to REUSE_ALV_LIST_DISPLAY IT_EVENTS

Range

Default

IT_EVENT_EXIT

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IT_EVENT_EXIT> link to REUSE_ALV_LIST_DISPLAY IT_EVENT_EXIT

Range

Default

IT_EXCLUDING

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IT_EXCLUDING> link to REUSE_ALV_LIST_DISPLAY IT_EXCLUDING

Range

Default

IT_FIELDCAT

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IT_FIELDCAT> link to REUSE_ALV_LIST_DISPLAY IT_FIELDCAT

Range

Default

IT_FILTER

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IT_FILTER> link to REUSE_ALV_LIST_DISPLAY IT_FILTER

Range

Default

IT_SORT

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IT_SORT> link to REUSE_ALV_LIST_DISPLAY IT_SORT

Range

Default

IT_SPECIAL_GROUPS

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY IT_SPECIAL_GROUPS> link to REUSE_ALV_LIST_DISPLAY IT_SPECIAL_GROUPS

Range

Default

I_BUFFER_ACTIVE

I_BYPASSING_BUFFER

I_CALLBACK_PF_STATUS_SET

<DS:FU.REUSE_ALV_LIST_DISPLAY I_CALLBACK_PF_STATUS_SET> link to REUSE_ALV_LIST_DISPLAY I_CALLBACK_PF_STATUS_SET

I_CALLBACK_PROGRAM

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_CALLBACK_PROGRAM> link to REUSE_ALV_LIST_DISPLAY I_CALLBACK_PROGRAM

Range

Default

I_CALLBACK_USER_COMMAND

<DS:FU.REUSE_ALV_LIST_DISPLAY I_CALLBACK_USER_COMMAND> link to REUSE_ALV_LIST_DISPLAY I_CALLBACK_USER_COMMAND

I_DEFAULT

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_DEFAULT> link to REUSE_ALV_LIST_DISPLAY I_DEFAULT

Range

Default

I_INTERFACE_CHECK

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_INTERFACE_CHECK> link to REUSE_ALV_LIST_DISPLAY I_INTERFACE_CHECK

Range

Default

I_SAVE

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_SAVE> link to REUSE_ALV_LIST_DISPLAY I_SAVE

Range

Default

I_SCREEN_END_COLUMN

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_END_COLUMN> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_END_COLUMN

Range

Default

I_SCREEN_END_LINE

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_END_LINE> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_END_LINE

Range

Default

I_SCREEN_START_COLUMN

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_START_COLUMN> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_START_COLUMN

Range

Default

I_SCREEN_START_LINE

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_SCREEN_START_LINE> link to REUSE_ALV_LIST_DISPLAY I_SCREEN_START_LINE

Range

Default

I_STRUCTURE_NAME_HEADER

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME> link to REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME

Range

Default

I_STRUCTURE_NAME_ITEM

Meaning

<DS:FU.REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME> link to REUSE_ALV_LIST_DISPLAY I_STRUCTURE_NAME

Range

Default

I_TABNAME_HEADER

Meaning

Name of the internal table in the program containing the output data of the highest hierarchy level.

Range

Default

I_TABNAME_ITEM

Meaning

Name of the internal table in the program containing the output data of the lowest hierarchy level.

Range

Default

T_OUTTAB_HEADER

Meaning

Header table with data to be output

<DS:FU.REUSE_ALV_LIST_DISPLAY T_OUTTAB> link to REUSE_ALV_LIST_DISPLAY T_OUTTAB

Range

Default

T_OUTTAB_ITEM

Meaning

Item table with data to be output

<DS:FU.REUSE_ALV_LIST_DISPLAY T_OUTTAB> link to REUSE_ALV_LIST_DISPLAY T_OUTTAB

Default

Exceptions

PROGRAM_ERROR

Meaning

<DS:FX.REUSE_ALV_LIST_DISPLAY PROGRAM_ERROR> link to REUSE_ALV_LIST_DISPLAY PROGRAM_ERROR

bye.