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: 

alv report

Former Member
0 Kudos

hi to all,

i need to run alv report how can i ? and where can i see the output.

thanx

lokanadhan.k

8 REPLIES 8

Former Member
0 Kudos

Hi,

It is like running normal report..

GO to se38..Give the alv report name..

Press F8..

If there is any selection-screen give the values and press F8..

To see the alv report..

Thanks,

Naren

Former Member
0 Kudos

you need the name of the report. goto se38 and enter the report name and press F8. You also need to know some test data to input in the initial selection screen if there is any.

Thanks,

Ganesh.

Former Member
0 Kudos

GOTO SE38 Transaction :

use sample ALV program : BCALV_FULLSCREEN_DEMO

and press F8(Execute) and you will get output.

Former Member
0 Kudos

Hi,

AlV report is no different from classical reports.

Pass the input values.

The only difference you get with ALV reports are some standard functionality like sorting etc these are provided by sap

Award points if helpful

Thanks

venki

Former Member
0 Kudos

Hi,

You can run the ALV report in the same way as you run the classical report but the format it displays is different.

reward points if is helpful.

regards,

sangeetha.a

Former Member
0 Kudos

Hi Lokanadhan,

Copy paste this sample code in se38.

Activate and Just give F8.

REPORT zeasalv_01 .

<b>DATA : i_vbrk LIKE vbrk OCCURS 0.

SELECT * FROM vbrk INTO TABLE i_vbrk.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_structure_name = 'vbrk'

TABLES

t_outtab = i_vbrk

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.</b>

If you need more info,

Give ur mail id,

so that i can send some documents regarding alv.

<b>Reward if it useful</b>.

<b>Regards,

Jackie.</b>

Message was edited by:

Jackie Chan

Former Member
0 Kudos

Hi,

Check out the simple alv report codings,

Goto se38 copy this codings into your report.

then go for F2 and F3

then F8 which will execute your report

in output list through ALV Grid..

TABLES : vbak,vbap.

TYPE-POOLS : slis.

DATA: repid LIKE sy-repid, "Report ID

is_layout TYPE slis_layout_alv, "Layout For ALV

it_fieldcat TYPE slis_t_fieldcat_alv, "ITAB for field

it_events TYPE slis_t_event, "ITAB for event

it_sub TYPE slis_layout_alv_spec1, "subtotals

i_header TYPE slis_t_listheader, "Itab for listheader

lt_sort TYPE slis_t_sortinfo_alv, "itab for sorting

wa_sort LIKE LINE OF lt_sort." slis_t_sortinfo_alv.

DATA : BEGIN OF itab OCCURS 0,

vbeln LIKE vbak-vbeln,

erdat LIKE vbak-erdat,

kunag LIKE vbak-kunnr,

ernam LIKE vbak-ernam,

END OF itab.

DATA : BEGIN OF it_disp OCCURS 0,

vbeln LIKE vbak-vbeln,

erdat LIKE vbak-erdat,

kunag LIKE vbak-kunnr,

ernam LIKE vbak-ernam,

posnr LIKE vbap-posnr,

matnr LIKE vbap-matnr,

END OF it_disp.

****selection-screen

SELECTION-SCREEN BEGIN OF BLOCK b1.

SELECT-OPTIONS : s_vbeln FOR vbak-vbeln,

s_date FOR vbak-erdat.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.

START-OF-SELECTION.

PERFORM get_data.

PERFORM modify_data.

PERFORM disp_data .

END-OF-SELECTION.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data .

SELECT avbeln aerdat akunnr aernam bposnr bmatnr

INTO TABLE it_disp FROM vbak AS a

INNER JOIN vbap AS b ON

avbeln = bvbeln

WHERE a~vbeln IN s_vbeln.

ENDFORM. " get_data

&----


*& Form modify_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM modify_data .

MOVE-CORRESPONDING itab TO it_disp.

APPEND it_disp.

CLEAR it_disp.

ENDFORM. " modify_data

&----


*& Form Disp_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM disp_data .

PERFORM fill_layout_structure.

PERFORM fill_field_catalog_table.

PERFORM alv_header USING i_header.

PERFORM call_alv_function.

ENDFORM. " Disp_data

&----


*& Form fill_layout_structure

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_layout_structure .

CLEAR is_layout.

