Unaware of the ALV report in SAP ABAP? Then this is the right tutorial to check what is SAP ABAP list view report and how to create a structure in the ALV report.
And finally, you can check How to Create SAP ABAP List View Report and call the structure in the ALV report from SAP ABAP.
Also, Read: How to Create a Package in SAP ABAP
Introduction to ALV Report in SAP ABAP
ALV (ABAP List View) report is one of the methods of showing the SAP table in a reporting manner. ALV reports are generally used in the different standard and custom transactions in all the modules.
Functions of ALV Report in SAP ABAP
- Sorting of the records
- Filtering
- Changing the columns
- Hiding the columns
- Changing the order of columns
- Downloading reports in HTML or Excel format.
Limitations in ALV Report
- 255 characters can be shown on a column of the report.
- In one single report, we can show 90 columns.
- Compares to the ALV grid display, the ALV list display will be effective.
Simple ALV Report in SAP ABAP
Here we will see how to create a simple ALV report in SAP ABAP. But it is mandatory to create a structure for the table before getting into ALV Report in SAP ABAP.
Check out: How to Create Table Maintenance Generator in SAP ABAP
Create a Structure in SAP ALV Report
Follow the below steps to create a structure in the SAP ALV report.
Step-1:
Open SAP ABAP and on the home page type the se11 transaction code on the left side of the search bar and hit enter.
Step-2:
Here we are taking the example of company code T001 (Transaction Code) and for creating a structure, give the name which starts with Z in the Datatype field and click Create.
Step-3:
Next, it will ask us to choose Structure from the list of options and click the tickmark down.
Step-4:
Once, we click on Structure, Dictionary: Change Structure page will appear. Here type the short description as Company Code Details.
Then copy and paste the fields in the T001 table and paste it in the component and component type. Also, give the typing method as Types on the same page.
Step-5:
In this step, save this table by CTRL+S in the local object or in a package for creating an ALV report in SAP ABAP.
Step-6:
After saving the structure, we have to activate the structure to proceed with the next step to create an ALV report. Activate the table by clicking CTRL+F3 and clicking Tickmark at the end of the page.
This is the method to create a structure for the table that we are using in the ALV report in SAP ABAP.
Have a look: How to Create Lock Object in SAP ABAP?
Create ALV Report in SAP ABAP
We can start creating a simple ALV report in SAP ABAP by the usual method. Follow the below steps to do so.
Step-1:
Open SAP ABAP and on the home page type the Se38 transaction code on the left side of the search bar and hit enter.
Step-2:
Give the report name starting with Z and click Create. Here I have taken ZCC_T001_ALV (Since this is an ALV report for the company code T001, So I have chosen this). Naming conventions are at the user’s convenience.
Step-3:
Give a short description as the ALV report and choose the type of program as Executable Program and click Save at the down of the page.
Step-4:
Now, we can see the screen with our ALV report name on the ABAP Editor page.
Step-5:
Give the table name and start declaring the internal table and Work area. But every time we do not need to declare the table name, it depends upon the user’s wish. Here my table name is T001.
Tables: T001.
DATA: IT_T001 TYPE STANDARD TABLE OF ZST_TOO1,***We are declaring Structure name here****
WA_T001 TYPE ZST_TOO1.
Step-6:
Write the Select statement to declare the field name in the ALV report.
SELECT
BUKRS
BUTXT
ORT01
LAND1
FROM T001 INTO TABLE IT_T001
WHERE BUKRS IN S_BUKRS.
Step-7:
Once this is done, we have to save and activate it to move to the next step. Save by CTRL+S and activate by CTRL+F3.
Step-8:
Click on the Pattern on the ABAP editor at the top of the page. In the CALL FUNCTION column give the name REUSE_ALV_GRID_DISPLAY and click Tickmark at down.
Step-9:
Once we call the function in our ALV program, our screen will appear like the below image.
Step-10:
Here we have to uncomment the word EXPORTING and I_STRUCTURE_NAME then we have to the structure name as ZST_T001 that we created before the ALV report.
Step-11:
Give the internal table as IT-T001 in the t_outtab at the end of the report.
Step-12:
Save the ALV report by CRTL+S and activate it by CTRL+F3. Now check the Output by clicking the F8 key.
This is how we can create an ALV report in SAP ABAP.
Also, you may like some more SAP ABAP and SAP HANA tutorials:
- How to Create a Foreign Key in SAP ABAP
- How to Create Table in SAP ABAP [With Columns]
- How to Install ABAP Development Tools
- SAP HANA Cloud ABAP Environment
- Operators in SAP HANA Cloud
Conclusion
This is a simple ALV report in SAP ABAP. We just created an internal table with a select statement and called a function in the SAP ALV report. Below are the topics covered in this tutorial.
- Introduction to ALV report
- Functions of ALV report
- Limitations in the ALV report
- How to create a structure for the ALV report
- How to create an ALV report in SAP ABAP
I am Chris Waldron, working as a Senior SAP HANA Consultant at Halliburton, Houston, Texas, United States. I have been working in SAP for more than 15 years, especially in SAP IT consulting and business consulting. I worked in various industries in Sales & Distribution, Customer Relationship Management, banking, Risk Management, etc. And I am an SAP Certified Development Specialist – ABAP for SAP HANA 2.0 and SAP HANA Modeling Certified consultant. Read more