
So let's talk about the Grid the above picture shows a pretty typical view a ALV Grid.
Lets go over the different elements of the grid.
- Tool Bar the image to right displays the typical buttons that will be displayed on a grid. The programmer can control what buttons are displayed.
- Then there is the body of the grid here is where the data is displayed. Much the same as a sub file the difference you can put Icons, in the display. Even URL's.
There is so much to this program that I am not even sure I have a good handle on all of it's abilities.
Now lets talk about coding it's important to know that there are two ways of coding a ALV Grid.
- Function Modules which is what I will be showing you code for.
- Object Method. I have not attempted this method yet I am waiting to go to a SAP Class on objects before I attempt this.
So let's fire up SE80 and do some playing around
- Just after your REPORT statement or PROGRAM statement add the following code. "TYPE-POOLS: slis." Don't ask me why just put it in I am sure if you search you will find the answer it just is not important to me.
- Next I like to create a structure to hold what I am going to display on screen. To the right you will see my type declaration I think of types as I specs in RPG they really don't match exactly but it's how I think of it.
- Now you have to create a internal table to hold this type. The closet thing to an internal table in RPG would be a multiple occurrence data structure. The picture below shows an example of how to describe the internal table.
- The picture to the left includes the data declaration that is need for the grid. You will see to additional lines global_field_cat this is setting up an internal table that is needed to contain what is called the catalog for the grid. We also have to declare a structure for the grid.
- The code to the right is an example of how to define a lay
out. I have included in my example a traffic light Icon this is totally up to you. If you choose not to use this simply remove it from the code
- The next bit of code is how you will define the catalog. Each field you want to display must have an entry in the catalog. The FIELDNAME value must be in upper case. There are several attributes that can be defined in the catalog I will try to go over additional functionality in the future but this is the basic attributes.
- Finally the call to the function module that will build this display.

I included the parameter i_callback_user_command but this is optional if your program does not need to handle changes to the grid's data then you can leave this out.
This is not a complete program in a future article will discuss the whole program.