is_layout-colwidth_optimize = 'X'.

is_layout-zebra = 'X'.

is_layout-no_input = 'X'.

is_layout-colwidth_optimize = 'X'.

is_layout-totals_text = 'Totals'(201).

is_layout-totals_only = 'X'.

is_layout-zebra = 'X'.

is_layout-group_change_edit = 'X'.

is_layout-header_text = 'helllllo'.

ENDFORM. " fill_layout_structure

&----


*& Form fill_field_catalog_table

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_field_catalog_table .

DATA : gls1(10).

  • BREAK-POINT.

PERFORM fill_field_catalog USING :

'VBELN' 'SALES DOC NO.' '10' 'IT_FINAL' space space 'C11' ' ' ' ',

'ERDAT' 'DATE' '40' 'IT_FINAL' space space 'C11' ' ' ' ',

'KUNAG' 'CUSTOMER' '6' 'IT_FINAL' space space 'C11' 'X ' ' ',

'ERNAM' 'NAME' '20' 'IT_FINAL' space space 'C11' 'X' ' ',

'POSNR' 'ITEM' '10' 'IT_FINAL' space space 'C11' ' ' ' ',

'MATNR' 'MATERIAL' '20' 'IT_FINAL' space space 'C11' ' ' ' '.

ENDFORM. " fill_field_catalog_table

&----


*& Form fill_field_catalog

&----


  • text

----


FORM fill_field_catalog USING f d l t s z y a b.

DATA t_fld TYPE slis_fieldcat_alv.

STATICS pos LIKE sy-index VALUE 0.

pos = pos + 1.

CLEAR t_fld.

MOVE 1 TO t_fld-row_pos.

MOVE pos TO t_fld-col_pos.

MOVE f TO t_fld-fieldname.

MOVE d TO t_fld-seltext_m.

MOVE l TO t_fld-outputlen.

MOVE t TO t_fld-tabname.

MOVE s TO t_fld-do_sum.

MOVE z TO t_fld-no_zero.

MOVE y TO t_fld-emphasize.

MOVE a TO t_fld-no_out.

MOVE b TO t_fld-no_sum.

APPEND t_fld TO it_fieldcat.

ENDFORM. " fill_field_catalog

&----


*& Form alv_header

&----


  • text

----


  • -->P_I_HEADER text

----


FORM alv_header USING p_i_header.

DATA: wa_line TYPE slis_listheader.

CLEAR wa_line.

wa_line-typ = 'H'.

wa_line-info = 'Walvoil Fluid Power India Limited'.

APPEND wa_line TO i_header.

ENDFORM. " alv_header

&----


*& Form call_alv_function

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM call_alv_function .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

I_CALLBACK_PF_STATUS_SET = ' '

IS_LAYOUT = IS_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

TABLES

t_outtab = IT_DISP.

IF sy-subrc <> 0.

ENDIF.

ENDFORM. " call_alv_function

Reward if this is useful to u,

Best Wishes

Regards,

Guna,

Former Member
0 Kudos

Hi lok,

Check out the simple alv report codings,

Goto se38 copy this codings into your report.

then go for check (CTRL + F2) and activate (CTRL + F3)

then execute ( CTRL + F8) which will execute your report

in output list through ALV Grid..

TABLES : vbak,vbap.

TYPE-POOLS : slis.

DATA: repid LIKE sy-repid, "Report ID

is_layout TYPE slis_layout_alv, "Layout For ALV

it_fieldcat TYPE slis_t_fieldcat_alv, "ITAB for field

it_events TYPE slis_t_event, "ITAB for event

it_sub TYPE slis_layout_alv_spec1, "subtotals

i_header TYPE slis_t_listheader, "Itab for listheader

lt_sort TYPE slis_t_sortinfo_alv, "itab for sorting

wa_sort LIKE LINE OF lt_sort." slis_t_sortinfo_alv.

DATA : BEGIN OF itab OCCURS 0,

vbeln LIKE vbak-vbeln,

erdat LIKE vbak-erdat,

kunag LIKE vbak-kunnr,

ernam LIKE vbak-ernam,

END OF itab.

DATA : BEGIN OF it_disp OCCURS 0,

vbeln LIKE vbak-vbeln,

erdat LIKE vbak-erdat,

kunag LIKE vbak-kunnr,

