Google Search - Blog...........

ABAP - Display Report Program In Different Formats

report zalv_sample .

tables vbak.

data it_vbak like vbak occurs 0 with header line.

selection-screen begin of block b1 with frame.
parameters: list radiobutton group alv, "REUSE_ALV_LIST_DISPLAY
popup radiobutton group alv, "REUSE_ALV_POPUP_TO_SELECT
grid radiobutton group alv, "REUSE_ALV_GRID_DISPLAY
normal radiobutton group alv. " NORMAL DISPLAY
selection-screen end of block b1.

select * from vbak
into corresponding fields of table it_vbak
up to 10 rows.

if list = 'X'.
perform alv_func1.

elseif popup = 'X'.
perform alv_func2.

elseif grid = 'X'.
perform alv_func3.

elseif normal = 'X'.
perform norm.

endif.

*&---------------------------------------------------------------------*
*& Form ALV_FUNC1
*&---------------------------------------------------------------------*
form alv_func1 .


call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'VBAK'
tables
t_outtab = it_vbak
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.


endform. " ALV_FUNC1



*&---------------------------------------------------------------------*
*& Form ALV_FUNC2
*&---------------------------------------------------------------------*
form alv_func2 .

call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'SALES ORDER INFO'
i_zebra = 'X'
i_tabname = 1
i_structure_name = 'vbak'
tables
t_outtab = it_vbak
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.


endform. " ALV_FUNC2



*&---------------------------------------------------------------------*
*& Form ALV_FUNC3
*&---------------------------------------------------------------------*
form alv_func3 .

call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'vbak'
i_grid_title = 'SALES ORDER INFO'
tables
t_outtab = it_vbak
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.


endform. " ALV_FUNC3

*&---------------------------------------------------------------------*
*& Form NORM
*&---------------------------------------------------------------------*
form norm .
format intensified.
skip 1.
write: /'SALES DOC.',
' Created on ',
' Time',
' Created by',
' Valid from ',
' Sold-to party'.
format intensified off.
skip 2.

loop at it_vbak.

write: / it_vbak-vbeln,' ',
it_vbak-erdat,' ',
it_vbak-erzet,' ',
it_vbak-ernam,' ',
it_vbak-angdt,' ',
it_vbak-kunnr.

endloop.


ALSO READ:

- ALV Pop Up To Select The Options & Display Them.

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.

No comments:

Post a Comment