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

alv steps?

Former Member
0 Likes
1,272

can anybody giv the Alv steps?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,206
10 REPLIES 10
Read only

Former Member
0 Likes
1,207
Read only

Former Member
0 Likes
1,206

Refer below link to create sample ALVs: Also, there are many links related to ALVs in this forum.

http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm

Thanks,

Santosh

Read only

Former Member
0 Likes
1,206

Hi,

1) Build the field catalog.

2) Set up the layout (Not mandatory).

3) Have the data for display.

Check this simple ALV program.

TYPE-POOLS: slis.

  • Data declaration.

DATA: BEGIN OF itab OCCURS 0,

vbeln TYPE vbeln,

erdat TYPE erdat,

auart TYPE auart,

netwr TYPE vbak-netwr,

END OF itab.

DATA: wa_kna1 TYPE kna1.

DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.

DATA: s_fieldcatalog TYPE slis_fieldcat_alv.

  • Selection-screen.

PARAMETERS: p_kunnr TYPE kunnr OBLIGATORY.

AT SELECTION-SCREEN.

SELECT SINGLE * FROM kna1 INTO wa_kna1

WHERE kunnr = p_kunnr.

IF sy-subrc <> 0.

MESSAGE s208(00) WITH 'Invalid customer'.

LEAVE LIST-PROCESSING.

ENDIF.

START-OF-SELECTION.

  • Building the field catalog.

s_fieldcatalog-col_pos = '1'.

s_fieldcatalog-fieldname = 'VBELN'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'VBELN'.

s_fieldcatalog-outputlen = '12'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '2'.

s_fieldcatalog-fieldname = 'ERDAT'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'ERDAT'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '3'.

s_fieldcatalog-fieldname = 'AUART'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'AUART'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '4'.

s_fieldcatalog-fieldname = 'NETWR'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'NETWR_AK'.

s_fieldcatalog-do_sum = 'X'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

  • Get the sales orders.

SELECT vbeln erdat auart netwr

FROM

vbak

INTO TABLE itab

WHERE kunnr = p_kunnr.

IF sy-subrc <> 0.

MESSAGE s208(00) WITH 'No records found'.

LEAVE LIST-PROCESSING.

ENDIF.

DATA: v_repid TYPE syrepid.

v_repid = sy-repid.

  • Events

DATA: t_events TYPE slis_t_event,

s_events LIKE LINE OF t_events.

s_events-name = 'TOP_OF_PAGE'.

s_events-form = 'TOP_OF_PAGE'.

APPEND s_events TO t_events.

  • Display the alv

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = t_fieldcatalog

it_events = t_events[]

TABLES

t_outtab = itab.

----


  • FORM TOP_OF_PAGE *

----


  • ........ *

----


FORM top_of_page.

WRITE: / 'Customer - ', p_kunnr.

WRITE: / 'Name - ', wa_kna1-name1.

ENDFORM.

Thanks,

Naren

Read only

Former Member
0 Likes
1,206

Hi Sunil,

Programming Steps:

Declare data areas for list viewer

Declare internal table to store selected data

Select data into internal table

Build field catalog

Build sort catalog

Build event catalog

Start list viewer

STEP 1:

Specifying a field Catalogue

Specify a heading for a report.

Type lvc_title

Create a field catalogue for the report

Table of type slis_t_fieldcat_alv

line_fieldcat-fieldname : Field name

line_fieldcat-tabname : Itab name

line_fieldcat-key : Specifies key

line_fieldcat-seltext_m : Coloumn header

line_fieldcat-hotspot : Indicate hotspot

line_fieldcat-checkbox : Display checkbox

line_fieldcat-edit : Allow editing

STEP 2:

Choosing and saving Layouts

Save options

' ' = No display variants can be saved

'X' = Standard display variants can be saved

'U’ = User-specific display variants can be saved

'A' = Standard & user-specific can be saved

Layout options

Structure type slis_layout_alv

i_layout-colwidth_optimize = 'X' : Opt col width

i_layout-zebra = ‘X’ : Alt color pattern

i_layout-no_vline = ‘X” : No vertical line

STEP 3:

A Simple ALV Program

Using REUSE_ALV_GRID_DISPLAY

Passing minimum parameter

Data to be displayed

Format of Column ( Field Catalogue )

Let ALV set standard PF_status

STEP 4:

Initialize Events

Initialize events

Type slis_t_event

Use event 'TOP_OF_PAGE' to write a header

Type slis_t_listheader

REUSE_ALV_COMMENTARY_WRITE

ALV supports 16 events

Hope this will help.

Regards,

Ferry Lianto

Read only

Former Member
Read only

Former Member
0 Likes
1,206

Hi Sunil,

The best way to learn about ALV and specially ALV using Objects is by studying the standard SAP programs. Type BCALV_GRID_* in reports transaction, you will get a list of 10 programs...with step by step explainations given.

Hope this helps.

Thanks,

Ketan

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,206

Hello Sunil

Search the for term <b>go_docking</b>. I have posted several simple ALV reports showing various aspects of ALV programming.

Regards

Uwe

Read only

Former Member
0 Likes
1,206

Hi,

Check these programs

<b><u><i>ALV Using Function Modules</i></u></b>

BALVHD01 Hierarchical-sequential list flight model

BALVHD01_GROUP Hierarchical-sequential list flight model

BALVSD01 Demo program ALV: Simple list flight model

BALVSD02 ALV demo program: Output flights (simplest version)

BALVSD02_GRID Simple ALV grid control call in fullscreen mode

BALVSD02_SAVE Simple ALV call with storage option

BALVSD03 Simple list

BALVSD04 Simple list (merged)

BALVSD06 Demoprogram ALV: Output flights (simple version + save)

BALVSD11 Demo program ALV: Simple list with interactions and layouts

<b><i><u>ALV Using Object Oriented techniques.</u></i></b>

BCALV_GRID_01 Events for print processing

BCALV_GRID_02 Basic list and details list using one ALV control

BCALV_GRID_03 Detail list in screen of type dialog

BCALV_GRID_04 Display exceptions using LEDs or lights

BCALV_GRID_05 Add a self-defined button to the toolbar

BCALV_GRID_06 Define self-defined context menu

BCALV_GRID_07 Defining a toolbar menu

BCALV_GRID_08 Defining a toolbar menu with default button

BCALV_GRID_09 Control the saving options of layouts

BCALV_GRID_10 Load a layout before list display

BCALV_GRID_11 Test for new layout function modules

BCALV_GRID_AND_POPUP ALV Grid in dialog box

BCALV_GRID_DEMO Simple ALV Control Call Demo Program

Regards,

Vara

Read only

Former Member
0 Likes
1,206

Following are the steps for creating ALV reports.

1. Fill the data which you want to display in the ALV report in asingle internal table.

2. Prepare the fieldcatalog for the fields.

3. Prepare the event catalog list.

4. Call function "REUSE_ALV_GRID_DISPLAY" for displaying the grid display

and pass the appropiate parameters.