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: 

How Can i Collect for non-key fields ?

Former Member
0 Kudos

I wanna collect 'whour' , 'ahour' fields for my 'pjtp' field ?

but collect doesn't work

How can i do this ? using append ?

1 ACCEPTED SOLUTION

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

See if this is useful for you

Regards.

6 REPLIES 6

VijayaKrishnaG
Active Contributor
0 Kudos

Hi Burak,

Your query is not much clear. It would be better if you elaborate your requirement.

In your requirement what is AHOUR and PJTP?

For COLLECT statement non key fields should be numeric.

Regards,

Vijay

0 Kudos

Whour and ahour fields are numeric this fields will be collected for 'PJTP' field this field is non-key field.

0 Kudos

For COLLECT statement non key fields should be numeric. And from which table these fields are?

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

See if this is useful for you

Regards.

chinni_adapa
Participant
0 Kudos

Hi Burak,

see the below code, it may help you.

TYPES: BEGIN OF ty_test,

        col1(3) TYPE c,

        col2 TYPE i,

        col3    TYPE i,

END OF ty_test.

DATA: gt_test TYPE STANDARD TABLE OF ty_test,

       gs_test TYPE ty_test.

DATA gt_test1 TYPE STANDARD TABLE OF ty_test.

gs_test-col1 = 'IND'.

gs_test-col2 = 20.

gs_test-col3 = 6.

APPEND gs_test TO gt_test.

CLEAR gs_test.

gs_test-col1 = 'USA'.

gs_test-col2 = 10.

gs_test-col3 = 3.

APPEND gs_test TO gt_test.

CLEAR gs_test.

gs_test-col1 = 'IND'.

gs_test-col2 = 12.

gs_test-col3 = 7.

APPEND gs_test TO gt_test.

CLEAR gs_test.

LOOP AT gt_test INTO gs_test.

COLLECT gs_test INTO gt_test1.

   CLEAR gs_test.

ENDLOOP.

Regards,

Chinni

0 Kudos

Hi Chinni,

In his case, there is a CHAR type field in Non Key set.

Regards,

Vijay