Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Displaying Dynamic Columns in ALV With Layout Variant

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Displaying Dynamic Columns in ALV with Layout Variant

Purpose: Display Dynamic columns in the output based on the Layout Variant Selected in the selection screen. Requirement:Program is preparing field catalog based on the input of the program. This field catalog may be different for different inputs. Consider user has given input and gets the output in ALV. Now he saves that layout variant. If another user has change the input, for which field catalog may be built with different columns, but keep the same layout variant, then output should come. Steps: 1) Get the columns in the field catalog in one table as shown in below code. Here all columns are stored in table LT_FCAT.

2) Use FM ALV_IMPORT_FROM_BUFFER_LVC to get columns stored in Layout Variant as shown in below code. In this FM we need to pass Layout Variant Name (LW_LTDXKEY) and field catalog table LT_FCAT.

3) Form above FM, table LT_FCAT will get modified with the variant layout columns

4) Use FM 'LVC_GET_INFO_DATA_TABLE'as shown in below code to get columns to be display in the output screen and remaining in hidden mode. To this FM we need to pass data to be displayed in the output (table OBJECT_TAB),field catalog (table LT_FCAT ).

5) From above FM will get list of columns to be displayed in table LT_FCAT_NEW 6) Now we need to compare whether columns available in table LT_FCAT_NEW is available in the final field catalog or not. If columnsare not available then appendthose columns in final Field catalog table. Please find the below code in which table T_FLDCAT2 is considered as final table for field catalog.

7) Now we can pass table T_FLDCAT2 to FM 'REUSE_ALV_GRID_DISPLAY'

You might also like