03-11-2010 8:57 AM
Hi,
i have the internal table as
BEGIN OF TY_FINAL,
GPID TYPE PERSONID_EXT, "GPID
TP_NAME(11) TYPE C, "THIS FIELD IS USED BELOW TO DETERMINE WHICH WT TO USE.
INV_ID(12) TYPE C, "INVOICE NUMBER
ISA_DATE(6) TYPE C, "USED FOR VALIDATION, NOT LOADED INTO SAP
ISA_TIME(4) TYPE C, "USED FOR VALIDATION, NOT LOADED INTO SAP
NAME_QUALIF(2) TYPE C, "USED TO IDENTIFY EMPLOYEE / VENDOR RECORDS. NOT LOADED INTO SAP.
NAME(35) TYPE C, "USED ON ERROR LOG. NOT LOADED INTO SAP.
ID(9) TYPE N, "TRANSACTION WILL ERROR OUT IF 9 DIGITS ARE SENT: ID VALUE 0014, 0015.
TOT_INV_AMOUNT(10) TYPE N, "GOAL AMOUNT ON FILE
TOT_SUB_AMOUNT(10) TYPE N, "SUBSIDY AMOUNT
END OF TY_FINAL,
this internal table is of sorted table with unique key GPID and TP_NAME.
In this table if i have more than one records with Same GPID with SAME NAME i need to Collect the Amount Fields and placed as a single record in the other internal table.
Here the amount fields are TOT_INV_AMOUNT(10) and TOT_SUB_AMOUNT(10).
here when i use Collect Satatement it says that the Non Key fields Should be of type (I,P or F)
Please let me know the Solution with sample code.
Regards,
Pavan
03-11-2010 9:00 AM
03-11-2010 9:00 AM
Hello,
Collect statement adds contents of all integer fields (Type I,F or P). In your declaration the field tot_amount is of type N which does not work with collect. Change the type from N to I.
Regards
Sachin
03-11-2010 9:17 AM
There is two types of datatype
1. Numeric
1.1 I - Integer
1.2 F - Floating
1.3 P - Packed
2. Character
2.1 C - Character
2.2 D - Date
2.3 T - Time
2.4 N - Numeric
2.5 String
2.6 X - Hexadecimal
The collect statement will work on numeric fields only i.e I, F & P.
Thanks
Chinni
03-11-2010 9:57 AM
Hi Kumar,
You cvant use collect statement for a field of type character. You can only apply collect statement on mumeric types...I, P, F.
Regards
Nanda
08-25-2010 11:44 AM