ALV report Introduction

Source: Internet
Author: User

1. What is Alv?

SAP provides a set of ALV (Application List viewer.) functional modules that can modify the output report style to improve the readability and functionality of the report output.ProgramIs a very efficient tool. Generally, an ALV report has a header, added the content in the table above, and added some preset functions such as sorting, Category summary, sum or download as a local file. ALV reports are displayed in two ways: grid and list. Different functions are called respectively.

Ii. ALV Style

1. reuse_alv_grid_display

 

2. reuse_alv_list_display

 

3. ALV Toolbar

 

Iii. Call the ALV Function

After extracting or uploading data from the database and storing the data in the internal table (it_abc), call the following ALV function module.

1. Specify a data type group

Type-pools: slis.

Data:

It_fieldcat type slis_t_fieldcat_alv, "used for editing the ALV output project

Wa_fieldcat type slis_fieldcat_alv, "used for editing the ALV output project

Wa_layout type slis_layout_alv. "used for ALV style setting

2. Call up the function module

Call function 'reuse _ alv_list_display'

Exporting

Is_layout = wa_layout

It_fieldcat = it_fieldcat

Tables

T_outtab = it_tab.

......

3. Descriptions of functions

Call function 'reuse _ alv_list_display'

Exporting

I _structure_name = the structure already exists in the SAP system

Is_layout = Layout

It_fieldcat = custom

It_sort = sort items

It_events = title

......

Iv. Notes for using ALV

1. in Alv, you must note that all columns to be displayed must have corresponding fields in the corresponding internal table. Otherwise, the program will crash as long as the total or classified summary is used.

2. in the sap ABAP program, the Case sensitivity of strings is very important. In strings enclosed by single quotes, uppercase should be generally used, especially when you call some system methods to input string parameters, for example, in ALV,

Call function 'reuse _ alv_grid_display,

The following two parameters are passed in:

I _callback_pf_status_set = 'set _ pf_status'

I _callback_user_command = 'user _ command'

You must use an upper-case string. Otherwise, the system error of using m_not_found will occur.

3. In addition, the field names of columns passed in to ALV must also use uppercase letters. Otherwise, the data will not be displayed.

V. Description of relevant parameters

1. construct common slis_fieldcat_alv Parameters

Clear wa_fieldcat.

WA_FIELDCAT-FIELDNAME = 'mtart'. "specifies the data item that is output from the inner table

WA_FIELDCAT-SELTEXT_L = 'item too long before '.' specifies the name (long text) when the project is displayed above)

WA_FIELDCAT-SELTEXT_M = 'item listing output'. 'specifies the name (medium text) when the project is displayed above)

WA_FIELDCAT-SELTEXT_S = 'item listing output'. The name of the project displayed above (short article)

WA_FIELDCAT-REPTEXT_DDIC = 'item listing output'. 'specifies the name (definition text) when the project is displayed above)

WA_FIELDCAT-OUTPUTLEN = 15. The display width of the column

WA_FIELDCAT-HOTSPOT = 'x'. "Set hotspot status

......

Append wa_fieldcat to it_fieldcat.

Note: To display the number of project columns, You need to append records to the internal table it_fieldcat.

2. construct common slis_layout_alv Parameters

Layout-Zebra = 'x'. "zebra crossing Style

LAYOUT-COLWIDTH_OPTIMIZE = 'x'. The column width is automatically optimized based on content

LAYOUT-NO_COLHEAD = 'x'. The column name is not displayed

LAYOUT-NO_VLINE = 'x'. "does not represent a vertical line for distinction

Layout-edit = 'x'. "The column value can be edited and used only for grid.

LAYOUT-WINDOW_TITLEBAR = 'alv form title'. 'line

......

6. Commonly called Parameters

Call function 'reuse _ alv_list_display'

Exporting

It_fieldcat = it_fieldcat "output project column text information (header)

Is_layout = l_layout "output list style information

Tables

T_outtab = it_alvout "output data (details)

Exceptions

Program_error = 1

Others = 2.

Another simple method:

Call function 'reuse _ alv_grid_display'

Exporting

I _structure_name = 'ty _ out_file '"output text information of the Project column (header)

Is_layout = l_layout "output list style information

Tables

T_outtab = tab_out_file "output data (details)

Exceptions

Program_error = 1

Others = 2.

Note: The ty_out_file structure must be an existing object in the data dictionary.

When there are many output items, we recommend that you create a structure in the data dictionary system and then use the latter method to call it. This eliminates the need for tedious editing and processing of the output list header information.CodeThe rows are also shortened.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.