‎2008 Jul 10 8:12 PM
Hello Friends,
I was having with the create data statement to create an internal table. However as suggested by many here I hav used methods and FM to do the same and my internal table is creted.
However the problem is the Internal table created does not have the same
the table <f_table_update> has been created with 804 bytes memory. However MARA has 806 bytes of memory.
hence a short Dump is observed.
Shore Dump message
In this particular case, the database table is 806 bytes wide,
but the internal table is only 804 bytes wide.
data : i_fcat TYPE STANDARD TABLE OF lvc_s_fcat.
DATA: i_table_data1 TYPE REF TO data.
FIELD-SYMBOLS: <f_table_update> TYPE STANDARD TABLE.
PARAMETERS: p_table TYPE tabname OBLIGATORY.
CLEAR i_fcat.
REFRESH i_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table " Table Name
CHANGING
ct_fieldcat = i_fcat
EXCEPTIONS
OTHERS = 1.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_fcat
IMPORTING
ep_table = i_table_update.
IF sy-subrc = 0.
ASSIGN i_table_update->* TO <f_table_update>.
ELSE.
WRITE: 'Error creating internal table'.
ENDIF.
IF NOT <f_table_update> IS INITIAL.
UPDATE (p_table) FROM TABLE <f_table_update>. "Program dumps here
endif.
‎2008 Jul 10 10:33 PM
I beleive it is the .INCLUDE s and APPEND s which create the issue.
made these changes..and is working..
data : t_dd03l like dd03l occurs 0 with header line.
data : GT_FIELDCAT type lvc_s_fcat.
select * from dd03l into corresponding fields of table t_dd03l
where tabname = p_table.
sort t_dd03l by position.
loop at t_dd03l where rollname ne space.
GT_FIELDCAT-FIELDNAME = t_dd03l-FIELDNAME.
GT_FIELDCAT-TABNAME = p_table.
APPEND GT_FIELDCAT to i_fcat.
endloop.
* CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
* EXPORTING
* i_structure_name = p_table " Table Name
* CHANGING
* ct_fieldcat = i_fcat
* EXCEPTIONS
* OTHERS = 1.
‎2008 Jul 10 8:17 PM
Hi,
In debug, check the i_fcat returned by 'LVC_FIELDCATALOG_MERGE'.
Compare the structure it has returned with the MARA structure.
Regards,
Subramanian
‎2008 Jul 10 8:23 PM
Did that it has the same fields as what MARA has.
Excatly the same
Thanks,
Ster
‎2008 Jul 10 9:05 PM
Hi,
After getting the field catalog from FM LVC_FIELDCATALOG_MERGE
try to increase the length (internal length and output length) of the last field in it by 2 character (in 4.6 c 1 char = 1 byte). Then try to update the table and check the result.
Regards,
Joy.
‎2008 Jul 10 9:15 PM
‎2008 Jul 10 9:40 PM
Thanks ARS.
I will try but again this wont serve my problem. I might also Insert some records inot the database.
Thanks for all the replys.
Ster
‎2008 Jul 10 9:47 PM
I have used the FM as suggested by you but am unable to as it says wrong Param. Sy-subrc = 3.
Any more suggestions.
Ster.
‎2008 Jul 10 10:33 PM
I beleive it is the .INCLUDE s and APPEND s which create the issue.
made these changes..and is working..
data : t_dd03l like dd03l occurs 0 with header line.
data : GT_FIELDCAT type lvc_s_fcat.
select * from dd03l into corresponding fields of table t_dd03l
where tabname = p_table.
sort t_dd03l by position.
loop at t_dd03l where rollname ne space.
GT_FIELDCAT-FIELDNAME = t_dd03l-FIELDNAME.
GT_FIELDCAT-TABNAME = p_table.
APPEND GT_FIELDCAT to i_fcat.
endloop.
* CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
* EXPORTING
* i_structure_name = p_table " Table Name
* CHANGING
* ct_fieldcat = i_fcat
* EXCEPTIONS
* OTHERS = 1.