09-16-2008 5:03 AM
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
09-16-2008 5:15 AM
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.
09-16-2008 5:15 AM
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.
09-16-2008 5:18 AM
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).
09-16-2008 5:26 AM
09-16-2008 5:33 AM
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.