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

Former Member
0 Likes
634

Hello friends,

I am working on 2 systems in 4.7 and 4.6.

I have to create a dynamic internal table based on the table name passed on the selection screen.

I am able to do this in 4.7 with the below statement.


DATA:  i_table_update TYPE REF TO data.

PARAMETERS: p_table TYPE tabname OBLIGATORY.

  CREATE DATA i_table_update TYPE STANDARD TABLE OF (p_table).

the above statement has a syntax error in 4.6

the error is

Unable to interpret "TABLE". Possible causes of error: Incorrect spelling or comma error.

Any suggestions.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
579

That's right, the TYPE TABLE syntax is not available in 46c.

Regards,

Rich Heilman

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
580

That's right, the TYPE TABLE syntax is not available in 46c.

Regards,

Rich Heilman

Read only

0 Likes
579

Thanks Rich,

Whats the alternative for this.

The problem we are doing some database changes for the material group and we have to this for many tables based on the table name passed on the selection screen.

Thanks and pls let me know if you have any example of this.

Ster.

Read only

0 Likes
579

Try this way


  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_content.
  if sy-subrc = 0.
    assign i_content->* to <ptab>.
  else.
    write: 'Error creating internal table'.
  endif.

a®

Read only

Former Member
0 Likes
579

Hi,

Refer to this program:

http://www.sap-img.com/ab030.htm

Write a small subroutine, to create a dynamic table.

Regards,

Subramanian

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
579

aRs has the right idea here. Here is a complete example program.

Regards,

Rich Heilman

Read only

0 Likes
579

Thanks ALL,

ARS I will trying ur approach and would get back if I have any questions.

Thanks,

Ster.

Read only

0 Likes
579

Thanks All for the suggestions.

Ster