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

Hierarchical grid

Former Member
0 Likes
990

hi

Requesting you to let me know the procedure of doing the Hierarchical grid in reports, it would be helpful if anybody would help me out the step by step procedure to create Hierarchical grid in reports.

Your early replies would highly appreciated.

bye

pavan

hi

Requesting you to let me know the procedure of doing the Hierarchical grid in reports, it would be helpful if anybody would help me out the step by step procedure to create Hierarchical grid in reports.

Your early replies would highly appreciated.

bye

pavan

6 REPLIES 6
Read only

former_member386202
Active Contributor
0 Likes
949

Hi,

refer these stadard reports

BCALV_TEST_HIERSEQ_LIST Program BCALV_TEST_HIERSEQ_LIST

BCALV_TEST_HIERSEQ_LIST_EVENTS Program BCALV_TEST_HIERSEQ_LIST_EVENTS

BCALV_TREE_01 ALV tree control: build up the hierarchy tree

BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy

BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy

Regards,

Prashant

Read only

Former Member
0 Likes
949

Hi

U can refer thid PDF:

<u>https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0f03986-046c-2910-a5aa-e5364e96ea2c</u>

Thanks

Vasudha

Read only

Former Member
0 Likes
949

Hi Pavan,

Check this link for hierarchical ALV.

http://www.sap-img.com/abap/how-to-use-alv-for-hierarchical-lists.htm

<b>Note:</b> You have many open threads. Please close the threads if they are answered/solved.

Thanks,

Vinay

Read only

Former Member
0 Likes
949

hi,

Grid is not possible in hierarchical ALV, only list is there.

Its just like normal ALV report in which u have to collect all data in one internal table, but difference is whenevr u find any different data in the field on which u want to do hierarchy, u need to move related data to that field in other table.

Thats y u have two tables in hierarchical.

Means i want material information ( material Doc., date, quantity) as per material.

i have collect all my data in one table.

now i make loop on that table and whenever i get different material i just move related data in othertable which has same structure as first table.

here i am sending code to make u clear.

TYPE-POOLS : slis.

TABLES : mseg.

DATA : BEGIN OF itab_head OCCURS 0,

matnr LIKE mseg-matnr,

werks LIKE mseg-werks,

END OF itab_head.

DATA : BEGIN OF itab_item OCCURS 0,

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 = 'MATNR'.

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'.

APPEND wa_fcat TO temp_fcat.

CLEAR wa_fcat.

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 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 = 'MATNR'.

key_info-item01 = 'MATNR'.

key_info-header02 = 'WERKS'.

key_info-item02 = 'WERKS'.

REFRESH itab_head.

LOOP AT itab_item.

ON CHANGE OF itab_item-matnr 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 = 'ZHEIRALV_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

Read only

former_member191735
Active Contributor
0 Likes
949

Check out the demo program: SALV_DEMO_HIERSEQ_SIMPLE . It is self explanatory.

If you want to write a grid report check out SALV_DEMO_GRID_SIMPLE

Read only

Former Member
0 Likes
949

Solved