Application Development 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: 

Syntax problem

Former Member
0 Kudos

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

Former Member
0 Kudos

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

reward if it helps,

Satish

0 Kudos

I did try within select and end select..

it does not works..

0 Kudos

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

Regards,

Satish

0 Kudos

do not use append statement.

just use collect.

Regards

Former Member
0 Kudos

SELECT interface counter

INTO it_tab

FROM /insfoo/cu_COUTBL.

<b>COLLECT it_tab.</b>

ENDSELECT.

No need to use it_tab1.

Regards,

Atish

naimesh_patel
Active Contributor
0 Kudos

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