03-03-2009 8:32 AM
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.
03-03-2009 8:37 AM
03-03-2009 8:34 AM
03-03-2009 8:37 AM
BUT IS THERE IS ANY OTHER WAY OR OTHER FM FOR MY SOLUTION...
THE FIELDCAT MUST BE OF TYPE " LVC_S_FCAT "..
03-03-2009 8:37 AM
03-03-2009 8:39 AM
03-03-2009 8:51 AM
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
03-03-2009 8:41 AM
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.
03-03-2009 8:41 AM
Hi Sharath
just comment ur statement I_STRUCTURE_NAME = 'KNA1'
give I_INTERNAL_TABNAME = 'IKNA1'
it should work then .
Regards
Rajnesh D
03-03-2009 8:42 AM
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
03-03-2009 8:45 AM
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
03-04-2009 6:00 AM