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

COLLECT command on DECIMAL fields

Former Member
0 Likes
1,702

Hi All,

Since a couple of days, I am trying to solve the problem of using COLLECT statement against content of table which is :

F1.... type CHAR key

Fn.... type CAHR key

T1 ....type DEC 7,2

I am loadint the teble to internal table, and trying to perform COLLECT on it, but it says, that non-key fields to collect have to be type: I,P or F. I need to collect field which in table reflects type DEC 7,2. Do You have any idea how to solve it ???

regards, tomek

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,331

I don't see a problem with what you are trying to do. Would you please post the code that declares your internal table and the COLLECT statement?

Rob

10 REPLIES 10
Read only

Former Member
0 Likes
1,332

I don't see a problem with what you are trying to do. Would you please post the code that declares your internal table and the COLLECT statement?

Rob

Read only

0 Likes
1,331

Here it comes:

declaration:

DATA: T_TABLE TYPE SORTED TABLE OF Z_TABLE WITH UNIQUE KEY

RLDNR

RYEAR

RTCUR

RPMAX

RPRCTR

SPRCTR

RACCT

KTOPL

KTOSL

BKLAS

WITH HEADER LINE,

S_TABLE TYPE Z_TABLE.

code:

COLLECT S_TABLE INTO T_TABLE.

in Z_TABLE there are the last non key filelds of type: DEC(7,2), which are to be collected

and it gives syntax error while compiling: I can only use collect command for fields of type: I, P or F

Any glue ???

regards, tomek

Read only

0 Likes
1,331

How is z_table declared?

Rob

Read only

0 Likes
1,331

Z_TABLE in not declared in TABLES: section. Should it be present there ?

Read only

0 Likes
1,331

Probably not. Is it declared in SE11 or locally in your program?

Rob

Read only

0 Likes
1,331

It is defined in SE11, all leading fields exept last one, belong to key, last field is DECIMAL 7,2 type

regards, tomek

Read only

0 Likes
1,331

Well, this passes a syntax check:

TYPES: BEGIN OF z_table,
            rldnr,
            ryear,
            rtcur,
            rpmax,
            rprctr,
            sprctr,
            racct,
            ktopl,
            ktosl,
            bklas,
            t1(7) TYPE p DECIMALS 2,
      END OF z_table.

DATA:       t_table TYPE SORTED TABLE OF z_table WITH UNIQUE KEY
            rldnr
            ryear
            rtcur
            rpmax
            rprctr
            sprctr
            racct
            ktopl
            ktosl
            bklas
            WITH HEADER LINE,
s_table TYPE z_table.

COLLECT s_table INTO t_table.

Rob

Read only

0 Likes
1,331

Rob,

Thank You for Your effort, I will try Your suggestion, and check if it fulfills my expectation soon.

regards, tomek

Read only

0 Likes
1,331

Hi Rob again,

thank You for and idea of possible solution - I had than another confiusion with Unicode incompatibility, but this I think, I will be able to ssolve by myself.

thank You, again, tomek (trying to play more and more with ABAP )

Edited by: Tomasz Przyluski on May 30, 2009 12:36 PM

Read only

0 Likes
1,331

This of course concludes the thread

tomek