当前位置:网站首页>ALV report in SAP tutorial - ABAP list viewer -012

ALV report in SAP tutorial - ABAP list viewer -012

2022-06-22 16:22:00 Boating in rainy days

SAP In the tutorial ALV The report - ABAP List viewer -012

A common required feature of any report is “ Column alignment ”, Sort , Filter , Subtotal , Total, etc . To do this from scratch , A lot of coding work is required . To avoid that , We can use one called ABAP List viewer (ALV) The concept of .

In this tutorial , You will learn :

  • Simple report
  • Block report
  • Tiered reporting
  • Show variations

Each of these reports provides Function module , These modules help to easily generate the required output . Let's take a closer look at them -

Simple report

The important functional modules in these reports are –

  • Reuse_alv_fieldcatalog_merge
  • Reuse_alv_list_display
  • Reuse_alv_events_get
  • Reuse_alv_grid_display
  • Reuse_alv_commentary_write

REUSE_ALV_FIELDCATALOG_MERGE
This function module is used to populate the field directory , This is true of ALV It is important to display data in .
If the output data comes from a single dictionary table , And all columns are selected , Then we do not need to create the field directory exclusively . stay REUSE_ALV_LIST_DISPLAY Take the table name as a parameter (I_structure_name) Mention is enough . But in other cases , We need to create it .

Be careful : Field directories can also be manually populated by populating the internal table with all the required details

The important parameters in :

1. exit :

  • I_program_name: The report ID
  • I_internal_tabname: Internal output table
  • I_inclname: contain Or the name of the report that processes all dynamic forms .

2. change

  • ct_fieldcat : The type is SLIS_T_FIELDCAT_ALV The internal table of , In type pool SLIS In a statement .

REUSE_ALV_LIST_DISPLAY
This is the function module for printing data .
Important parameters are :

1. exit :

  • I_callback_program: The report ID
  • I_bypassing_buffer : ‘X’
  • I_buffer_active : ’ ’
  • I_callback_pf_status_set : routine , Users can set their own pf Status or change existing pf Function of state .
  • I_callback_user_command: Routines that handle function code .
  • I_structure name : The name of the dictionary table
  • Is_Layout: Set the structure of the report layout
  • It_fieldcat: Internal tables , It contains a list of all fields to be printed and their attributes ( This table can be automatically populated by functions )
  • It_events : Internal table , It includes ALV A list of all possible events and their corresponding form names .

2. form :

  • a. t_outtab: Internal table containing the data to be output

REUSE_ALV_EVENTS_GET:
Returns a table of possible events of list type

1. Import :

Et_Events : The event table will return the specified list type ( Column “NAME”) All possible callback events for . For the event to be handled by the callback , Its... Must be filled in “FORM” Field . If the field is initialized , Then ignore the event . This entry can be read from the event table , Fill in fields “FORM”, And use the type pool SLIS The constants in modify the entry .

2. exit :

I_list_type:0 = Simple list REUSE_ALV_LIST_DISPLAY
1 = Hierarchical order list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = Simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = Hierarchical order block list REUSE_ALV_BLOCK_LIST_HS_APPEND

REUSE_ALV_GRID_DISPLAY
ABAP4.6 New features in version , Used to display results in a grid , Instead of previewing .
Parameters : And reuse_alv_list_display identical

Be careful : The grid cannot handle high volumes . Sorting and other functions , If the amount of data to be displayed is very high , Scrolling down consumes a lot of resources / Time . There is no clear definition , If the amount of data is X, Then select a list or grid , But the developer must call it based on his experience . If not sure , Then the list is a better choice

REUSE_ALV_COMMENTARY_WRITE
This is in “ The first page ” Event to print the title and other comments of the list .
Important parameter

  • It_list_commentary : The title is slis_t_listheader Internal table for .
    This internal table has three fields :
  1. type : ‘H’ – title , ‘S’ – choice , ‘A’ – action
  2. key : Only if the typical value is “S” when .
  3. Information : Text to print

Block report

This looks like a simple report , But this report only has sorting and filtering functions . If you have to display multiple reports on the output , Use this report . Technically speaking , If you have multiple internal tables , The data is displayed as separate blocks , Then we will choose ALV Block report for .

Important functions for creating this report include :

  • REUSE_ALV_BLOCK_LIST_INIT
  • REUSE_ALV_BLOCK_LIST_APPEND
  • REUSE_ALV_BLOCK_LIST_DISPLAY

REUSE_ALV_BLOCK_LIST_INIT
This function module is used to set the default GUI State, etc . These parameters are similar to reuse_alv_list_display or reuse_alv_grid_display

REUSE_ALV_BLOCK_LIST_APPEND
This function module adds data to the block .
Important parameter
1. exit :

  • is_layout: Block layout settings
  • it_fieldcat: Field Directory
  • I_tabname: Internal table name containing all possible events
    2. form :
  • t_outtab: Internal table containing output data .

REUSE_ALV_BLOCK_LIST_DISPLAY
This function module displays a list containing the data attached to the above function .
Parameters : All parameters are optional .

Tiered reporting

Hierarchical display is used to display relevant data . Such as sales order and material details . here , Sales order details can be header data , The items in the sales order can be item data
The function modules used for this purpose are

REUSE_ALV_HIERSEQ_LIST_DISPLAY
exit :

  • I_CALLBACK_PROGRAM
  • I_CALLBACK_PF_STATUS_SET
  • I_CALLBACK_USER_COMMAND
  • IS_LAYOUT
  • It_fieldcat
  • It_events
  • I_tabname_header : The name of the internal table in the program that contains the highest hierarchy level output data .
  • I_tabname_item : The name of the internal table in the program that contains the output data at the lowest hierarchy level .
  • Is_keyinfo: This structure contains links between two tables ( Share key ) Title and item table field name .

surface

  • t_outtab_header: Picture table to output data
  • t_outtab_item : The name of the internal table in the program that contains the output data at the lowest hierarchy level .

Internal table 、 All definitions of structures and constants are in the name SLIS Declared in the type pool of . have access to REUSE_ALV_FIELDCATALOG_MERGE Auto populate this internal table .

Show variations

  • Show variations for setting alv Default properties for output , Such as sorting conditions 、 Filter conditions 、 Total and subtotal, etc
  • Display variations can be user specific and standard ( Standard variants can be used by any user )
  • The display variant type that can be saved is determined by the parameters passed in the function module i_save control reuse_alv_list_display/ reuse_alv_grid_display
  • You can provide an option on the selection screen , To select the display variant to use

And selection / Verify that the common functional modules related to display variants are

  1. Reuse_alv_variant_default_get
  2. Reuse_alv_variant_f4
  3. Reuse_alv_variant_existence

This is it. ABAP-ALV The whole content of programming !
Reference resources :https://www.guru99.com/alv-list-view-programming.html

原网站

版权声明
本文为[Boating in rainy days]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221500488977.html