Skip to Content
avatar image
Former Member

ALV Block list Display

Hello,

I have a problem in display of a report.

The data in the internal table stored according to the material num. The requirement is such that the material numbers have to be the column heading and the second heading should be new/old. And the list should contain the count of old and new qty of the material.

For eg -

123.123.123

new/old

10 / 20

I have to use block list as there are many lists to be displayed in the same format according to the users' choice. How will i achive it ?

Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    May 25, 2006 at 07:14 AM

    Hi usha,

    1. This simple program will give u an idea

    of block alv.

    2. It will print two alv

    a) itab = table from t001

    b) ptab = table from t000

    3. Just copy paste in new program.

    REPORT zam_temp54 .

    type-pools : slis.

    data : alvfc type slis_t_fieldcat_alv.

    data : alvly type slis_layout_alv.

    data : alvev type slis_t_event .

    *----


    DATA : BEGIN OF itab OCCURS 0.

    include structure t001.

    DATA: END OF itab.

    DATA : BEGIN OF ptab OCCURS 0.

    INCLUDE STRUCTURE t000.

    DATA: END OF ptab..

    *----


    PARAMETERS : a TYPE c.

    *----


    start-of-selection.

    *----


    SELECT DATA

    SELECT * FROM t001 into table itab.

    select * from t000 into table ptab.

    *----


    INIT BLOCK ALV

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

    EXPORTING

    i_callback_program = sy-repid.

    *----


    ADD INTERNAL TABLE ITAB

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = SY-REPID

    I_INTERNAL_TABNAME = 'ITAB'

    I_INCLNAME = SY-REPID

    CHANGING

    CT_FIELDCAT = ALVFC.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    is_layout = alvly

    it_fieldcat = alvfc

    i_tabname = 'ITAB'

    it_events = alvev

    TABLES

    t_outtab = ITAB

    EXCEPTIONS

    program_error = 1

    maximum_of_appends_reached = 2

    OTHERS = 3.

    *----


    ADD INTERNAL TABLE PTAB

    REFRESH ALVFC[].

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

    EXPORTING

    I_PROGRAM_NAME = SY-REPID

    I_INTERNAL_TABNAME = 'PTAB'

    I_INCLNAME = SY-REPID

    CHANGING

    CT_FIELDCAT = ALVFC.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    is_layout = alvly

    it_fieldcat = alvfc

    i_tabname = 'PTAB'

    it_events = alvev

    TABLES

    t_outtab = PTAB

    EXCEPTIONS

    program_error = 1

    maximum_of_appends_reached = 2

    OTHERS = 3.

    *----


    DISPLAY

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    regards,

    amit m.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2006 at 07:42 AM

    Hi!

    As per my understanding, What you could do is to concatenate the new and old into one field so it can be displayed as 10/20. And if you want to multiple windows to be displayed in your report you could use ALV block list. Here is an example:

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

    EXPORTING

    i_callback_program = g_repid

    i_callback_user_command = 'USER_COMMAND'.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    it_fieldcat = gt_fieldcat[]

    is_layout = gs_layout

    i_tabname = 'IT_DELIVERY'

    it_events = gt_events[]

    i_text = '1ST'

    TABLES

    t_outtab = it_delivery.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

    EXPORTING

    it_fieldcat = gt_fieldsum[]

    is_layout = gs_layout

    i_tabname = 'IT_SUM'

    it_events = gt_events_sum[]

    it_sort = gt_sort

    i_text = '2ND'

    TABLES

    t_outtab = it_sum.

    gt_print-reserve_lines = 2.

    gt_print-no_coverpage = 'X'.

    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

    EXPORTING

    is_print = gt_print.

    Add comment
    10|10000 characters needed characters exceeded