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

Syntax problem

Former Member
0 Likes
591

DATA : BEGIN OF IT_TAB occurs 0,

INTERFACE(50) TYPE c,

COUNTER(10) TYPE n,

END OF IT_TAB.

DATA : IT_TAB1 LIKE IT_TAB OCCURS 0 WITH HEADER LINE.

SELECT interface counter

INTO it_tab

FROM /insfoo/cu_COUTBL.

append it_tab.

ENDSELECT.

COLLECT it_tab into it_tab1.

Collect statment is not working ..

Itab values are as follow..

<b>interface counter</b>

field1 12

field1 14

field1 13

I need the it_tab1 as field1 39

Any help would be appreciated..

thanks in advance..

6 REPLIES 6
Read only

Former Member
0 Likes
558

use COLLECT it_tab into it_tab1.inside select...endselect

reward if it helps,

Satish

Read only

0 Likes
558

I did try within select and end select..

it does not works..

Read only

0 Likes
558

Have you commented Append Statement after keeping Collect inside select..endselect?

Regards,

Satish

Read only

0 Likes
558

do not use append statement.

just use collect.

Regards

Read only

Former Member
0 Likes
558

SELECT interface counter

INTO it_tab

FROM /insfoo/cu_COUTBL.

<b>COLLECT it_tab.</b>

ENDSELECT.

No need to use it_tab1.

Regards,

Atish

Read only

naimesh_patel
Active Contributor
0 Likes
558

Do it like this:


DATA : BEGIN OF IT_TAB occurs 0,
INTERFACE(50) TYPE c,
COUNTER(10) TYPE n,
END OF IT_TAB.

DATA : begin of it_tab1 occurs 1,
INTERFACE(50) TYPE c,
COUNTER(10) TYPE i,   " <<< this should  be type i, p, f to collect
       end   of it_tab1.
SELECT interface counter
INTO table it_tab  "<< table
FROM /insfoo/cu_COUTBL.

LOOP AT ITAB
COLLECT it_tab into it_tab1.  "<<
ENDLOOP.

Regards,

Naimesh Patel

Message was edited by:

Naimesh Patel