The layout stands for a set of settings about sort, total and which fields need to be displayed. It is a common case that different user needs to have different layout of the alv. SAP has provide functionality to user to create, change, save or even transport the layout to the subsequent systems.
SAP alv Layout Common functionality 1. Choose Layout.
To choose an existing layout for the display of the list, choose Choose layout or Settings ® Display layout ® Choose. You can change the layout of ALV using the following ALV funcitons:
a. Sort order
b. Set Filter or delete Filter
c. Change layout
d. Find…
In the dialog box, choose a layout either by clicking the layout name or by positioning the cursor on the relevant layout and choosing Copy.
2. Save Layout.
Choose Save layout or Settings->Layout->Save. In the dialog box, enter a name and a description for your layout.
You cannot gives the layout a name with number, since this type of name is reserved for the standard layouts in the standard system. In general, layouts are available for all users as client-specific standard layouts, but you can select User-specific option which means that this layout only avaliable for current user.
Naming conversion of layout. User-specific layouts must begin with a letter (A-Z). Non-user-specific layouts(client-specific standard layouts) must begin of with “/”.
3. Layout management.
To call layout management, choose Settings->Layout->Management. We can delete a layout or set a layout as default.
We can also import or transport layout using layout management. The layout will not be added to a transport when you create it, but you can add it to a transport manually using layout management.
SAP ALV Layout programming
Some requirements need to allow user to choose a specific layout in the report selection screen. This means that we need to add some additional codes to achieve that. There several FM for this purpose.
REUSE_ALV_VARIANT_DEFAULT_GET - get the default layout of this report
REUSE_ALV_VARIANT_EXISTENCE - check whether the input layout name exists
REUSE_ALV_VARIANT_F4 - pop up a screen to allow user to choose existing layout
Below are several steps to use these FM.
Step 1. Define layout data.
Code:
DATA: GS_VARIANT LIKE DISVARIANT. ” define the data representation of a layout
V_EXIT.
Step 2. Define selection screen.
Code:
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT. ” define a parameter using type DISVARIANT-VARIANT
SELECTION-SCREEN END OF BLOCK B3.
Step 3. Define event “AT SELECTION-SCREEN ON VALUE-REQUEST FOR …”.
Code:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
GS_VARIANT-REPORT = SY-REPID. ” set the report name to the current report.
Step 5. Pass the selected layout to the ‘REUSE_ALV_GRID_DISPLAY’.
We need to pass the selected layout to parameter named ‘IS_VARIANT’. At the same time we need to pass a value to paramenter named ‘I_SAVE’. I_SAVE has a type of c and several value can be passed into it.
‘ ‘ = display variants cannot be saved
Defined display variants (e.g. delivered display variants) can be selected for presentation independently of this flag. Changes can not be saved.
‘X’ = standard save
Display variants can be saved as standard display variants. User-specific saving is not possible.
‘U’ = only user-specific saving
The user can only save display variants user-specifically
‘A’ = standard and user-specific saving
The user can save a display variant user-specifically and as standard display variant. The user chooses in the display variant save popup.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.