2008 Aug 20 12:29 PM
I want to display three blocks in my BLOCK List Display regarding purchase orders data and two summaries. Can anybody please mention me in brief all the steps that will be required to build the display?
Steps Required:
Function Module Declarations.
Parameters passed to function modules, etc.
2008 Aug 20 12:33 PM
Hi yogesh,
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.
I want to display three blocks in my BLOCK List Display regarding purchase orders data and two summaries. Can anybody please mention me in brief all the steps that will be required to build the display?
Steps Required:
Function Module Declarations.
Parameters passed to function modules, etc.
2008 Aug 20 12:32 PM
hi ,
report z_alv_blocked.
tables: vbrk.
data: begin of it_vbrk1 occurs 0,
vbeln like vbrk-vbeln,
end of it_vbrk1.
data: begin of it_vbrk2 occurs 0,
vbeln like vbrk-vbeln,
vtweg like vbrk-vtweg,
end of it_vbrk2.
select-options : doc for vbrk-vbeln.
type-pools: slis.
data: fc type slis_t_fieldcat_alv.
data: fc1 type slis_t_fieldcat_alv.
data: wa1 like line of fc.
data: wa2 like line of fc1.
data: it_layout type slis_layout_alv.
data: it_event type slis_t_event.
data: wa_event type slis_alv_event.
select * up to 31 rows from vbrk
into corresponding fields of table it_vbrk1
where vbeln in doc.
select * up to 31 rows from vbrk
into corresponding fields of table it_vbrk2
where vbeln in doc.
wa1-fieldname = 'VBELN'.
wa1-seltext_l = 'DOCUMENT NUMBER'.
append wa1 to fc.
wa_event-name = 'TOP_OF_PAGE'.
wa_event-form = 'TOP_OF_PAGE1'.
append wa_event to it_event.
call function 'REUSE_ALV_BLOCK_LIST_INIT'
exporting
i_callback_program = sy-repid.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = it_layout
it_fieldcat = fc
i_tabname = 'IT_VBRK1'
it_events = it_event
tables
t_outtab = it_vbrk1.
refresh it_event.
wa2-fieldname = 'VBELN'.
wa2-seltext_l = 'DOCUMENT NUMBER'.
append wa1 to fc1.
wa2-fieldname = 'VTWEG'.
wa2-seltext_l = 'NET WEIGHT'.
append wa2 to fc1.
wa_event-name = 'TOP_OF_PAGE'.
wa_event-form = 'TOP_OF_PAGE2'.
append wa_event to it_event.
call function 'REUSE_ALV_BLOCK_LIST_APPEND'
exporting
is_layout = it_layout
it_fieldcat = fc1
i_tabname = 'IT_VBRK2'
it_events = it_event
tables
t_outtab = it_vbrk2.
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
form top_of_page1.
format color col_positive.
write: / 'FIRST BLOCK'.
endform.
form top_of_page2.
format color col_total.
write: / 'SECOND BLOCK'.
endform.
2008 Aug 20 12:33 PM
2008 Aug 20 12:33 PM
Hi yogesh,
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.
2008 Aug 20 12:37 PM
Hi,
1.Declare all the data and internal tables.
2. use this FM and export the progrom name.
REUSE_ALV_BLOCK_LIST_INIT'
3.declare field catalog for each block.
4.use the below FM three times.
REUSE_ALV_BLOCK_LIST_APPEND
And remaining all as a normal report.
Regards,
Sathish Reddy.
2008 Aug 20 12:38 PM
Functions useful
1. Call the Block list init
BLOCK LIST INIT
REUSE_ALV_BLOCK_LIST_INIT
2. Append the lists. <----If you have n number of block, accordingly you will append using the append function.
APPEND
REUSE_ALV_BLOCK_LIST_APPEND
REUSE_ALV_BLOCK_LIST_HS_APPEND
3. Display the List.
DISPLAY
REUSE_ALV_BLOCK_LIST_DISPLAY
Use the Program BALVBT01.