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

insert into <fs> table

Former Member
0 Likes
886

Hello,

I am trying to modify a report for a dynamic approach, but I am stuck with a problem.

I have this line:

INSERT LINES OF lt_celltab INTO table <dyn_field>.

The error is <dyn_field> is not an internal table.

In the debugger, the status of <dyn_field> is Table(initial). How can I insert the lines of lt_celltab into <dyn_field?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
788

This will solve your problem,

Declare your Field symbol as below


FIELD-SYMBOLS: <fs_scarr> TYPE STANDARD TABLE.

Here is a complete example,


REPORT  zkb_test5.

DATA: i_scarr TYPE TABLE OF scarr,
      w_scarr TYPE scarr.

DATA: dref_scarr TYPE REF TO data.

FIELD-SYMBOLS: <fs_scarr> TYPE STANDARD TABLE.

SELECT  * FROM scarr INTO TABLE i_scarr.

CREATE DATA dref_scarr TYPE TABLE OF scarr.

ASSIGN dref_scarr->* TO <fs_scarr>.

APPEND LINES OF i_scarr TO <fs_scarr>.

IF sy-subrc NE 0.
  WRITE / 'Error'.
ELSE.
  WRITE / 'Success'.
ENDIF.

Regards

Kathirvel

Hello,

I am trying to modify a report for a dynamic approach, but I am stuck with a problem.

I have this line:

INSERT LINES OF lt_celltab INTO table <dyn_field>.

The error is <dyn_field> is not an internal table.

In the debugger, the status of <dyn_field> is Table(initial). How can I insert the lines of lt_celltab into <dyn_field?

5 REPLIES 5
Read only

Former Member
0 Likes
788

Hi,

Try with APPEND command instead of INSERT.

APPEND LINES OF lt_celltab INOT TABLE <dyn_field>.

Regards,

Satya.

Read only

Former Member
0 Likes
788

hi George,

Usually Field Symbols (varibales in <>) are used to access single row of ITAB and do processing and send it back to ITAB etc.

What would you need to do that.

You can just use a string table if you want

Regards,

VIvek

Read only

Former Member
0 Likes
788

Hello,

You could also have a field symbol which is type table.

For this you should have declared the field symbol as

<fs> type standard/sorted table

or

<fs> type <DDIC table type>

or

<fs> type standard table of <DDIC transparent table>

Read only

Former Member
0 Likes
789

This will solve your problem,

Declare your Field symbol as below


FIELD-SYMBOLS: <fs_scarr> TYPE STANDARD TABLE.

Here is a complete example,


REPORT  zkb_test5.

DATA: i_scarr TYPE TABLE OF scarr,
      w_scarr TYPE scarr.

DATA: dref_scarr TYPE REF TO data.

FIELD-SYMBOLS: <fs_scarr> TYPE STANDARD TABLE.

SELECT  * FROM scarr INTO TABLE i_scarr.

CREATE DATA dref_scarr TYPE TABLE OF scarr.

ASSIGN dref_scarr->* TO <fs_scarr>.

APPEND LINES OF i_scarr TO <fs_scarr>.

IF sy-subrc NE 0.
  WRITE / 'Error'.
ELSE.
  WRITE / 'Success'.
ENDIF.

Regards

Kathirvel

Read only

Former Member
0 Likes
788

Thyank you all.

I solved the problem by declaring the field symbol as sorted table.