Question:
Dear all,
I’m doing my first experience on ALV and I’m facing the following problem:
I use the following command
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'it_fornecedor'
CHANGING IT_OUTTAB = it_fornecedor.
(It_fornecedor is an internal table which is been filled with information from many transparent tables and calculations)
But the system tells me that that it_fornecedor isn’t a valid structure for the event.
What is wrong here? How should be the internal table structure?
Thanks in advance.
Best regards,
Ana.
Answer:
When passing names of objects in SAP between quotes - always ensure it is in capitals.
_________________
Kind Regards
Rosie Brent
Please remember to search the forum and check the FAQ before posting questions, thank you.
Tuly Idiot most of the time, part-time Guru
Answer:
since the internal table data is obtained from many transparent table u need to generate the field catalog semi-automatically, had it wud been from one transparent table the field catalog wud have been generated automatically.
field catalog is the table which contains the information regarding each field of the alv grid control regarding how it should be displayed on the screen.
Depending on the row type of the data table, the field catalog is generated according to a different procedure. We have to distinguish between three cases:
Case 1: The row type of the data table is defined in the ABAP Dictionary.
Example: Row type SFLIGHT.
In this case, all information of the field catalog can be copied from the ABAP Dictionary. This is done independently by the proxy object: The field catalog is generated automatically.
Case 2: The row type of the data table contains fields with types of fields of Dictionary structures and fields with local types.
Example: The row type consists of the fields of structure SFLIGHT to which fields with types defined locally in the program have been added.
In this case, you can have the entries of the fields with reference to the Dictionary generated automatically, while you must manually add the entries of the other columns to the field catalog (semi-automatic procedure).
Case 3: The row type of the data table contains only fields with local types.
In this case, the field catalog must be generated manually. This means that the program that uses the ALV Grid Control must generate the field catalog on its own.
solutions for above 3 cases.
case1.
1. If the line type of the data table contains all of the fields in a particular ABAP Dictionary structure, the ALV proxy object can create the field catalog automatically.
2. To do this, specify the name of the ABAP Dictionary structure that corresponds to the line type of the data table in the i_structure_name parameter of the method set_table_for_first_display.
3. The proxy object obtains all of the requisite information from the ABAP Dictionary and constructs the field catalog itself.
case2.
this situation can occur in two possible ways.
first.
1. If the row type of your data table consists of all fields of a single Dictionary structure to which other fields have been added, you can generate the field catalog semi-automatically.
2. To dothis, you:
a. Declare an internal table for the field catalog
DATA: it_fcat TYPE lvc_t_fcat.
b. Create an entry in the field catalog for each column in your data table that has a type that you defined locally in the program. Enter the column name and define its attributes.
c. Call the instance method set_table_for_first_display and pass the data table (it_data in the graphic) to the it_outtab parameter, the field catalog (it_fcat) to the it_fieldcatalog parameter, and the name of the ABAP Dictionary structure to the i_structure_name parameter.
d. The proxy object then generates a full field catalog.
second.
1. You can also generate the field catalog semi-automatically if the fields in the line type of your data table have data types from more than one ABAP Dictionary structure.
2. To do this, you must:
a. Declare an internal table for the field catalog:
DATA: it_fcat TYPE lvc_t_fcat.
b. Create an entry in the field catalog for each column in your data table. Fill the fieldname and ref_table fields for all of the columns that have the same name as the structure field to which you referred to define their types (fieldname contains the column name, ref_table the name of the reference table). For fields where the column name in the data table is different to the field name in the ABAP Dictionary structure (cityfrom and cityto in the graphic), you must also specify the name of the reference field.
c. Call the instance method set_table_for_first_display and pass the data table (it_data in the example) to the it_outtab parameter and the field catalog (it_fcat) to the it_fieldcatalog parameter.
d. The proxy object then creates the full field catalog.
case 3.
1. If the line type of your data table consists exclusively of data types that you declared locally in the program, you must create the field catalog by hand.
2. To do this, you must:
a. Declare an internal table for the field catalog:
DATA: it_fcat TYPE lvc_t_fcat.
b. Create an entry in the field catalog for each column in your data table. Enter the column name and define the attributes for the columns.
c. Call the instance method set_table_for_first_display and pass the data table (it_data in the example) to the it_outtab parameter and the field catalog (it_fcat) to the it_fieldcatalog parameter.
for more details I have the material with me if u require then plz reply to this.