Hi experts,
I was looking, how to create a fieldcatalog using internal table, if we use fm 'LVC_FIELDCATALOG_MERGE' it will create a fieldcat with all the fields from the dbtable to which internal table ref to. Also tell me how to create automatic fcat for two tables.
Thanks,
Anna.
You can go for SALV Display which doesnt need any fieldcat to be populated.
Search in Google or SCN for SALV Demos.
Hi Anna,
The function LVC_FIELDCATALOG_MERGE generate fieldcatalog for all fields always, so if you need less fields try delete not required fields or (my personal choice) generate the fieldcatalog manually.
if you need merge two tables in one catalog, try generate a table catalog for each table and then append second table to first one.
I hope this help,
Best regards,
X.S.
Hi Anna
first you need to define the fieldcatlog table as below.
DATA: I_FCAT TYPE LVC_T_FCAT,
WA_FCAT TYPE LVC_S_FCAT.
Suppose you have 2 internal tables itab and itab1
then create the subroutine as below.
FORM FIELD_CATLOG.
CLEAR WA_FCAT.
WA_FCAT-TABNAME = 'ITAB'. "INT. TABLE NAME.
WA_FCAT-COL_POS = '1'. " COLUMN POSITION.
WA_FCAT-FIELDNAME = 'EMP_ID'. "FIELD NAME.
WA_FCAT-REPTEXT = 'EMPLOYEE ID'. "COLUMN HEADING.
WA_FCAT-HOTSPOT = 'X'.
APPEND WA_FCAT TO I_FCAT.
CLEAR WA_FCAT.
WA_FCAT-TABNAME = 'ITAB1'. "INT. TABLE NAME.
WA_FCAT-COL_POS = '2'. " COLUMN POSITION.
WA_FCAT-FIELDNAME = 'LAST_NAME'. "FIELD NAME.
WA_FCAT-REPTEXT = 'LAST NAME'. "COLUMN HEADING.
WA_FCAT-HOTSPOT = 'X'.
APPEND WA_FCAT TO I_FCAT.
CLEAR WA_FCAT.
Endform.
In above code mention the table names in TABNAME field which identifies whichfield to refer from which table.
like at 1 column field emp_id from table itab and at column 2 last_name from table itab1.
But make sure before that your tables itab and itab1 must have data.
Thanks
Lalit Gupta
Add a comment