Archive for the ‘ALV’ Category
Here is the abap report program template. I record it in my blog for further reference.
We may need to display traffic light or some other icons in the ALV output to highlight some lines. Here is an example.
To use icons, you need to use types-pool: icon or include the include file
We can make one or several lines in ALV report selectable according to select mode set in layout structure.
Step 1. Define another field in the output table with type c length 1. This field will be used to record the select status of front end in the backend.
* Data to be displayed
DATA: BEGIN OF gt_data OCCURS 50,
k(10),
a TYPE int1,
mark(1) type c,
END OF gt_data.
Step 2. Set this field name ‘MARK’ to the attribute ‘box_fname’ in layout structure.
The column length in ALV has a maxmium 128 characters. Note 857823 has the detail. Below is the detail from SAP.
Symptom
Entries in cells of the type CHAR or string are truncated after 128 characters in the SAP GUI.
Other terms
ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
Reason and Prerequisites
The data table that is sent to the frontend only allows character values with the length 128.
Solution
This is the standard system behavior and cannot be changed.
This is an example about hierarchical sequential list report. It retrieve header and item information of purchase order and display them in a hierarchical way.
If the field in ALV output table is for currency or quantity, we need to do some effort to display it in our ALV. you must assign these fields to a currency or unit. There are three ways how you can do this in the field catalog:
* Reference to a Currency or Unit Field
* Value or Unit for the Entire Column
* Format the value field manually
In previous article, we have already set alv editable, but we still need to validate the input data as well as save the input data to the database. In another case, we also need to change according to user’s event.
As we can now make our alv Grid editable we may require controlling input data. The alv Grid has events data_changed and data_changed_finished. The former method is triggered just after the change at an editable field is perceived. Here you can make checks for the input. And the second event is triggered after the change is committed. You can select the way how the control perceives data changes by using the method register_edit_event. You have two choices:
Sometimes, we need to make our ALV editable. SAP has already provide table control to modify table data(previously we use loop step instead). But ALV can provide more functionality to support sort, total,filter, etc.
As far as the edit feature is concerned, a cell of the alv grid control can have the following states:
Business user always request to remove leading zero in the field. There are several methods to do it. But I think below one is the easiest.
When define the field catalog, we set field no_zero with value ‘X’. The ALV runtime will automatic remove the leading zero.
This article deals with event handling in SAP ALV and mechanism behind it. In a nutshell, ALV Grid is an implementation of custom control. You must be very familiar with the dynpro programming. In dynpro programming, we general have two events: PBO and PAI. If user have some actions in the frontend screen, the event PAI will be triggered and program can have different reactions according to different function codes. In the custom control, things become a slight different. It will trigger an specific event, if user does some actions in the frontend. There are two types of event: system event and application event.

