Creating Fieldcat Using Internal Table - SAP Q&A
Creating Fieldcat Using Internal Table - SAP Q&A
(http://www.sap.com/)
(https://community.sap.com)
(/users/login.html?
redirect_to=%2Fquestions%2F7769643%2Fcreating-
fieldcat-using-internal-table.html)
Ask a Question (https://answers.sap.com/questions/ask.html) Write a Blog Post (https://blogs.sap.com/wp-admin/post-new.php) Login (/users
Former Member
Creating eldcat using internal table
Oct 06, 2010 at 05:17 PM | 1.7k Views
Fquestions%2F7769643%2Fcreating- eldcat-using-
ta%3D7769643%26s_csrf%3D1615366042567.4812)
internal-
0
Fquestions%2F7769643%2Fcreating- eldcat-using-
data%3D7769643%26s_csrf%3D1615366042567.4812)
internal-
(/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-table.html%3Fs_action%3Dfollow%26s_csrf%3D1615366042567.4812)
Follow RSS Feed
Hi experts,
I was looking, how to create a eldcatalog using internal table, if we use fm 'LVC_FIELDCATALOG_MERGE' it will create a eldcat with all the elds from the dbtable to which
internal table ref to. Also tell me how to create automatic fcat for two tables.
Thanks,
Anna.
Assigned Tags
Related questions
4 Answers
Best Answer
Former Member
Hi anna,
2Fquestions%2F7769643%2Fcreating- eldcat-using-
data%3D7769727%26s_csrf%3D1615366042567.4812)
childToView%3D7769727%23answer-
3
I think you can use class CL_SALV_TABLE
2Fquestions%2F7769643%2Fcreating- eldcat-using-and its methods to create FCAT using internal table.
childToView%3D7769727%23answer-
_data%3D7769727%26s_csrf%3D1615366042567.4812)
Thanks,
Anmol.
Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3Dcomment%26s_data%3D7769727%26s_csrf%3D1615366042567.4812) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3Dreport%26s_data%3D7769727%26s_csrf%3D1615366042567.4812) |
Share
3 Comments
METHOD GET_LVC_T_FCAT_4_ITAB.
*Importing IT_TABLE TYPE TABLE
*Returning VALUE( RT_FCAT ) TYPE LVC_T_FCAT
DATA:
lo_columns TYPE REF TO cl_salv_columns_table,
lo_aggregations TYPE REF TO cl_salv_aggregations,
lo_salv_table TYPE REF TO cl_salv_table,
lr_table TYPE REF TO data,
lt_slis_fieldcat_alv TYPE slis_t_fieldcat_alv.
FIELD-SYMBOLS:
<table> TYPE table.
* create unprotected table from import data
CREATE DATA lr_table LIKE it_table.
ASSIGN lr_table->* TO <table>.
*...New ALV Instance ...............................................
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = abap_false
IMPORTING
r_salv_table = lo_salv_table
CHANGING
t_table = <table> ).
CATCH cx_salv_msg. "#EC NO_HANDLER
ENDTRY.
lo_columns = lo_salv_table->get_columns( ).
lo_aggregations = lo_salv_table->get_aggregations( ).
rt_fcat =
cl_salv_controller_metadata=>get_lvc_fieldcatalog(
r_columns = lo_columns
r_aggregations = lo_aggregations ).
ENDMETHOD.
You may use the code in a FORM routine or directly in program, not necessary to use a method.
Regards,
Clemens
Show all
You can go for SALV Display which doesnt need any eldcat to be populated.
2Fquestions%2F7769643%2Fcreating-
hildToView%3D7769666%23answer- eldcat-using-
data%3D7769666%26s_csrf%3D1615366042567.4812)
1
Search in Google or SCN for SALV Demos.
2Fquestions%2F7769643%2Fcreating-
hildToView%3D7769666%23answer- eldcat-using-
_data%3D7769666%26s_csrf%3D1615366042567.4812)
Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3Dcomment%26s_data%3D7769666%26s_csrf%3D1615366042567.4812) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3Dreport%26s_data%3D7769666%26s_csrf%3D1615366042567.4812) |
Share
Former Member
Hi Anna,
2Fquestions%2F7769643%2Fcreating- eldcat-using-
childToView%3D7769623%23answer-
data%3D7769623%26s_csrf%3D1615366042567.4812)
0
The function LVC_FIELDCATALOG_MERGE
2Fquestions%2F7769643%2Fcreating- eldcat-using- generate eldcatalog for all elds always, so if you need less elds try delete not required elds or (my personal choice)
childToView%3D7769623%23answer-
_data%3D7769623%26s_csrf%3D1615366042567.4812)
generate the eldcatalog manually.
if you need merge two tables in one catalog, try generate a table catalog for each table and then append second table to rst one.
Best regards,
X.S.
Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3Dcomment%26s_data%3D7769623%26s_csrf%3D1615366042567.4812) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3Dreport%26s_data%3D7769623%26s_csrf%3D1615366042567.4812) |
Share
Former Member
Hi Anna
2Fquestions%2F7769643%2Fcreating- eldcat-using-
data%3D7770673%26s_csrf%3D1615366042567.4812)
childToView%3D7770673%23answer-
0
rst you need to de ne the eldcatlog
2Fquestions%2F7769643%2Fcreating- table as below.
eldcat-using-
childToView%3D7770673%23answer-
_data%3D7770673%26s_csrf%3D1615366042567.4812)
FORM FIELD_CATLOG.
CLEAR WA_FCAT.
WA_FCAT-HOTSPOT = 'X'.
CLEAR WA_FCAT.
WA_FCAT-HOTSPOT = 'X'.
CLEAR WA_FCAT.
Endform.
In above code mention the table names in TABNAME eld which identi es which eld to refer from which table.
like at 1 column eld 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
Before answering
You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please
leave a comment instead, requesting additional details. When answering, please include speci cs, such as step-by-step instructions, context for the solution, and links to
useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
Please provide a distinct answer and use the comment option for clarifying purposes.
Find us on