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

Error in collect statement(non-key fields must be numeric)...

aris_hidalgo
Contributor
0 Likes
5,246

Error in collect statement(non-key fields must be numeric)...

Hello Experts,

I created an internal table based from a ztable. The structure of the ztable is

as follows:

1. MANDT -> PRIMARY KEY

2. BUKRS -> PRIMARY KEY

3. TXK50 -> PRIMARY KEY

4. ANLKL -> PRIMARY KEY

5. KTANSW -> PRIMARY KEY

6. KOSTL -> PRIMARY KEY

Then the remainder of the fields(around 8 fields) are currency data types(ANBTR).

An error is showing saying 'You can only use the collect command in a table if all of its non-key

fields are numeric(type I,P or F).

I searched the forum and it said that non-keys must be numeric in order for the

collect command to work. But all of my primary keys are non-numeric.

Below is my declaration:


CLASS-DATA: gt_output_acq TYPE hashed TABLE OF zsd_output_acq
                              WITH UNIQUE KEY bukrs txk50 anlkl
                                              ktansw kostl,
                gt_output_ret LIKE gt_output_acq,
                wa_output_gen LIKE LINE OF gt_output_acq,
                gt_output_net TYPE HASHED TABLE OF zsd_output_net
                              WITH UNIQUE KEY bukrs txk50 anlkl
                                              ktansw kostl,
                wa_output_net LIKE LINE OF gt_output_net,
                gt_sort_crit  TYPE SORTED TABLE OF t_sort_crit
                              WITH NON-UNIQUE KEY bukrs kostl,
                wa_sort_crit  LIKE LINE OF gt_sort_crit.

FIELD-SYMBOLS: <fs_output_acq> LIKE LINE OF gt_output_acq,
                   <fs_output_ret> LIKE LINE OF gt_output_ret,
                   <fs_output_net> LIKE LINE OF gt_output_net.

COLLECT <fs_output_acq> INTO gt_output_acq.	"Here is the error

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,619

the problem is not with the key fields. it is with the non keyfields which are numeric one.

since you are using field-symbols it is giving that error.

it depends on how you defined the field-symbols.

the problem is not with the key fields. it is with the non keyfields which are numeric one.

since you are using field-symbols it is giving that error.

it depends on how you defined the field-symbols.

4 REPLIES 4
Read only

Former Member
0 Likes
2,620

the problem is not with the key fields. it is with the non keyfields which are numeric one.

since you are using field-symbols it is giving that error.

it depends on how you defined the field-symbols.

Read only

0 Likes
2,619

Hi Vijay,

All of my non-key fields are of type ANBTR which is a currency datatype. I declared my field-symbols as the work area for my internal table(LIKE LINE OF ITAB).

Read only

0 Likes
2,619

how you defined the internal table..?

can you show that.

Read only

0 Likes
2,619

Hi Vijay,

Here it is:


CLASS-DATA: gt_output_acq TYPE hashed TABLE OF zsd_output_acq
                              WITH unique KEY bukrs txk50 anlkl
                                              ktansw kostl,
                gt_output_ret LIKE gt_output_acq,
                wa_output_gen LIKE LINE OF gt_output_acq,
                gt_output_net TYPE hashed TABLE OF zsd_output_net
                              WITH unique KEY bukrs txk50 anlkl
                                              ktansw kostl,
                wa_output_net LIKE LINE OF gt_output_net,
                gt_sort_crit  TYPE SORTED TABLE OF t_sort_crit
                              WITH NON-UNIQUE KEY bukrs kostl,
                wa_sort_crit  LIKE LINE OF gt_sort_crit.