Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

FIELDCATALOG USING INTERNAL TABLE

Former Member
0 Likes
4,526

HI ,

IAM USING THIS FM TO CREATE FIELDCAT STRUCTURE USING THE KNA1 DATABASE TABLE STRUCTURE... BUT I WANT TO CREATE FIELDCAT USING MY INTERNAL TABLE.. I TRIED IT BUT IT IS GOING TO DUMP.

PLEASE HELP ME..

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

I_STRUCTURE_NAME = 'KNA1'

I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME = 'IKNA1'

CHANGING

CT_FIELDCAT = FIELDCAT

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,520

Hello,

Please check the following link:

[Utilising REUSE_ALV_FIELDCATALOG_MERGE using program-internal table |;

@ Pushpraj: Please see the FM documentation before answering. DONOT misguide people.

BR,

Suhas

10 REPLIES 10
Read only

Former Member
0 Likes
1,520

Hi Sharath

It has to be a database table.

Otherwise dump.

Pushpraj

Read only

0 Likes
1,520

BUT IS THERE IS ANY OTHER WAY OR OTHER FM FOR MY SOLUTION...

THE FIELDCAT MUST BE OF TYPE " LVC_S_FCAT "..

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,521

Hello,

Please check the following link:

[Utilising REUSE_ALV_FIELDCATALOG_MERGE using program-internal table |;

@ Pushpraj: Please see the FM documentation before answering. DONOT misguide people.

BR,

Suhas

Read only

Former Member
0 Likes
1,520

HI Suhas,

BUT THE FIELDCAT MUST BE OF TYPE " LVC_S_FCAT "...

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,520

Hello Sharath,

I think you can draw an analogy & try as suggested in the post for LVC_FIELDCATALOG_MERGE as well. My suggestion will be to declare your internal table with LIKE keyword.

A question: Why have you passed 'KNA1' to the I_STRUCTURE_NAME parameter any relevance?

BR,

Suhas

Read only

Former Member
0 Likes
1,520

hi,

check this example

data LS_FCAT type LVC_S_FCAT.

call function 'LVC_FIELDCATALOG_MERGE'

exporting

I_STRUCTURE_NAME = 'ZSUPPORTTOOL' "database structure or table name

changing

CT_FIELDCAT = GT_FIELDCAT.

loop at GT_FIELDCAT into WA_FIELDCAT.

if WA_FIELDCAT-FIELDNAME = 'MODULE'.

WA_FIELDCAT-COLTEXT = 'MODULE'.

WA_FIELDCAT-OUTPUTLEN = 6.

endif.

if WA_FIELDCAT-FIELDNAME = 'AREA'.

WA_FIELDCAT-COLTEXT = 'AREA'.

WA_FIELDCAT-OUTPUTLEN = 25.

endif.

modify GT_FIELDCAT index SY-TABIX from WA_FIELDCAT.

endloop.

Read only

Former Member
0 Likes
1,520

Hi Sharath

just comment ur statement I_STRUCTURE_NAME = 'KNA1'

give I_INTERNAL_TABNAME = 'IKNA1'

it should work then .

Regards

Rajnesh D

Read only

Former Member
0 Likes
1,520

Hi sharath,

u can use like this:-

DATA: ls_fcat TYPE lvc_s_fcat.

DATA: lv_pos TYPE i.

lv_pos = lv_pos + 1.

ls_fcat-fieldname = 'INSTANCE'. :(fieldname of internal table)

ls_fcat-coltext = 'Instance'.

ls_fcat-col_pos = lv_pos.

ls_fcat-outputlen = 20.

ls_fcat-no_out = 'X'.

ls_fcat-col_opt = 'X'.

APPEND ls_fcat TO pt_fcat.

CLEAR ls_fcat.

ls_fcat-edit = ' '.

lv_pos = lv_pos + 1.

ls_fcat-fieldname = 'PARENT'.

ls_fcat-coltext = 'Parent'.

ls_fcat-col_pos = lv_pos.

ls_fcat-outputlen = 20.

ls_fcat-no_out = 'X'.

ls_fcat-col_opt = 'X'.

APPEND ls_fcat TO pt_fcat.

CLEAR ls_fcat.

lv_pos = lv_pos + 1.

ls_fcat-fieldname = 'LEVEL'.

ls_fcat-coltext = 'level'.

ls_fcat-col_pos = lv_pos.

ls_fcat-outputlen = 15.

ls_fcat-col_opt = 'X'.

APPEND ls_fcat TO pt_fcat.

CLEAR ls_fcat.

lv_pos = lv_pos + 1.

ls_fcat-fieldname = 'ITEM_NO'.

ls_fcat-coltext = 'Item'.

ls_fcat-col_pos = lv_pos.

ls_fcat-outputlen = 20.

ls_fcat-col_opt = 'X'.

APPEND ls_fcat TO pt_fcat.

CLEAR ls_fcat.

Thanks & Regards,

Ruchi Tiwari

Read only

Former Member
0 Likes
1,520

Hi Sharath,

When use the the FM to create the field catalog the internal table should have the header line.

So if you want to use the FM create the internal table with header line otherwise

fill the fieldcat manually as Ruchi mentioned above.

Regards,

Manoj Kumar P

Edited by: Manoj Kumar on Mar 3, 2009 9:45 AM

Read only

Former Member
0 Likes
1,520

my question is answered and im closing the thread....thank u all