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

Reports

Former Member
0 Likes
433

Dear sirs,

How can we develop a blocked ALV report to display sales data and invoice details in a single output list? give me a good example

tanking u sirs

3 REPLIES 3
Read only

Former Member
0 Likes
409

Hi sridhar,

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.

Read only

gopi_narendra
Active Contributor
0 Likes
409

Check this program BALVBT01

Regards

Gopi

Read only

Former Member
0 Likes
409

Hi,

Using blocked alv's we can genarate multiple reports under one executable program.

we use these functin modules while working with blocked alv's.

REUSE_ALV_BLOCK_LIST_INIT.

with this FM user can initiative blocks required for output dispaly.

REUSE_ALV_BLOCK_LIST_DISPALY.

with this FM user can dispalys the blocks in layout.

REUSE_ALV_BLOCK_LIST_APPEND.

with this FM blocks can be appended blocked alv's.

FOR Sample program follow these links.........

http://www.sap-basis-abap.com/abap/sample-program-on-block-lists.htm

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap-ProgramforALVBlocklist&

regards,

SAnkar