0% found this document useful (0 votes)
198 views4 pages

Creating Fieldcat Using Internal Table - SAP Q&A

Uploaded by

Rap Ferr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
198 views4 pages

Creating Fieldcat Using Internal Table - SAP Q&A

Uploaded by

Rap Ferr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Community

(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

Search the SAP Community

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.

Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-


table.html%3Fs_action%3Dcomment%26s_data%3D7769643%26s_csrf%3D1615366042567.4812) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3DreportQuestion%26s_data%3D7769643%26s_csrf%3D1615366042567.4812)

Assigned Tags

ABAP Development (/tags/833755570260738661924709785639136) |

Related questions

Custom F4 Help for ALV Grid editable eld (https://answers.sap.com/questions/9610483/custom-f4-help-for-alv-grid-editable- eld.html)


By Former Member ( https://people.sap.com/former.member) Oct 18, 2012

ALV problems (https://answers.sap.com/questions/967442/alv-problems.html)


By Former Member ( https://people.sap.com/former.member) Jul 26, 2005

4 Answers

Sort by: Votes | Newest | Oldest

Best Answer

Former Member

Oct 06, 2010 at 05:55 PM

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

Clemens Li ( https://people.sap.com/clemens.li)  Former Member

Oct 07, 2010 at 04:21 PM (/comments/7773652/view.html)


... or try this:

<my latest 'invention', just 2 days old>

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

Like (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-table.html%3FchildToView%3D7773652%23comment-


7773652%26s_action%3Dlike_comment%26s_data%3D7773652%26s_csrf%3D1615366042567.4812) 0 |
Share
|

Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-


table.html%3Fs_action%3DreportComment%26s_data%3D7773652%26s_csrf%3D1615366042567.4812)

Show all

Comment on This Answer (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-


table.html%3Fs_action%3Dcomment%26s_data%3D7769727%26s_csrf%3D1615366042567.4812)

Kesavadas Thekkillath ( https://people.sap.com/kesavadas.thekkillath)


(/users/2500/kesavadasthekkillath.html)
Oct 06, 2010 at 05:39 PM

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

Oct 06, 2010 at 05:28 PM

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.

I hope this help,

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

Oct 07, 2010 at 04:56 AM

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)

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 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

Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-


table.html%3Fs_action%3Dcomment%26s_data%3D7770673%26s_csrf%3D1615366042567.4812) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-
table.html%3Fs_action%3Dreport%26s_data%3D7770673%26s_csrf%3D1615366042567.4812) |
Share

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.

Rules of Engagement (https://www.sap.com/community/resources/rules-of-engagement.html)

Know someone who can answer? Share a link to this question.

You must be Logged in (/users/login.html?redirect_to=%2Fquestions%2F7769643%2Fcreating- eldcat-using-internal-


table.html%3Fs_action%3DanswerQuestion%26s_csrf%3D1615366042567.4812) to submit an answer.

Please provide a distinct answer and use the comment option for clarifying purposes.

Submit your Answer

Find us on

(https://www.facebook.com/sapcommunity) (https://twitter.com/SAPCommunity) (https://www.youtube.com/c/SAPCommunities)

(https://www.linkedin.com/company/sap) (https://instagram.com/sap/) (http://www.slideshare.net/SAP) (mailto:?subject='SAP Community')

Privacy (http://sap.com/about/legal/privacy.html) Terms of Use (http://sap.com/corporate/en/legal/terms-of-use.html)

Legal Disclosure (http://sap.com/about/legal/impressum.html) Copyright (http://sap.com/about/legal/copyright.html)

Trademark (http://sap.com/about/legal/trademark.html) Cookie Preferences

Newsletter (https://www.sap.com/cmp/nl/sap-community-voice/index.html) Support (mailto:[email protected])

You might also like