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: 

Collect Statement Issue?

Former Member
0 Kudos

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

5 REPLIES 5

anup_deshmukh4
Active Contributor
0 Kudos

Yep its the basic prerequsit for collect statement to work...!

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Answered