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: 

Dynamic ALV using REUSE_ALV_HIERSEQ_LIST_DISPLAY

Former Member
0 Kudos

Hi All,

My requirement is to display a dynamic output table using REUSE_ALV_HIERSEQ_LIST_DISPLAY.

I was able to successfully display the dynamic output in grid display using REUSE_ALV_GRID_DISPLAY. But when I try to display the hierarchial list, then only the T_OUTTAB_HEADER data is getting displayed. The T_OUTTAB_ITEM is not getting displayed.

I am creating the dynamic table using

CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

EXPORTING

IT_FIELDCATALOG = I_FIELDCAT_DYN

IMPORTING

EP_TABLE = I_DYNTABLE

ALV Display:

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

I_INTERFACE_CHECK = G_INTERFACE_CHECK

I_CALLBACK_PROGRAM = ALV_REPID

I_CALLBACK_PF_STATUS_SET = 'SET_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IS_LAYOUT = ALV_LAYOUT

IS_PRINT = ALV_PRINT

IT_FIELDCAT = FC_HIER[]

I_DEFAULT = 'X'

I_SAVE = 'A'

IS_VARIANT = ALV_VARIANT

IT_EVENTS = GT_EVENTS[]

I_TABNAME_HEADER = 'HEADER'

I_TABNAME_ITEM = 'LIST'

IS_KEYINFO = ALV_KEYINFO

TABLES

T_OUTTAB_HEADER = HEADER[]

T_OUTTAB_ITEM = <I_FS_DYNOUT>

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

Any pointers in this regard will be helpful. Also any existing code for dynamic ALV for grid display, will be helpful.

Thanks & Regards,

Sonali.

8 REPLIES 8

Former Member
0 Kudos

Hi Sonali,

See demo prog SALV_DEMO_HIERSEQ*.

Regrads,

Amitava

0 Kudos

Hi,

pls check the IS_KEYINFO = ALV_KEYINFO information.

A key which is primary/foreign key relation must exit between

Header and Item table, that key information have to be provide

in the ALV_KEYINFO filed.

0 Kudos

Hi darj4abap,

The ALV_KEYINFO is also filled in with the field names and passed to the FM.

When I was calling this FM REUSE_ALV_HIERSEQ_LIST_DISPLAY with static output table, it was displaying data correctly.

Later I changed the field catalogue and made the output table dynamic. After that it is not displaying the item data at all.

Thanks & Regards,

Sonali.

0 Kudos

>

> Later I changed the field catalogue and made the output table dynamic. After that it is not displaying the item data at all.

Hello,

How can you've a static field catalog for a dynamic table? Anyway why do you want the table to be dynamic?

BR,

Suhas

Former Member
0 Kudos

Hi Sonali,

I would believe that if the header is appearing but the item details does not, there must be an issue with key info. How about the key info. Should n't that be dynamic as well?

Check the demo program

BCALV_TEST_HIERSEQ_LIST

BCALV_TEST_HIERSEQ_LIST_EVENTS

Hope it helps.

Sujay

Former Member
0 Kudos

Hi,

I think you are making a mistake here.

You have written

I_TABNAME_ITEM = 'LIST'

T_OUTTAB_ITEM = <I_FS_DYNOUT>

Try this.

I_TABNAME_ITEM = <I_FS_DYNOUT>

T_OUTTAB_ITEM = <I_FS_DYNOUT>

Same name should be passed to the tables and exporting parameter

Thanks,

Ibrahim

0 Kudos

Hi All,

Thanks for your inputs.

All those demo programs are for displaying static output table. I need to display dynamic internal table.

Also the table name LIST / <I_FS_DYNOUT> does not make a difference.

Actually there is an existing tcode MB51. In this report first there is a list display, then when u click on detail button, then there is a grid display.

I had to modify this report to add some more columns.

So I made a copy and added few more columns to the output table dynamically.

now when I pass data for list display to REUSE_ALV_HIERSEQ_LIST_DISPLAY, then my list display shows only header data. And when I click on u201Cdetailsu201Dbutton, then the grid display that comes, shows all the data. So the grid display is displaying the dynamic output table contents correctly.

But the same output table isnt getting displayed in list display.

Any pointers?

Thanks & Regards,

Sonali Gupta.

Former Member
0 Kudos

Hi Sonali,

See the code .


REPORT  zamit_test6.
DATA: gr_table TYPE REF TO cl_salv_hierseq_table.
DATA: iscarr TYPE TABLE OF scarr.
DATA: isflight TYPE TABLE OF sflight.
DATA: ibinding TYPE salv_t_hierseq_binding.
DATA: xbinding TYPE salv_s_hierseq_binding.

FIELD-SYMBOLS : <fs> type any table.

SELECT * INTO TABLE iscarr FROM scarr.
SELECT * INTO TABLE isflight FROM sflight.

  assign isflight to <fs>.

  xbinding-master = 'CARRID'.
  xbinding-slave = 'CARRID'.
  APPEND xbinding TO ibinding.

cl_salv_hierseq_table=>factory(
EXPORTING t_binding_level1_level2 = ibinding
  IMPORTING r_hierseq = gr_table
    CHANGING
    t_table_level1 = iscarr
    t_table_level2 = <fs> ).

gr_table->display( ).

Regards,

Amitava