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: 

Alv hierarchical sequential list display

Former Member
0 Kudos
399

Hello

I thank all participants in this forum

I learned many things in this forum

I am newbie in the abap programming I have a problem

I dont know why this code does not compile.

i want to create Alv hierarchical sequential list display

REPORT  ZPROG_ALV5_HIRARCHIQUE.

TABLES: ZTCLIENT , ZTCOMMANDE .

TYPE-POOLS: slis.

DATA: wa_field_cat TYPE slis_fieldcat_alv,

it_field_cat TYPE slis_t_fieldcat_alv,

wa_keyinfo TYPE slis_keyinfo_alv,

it_layout TYPE slis_layout_alv.

DATA : ti_client TYPE TABLE OF ZTCLIENT .

DATA : WA_client TYPE ZTCLIENT .

DATA : ti_commande TYPE TABLE OF ZTCOMMANDE .

START-OF-SELECTION.

PERFORM select_data.

PERFORM build_field_cat.

end-OF-SELECTION.

PERFORM disply_data.

FORM select_data .

SELECT * FROM ZTCLIENT

INTO CORRESPONDING FIELDS OF TABLE ti_client .

IF NOT ti_client[] IS INITIAL.

SELECT *

FROM ZTCOMMANDE

INTO CORRESPONDING FIELDS OF TABLE ti_commande

FOR ALL ENTRIES IN ti_client

WHERE FKIDCLIENT = ti_client-IDCLIENT.

ENDIF.

SORT ti_client BY IDCLIENT.

ENDFORM.

FORM build_field_cat .

wa_field_cat-tabname = 'ZTCLIENT'.

wa_field_cat-fieldname = 'IDCLIENT'.

wa_field_cat-seltext_l = 'IDCLIENT'.

APPEND wa_field_cat TO it_field_cat.

wa_field_cat-tabname = 'ZTCLIENT'.

wa_field_cat-fieldname = 'nom'.

wa_field_cat-seltext_l = 'nom'.

APPEND wa_field_cat TO it_field_cat.

wa_field_cat-tabname = 'ZTCLIENT'.

wa_field_cat-fieldname = 'prenom'.

wa_field_cat-seltext_l = 'prenom'.

APPEND wa_field_cat TO it_field_cat.

wa_field_cat-tabname = 'ZTCOMMANDE'.

wa_field_cat-fieldname = 'IDCOMMANDE'.

wa_field_cat-seltext_l = 'IDCOMMANDE'.

APPEND wa_field_cat TO it_field_cat.

wa_field_cat-tabname = 'ZTCOMMANDE'.

wa_field_cat-fieldname = 'prix'.

wa_field_cat-seltext_l = 'birhtdate'.

APPEND wa_field_cat TO it_field_cat.

ENDFORM. " BUILD_FIELD_CAT

FORM disply_data .

wa_keyinfo-header01 = 'IDCLIENT'.

wa_keyinfo-item01 = 'IDCLIENT'.

* wa_keyinfo-item02 = 'SUBTY'.

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

is_layout = it_layout

it_fieldcat = it_field_cat

i_tabname_header = 'ZTCLIENT'

i_tabname_item = 'ZTCOMMANDE'

is_keyinfo = wa_keyinfo

TABLES

t_outtab_header = ti_client

t_outtab_item = ti_commande .

ENDFORM. " DISPLY_DATA

1 ACCEPTED SOLUTION

Former Member
0 Kudos
131

When you say the code does not compile, what is the error?

6 REPLIES 6

Former Member
0 Kudos
132

When you say the code does not compile, what is the error?

0 Kudos
131

0 Kudos
131

Try changing the following in the FM call:

i_tabname_header = 'ZTCLIENT'

i_tabname_item = 'ZTCOMMANDE'

to

i_tabname_header = 'TI_CLIENT'

i_tabname_item = 'TI_COMMANDE'

The parameters should have the name of the internal table that holds the data and not the DB table.

Thanks,

Vikram.M

0 Kudos
131

hi

I made the changes you told me but same error

if you have an example or full tutorial of  Alv hierarchical thank you send me

thank you

0 Kudos
131

I made very little changes to your program since I dont have the Z tables that you have used. Instead I used VBAK and VBAP and I do not get any errors.

Can you give us the entire dump in  text format?

TYPE-POOLS: slis.

DATA: wa_field_cat  TYPE slis_fieldcat_alv,

       it_field_cat  TYPE slis_t_fieldcat_alv,

       wa_keyinfo    TYPE slis_keyinfo_alv,

       it_layout     TYPE slis_layout_alv.

DATA : ti_client    TYPE TABLE OF vbak,

        wa_client    TYPE vbak,

        ti_commande  TYPE TABLE OF vbap.

START-OF-SELECTION.

   PERFORM select_data.

END-OF-SELECTION.

   PERFORM disply_data.

*&---------------------------------------------------------------------*

*&      Form  select_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM select_data .

   SELECT * FROM vbak

   INTO CORRESPONDING FIELDS OF TABLE ti_client UP TO 3 ROWS .

   IF NOT ti_client[] IS INITIAL.

     SELECT *

     FROM vbap

     INTO CORRESPONDING FIELDS OF TABLE ti_commande

     FOR ALL ENTRIES IN ti_client

     WHERE vbeln = ti_client-vbeln.

   ENDIF.

ENDFORM.                    "select_data

*&---------------------------------------------------------------------*

*&      Form  disply_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM disply_data .

   wa_keyinfo-header01 = 'VBELN'.

   wa_keyinfo-item01 = 'VBELN'.

   CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

     EXPORTING

       i_callback_program      = sy-cprog

       is_layout               = it_layout

       it_fieldcat             = it_field_cat

       i_tabname_header        = 'VBAK'

       i_tabname_item          = 'VBAP'

       i_structure_name_header = 'VBAK'

       i_structure_name_item   = 'VBAP'

       is_keyinfo              = wa_keyinfo

     TABLES

       t_outtab_header         = ti_client

       t_outtab_item           = ti_commande.

ENDFORM. " DISPLY_DATA


0 Kudos
131

thank you for explanation

excellent

good job