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

Create Data, UPdate statement problems in 4.6

Former Member
0 Likes
844

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
812

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.

7 REPLIES 7
Read only

Former Member
0 Likes
812

Hi,

In debug, check the i_fcat returned by 'LVC_FIELDCATALOG_MERGE'.

Compare the structure it has returned with the MARA structure.

Regards,

Subramanian

Read only

0 Likes
812

Did that it has the same fields as what MARA has.

Excatly the same

Thanks,

Ster

Read only

Former Member
0 Likes
812

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.

Read only

former_member194669
Active Contributor
0 Likes
812

Try to use fm DB_UPDATE_TABLE for updating and check

a®

Read only

0 Likes
812

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

Read only

0 Likes
812

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.

Read only

Former Member
0 Likes
813

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.