ernam LIKE vbak-ernam,

posnr LIKE vbap-posnr,

matnr LIKE vbap-matnr,

END OF it_disp.

****selection-screen

SELECTION-SCREEN BEGIN OF BLOCK b1.

SELECT-OPTIONS : s_vbeln FOR vbak-vbeln,

s_date FOR vbak-erdat.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.

START-OF-SELECTION.

PERFORM get_data.

PERFORM modify_data.

PERFORM disp_data .

END-OF-SELECTION.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data .

SELECT avbeln aerdat akunnr aernam bposnr bmatnr

INTO TABLE it_disp FROM vbak AS a

INNER JOIN vbap AS b ON

avbeln = bvbeln

WHERE a~vbeln IN s_vbeln.

ENDFORM. " get_data

&----


*& Form modify_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM modify_data .

MOVE-CORRESPONDING itab TO it_disp.

APPEND it_disp.

CLEAR it_disp.

ENDFORM. " modify_data

&----


*& Form Disp_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM disp_data .

PERFORM fill_layout_structure.

PERFORM fill_field_catalog_table.

PERFORM alv_header USING i_header.

PERFORM call_alv_function.

ENDFORM. " Disp_data

&----


*& Form fill_layout_structure

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_layout_structure .

CLEAR is_layout.

is_layout-colwidth_optimize = 'X'.

is_layout-zebra = 'X'.

is_layout-no_input = 'X'.

is_layout-colwidth_optimize = 'X'.

is_layout-totals_text = 'Totals'(201).

is_layout-totals_only = 'X'.

is_layout-zebra = 'X'.

is_layout-group_change_edit = 'X'.

is_layout-header_text = 'helllllo'.

ENDFORM. " fill_layout_structure

&----


*& Form fill_field_catalog_table

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fill_field_catalog_table .

DATA : gls1(10).

  • BREAK-POINT.

PERFORM fill_field_catalog USING :

'VBELN' 'SALES DOC NO.' '10' 'IT_FINAL' space space 'C11' ' ' ' ',

'ERDAT' 'DATE' '40' 'IT_FINAL' space space 'C11' ' ' ' ',

'KUNAG' 'CUSTOMER' '6' 'IT_FINAL' space space 'C11' 'X ' ' ',

'ERNAM' 'NAME' '20' 'IT_FINAL' space space 'C11' 'X' ' ',

'POSNR' 'ITEM' '10' 'IT_FINAL' space space 'C11' ' ' ' ',

'MATNR' 'MATERIAL' '20' 'IT_FINAL' space space 'C11' ' ' ' '.

ENDFORM. " fill_field_catalog_table

&----


*& Form fill_field_catalog

&----


  • text

----


FORM fill_field_catalog USING f d l t s z y a b.

DATA t_fld TYPE slis_fieldcat_alv.

STATICS pos LIKE sy-index VALUE 0.

pos = pos + 1.

CLEAR t_fld.

MOVE 1 TO t_fld-row_pos.

MOVE pos TO t_fld-col_pos.

MOVE f TO t_fld-fieldname.

MOVE d TO t_fld-seltext_m.

MOVE l TO t_fld-outputlen.

MOVE t TO t_fld-tabname.

MOVE s TO t_fld-do_sum.

MOVE z TO t_fld-no_zero.

MOVE y TO t_fld-emphasize.

MOVE a TO t_fld-no_out.

MOVE b TO t_fld-no_sum.

APPEND t_fld TO it_fieldcat.

ENDFORM. " fill_field_catalog

&----


*& Form alv_header

&----


  • text

----


  • -->P_I_HEADER text

----


FORM alv_header USING p_i_header.

DATA: wa_line TYPE slis_listheader.

CLEAR wa_line.

wa_line-typ = 'H'.

wa_line-info = 'Walvoil Fluid Power India Limited'.

APPEND wa_line TO i_header.

ENDFORM. " alv_header

&----


*& Form call_alv_function

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM call_alv_function .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

I_CALLBACK_PF_STATUS_SET = ' '

IS_LAYOUT = IS_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

TABLES

t_outtab = IT_DISP.

IF sy-subrc <> 0.

ENDIF.

ENDFORM. " call_alv_function

Reward if this is useful to u,

Best Wishes

Regards,

Guna,