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

basic idea on collect statment !

Former Member
0 Likes
1,078

DATA: BEGIN OF IT_BSIS OCCURS 0,

BUKRS TYPE BSIS-bukrs, " co code

HKONT TYPE BSIS-HKONT, "General Ledger Account

BUDAT TYPE BSIS-BUDAT, "Posting Date in the Document

AUFNR TYPE BSIS-AUFNR, " SO Number

WRBTR1 TYPE BSIS-WRBTR, " Amount in document currency

END OF IT_BSIS.

I want to collect the data on wrbtr1 .

LOOP AT IT_BSIS .

COLLECT IT_BSIS INTO IT_BSIS2 .

ENDLOOP.

data in table

1000 0000300000 20071024 0000100000 2560.00

1000 0000300000 20071117 0610000004 100000.00

1000 0000300000 20071201 0000100000 200.00

do i need to have char type fields in table atleast 1 to have proper answer ?

DATA: BEGIN OF IT_BSIS OCCURS 0,

BUKRS TYPE BSIS-bukrs, " co code

HKONT TYPE BSIS-HKONT, "General Ledger Account

BUDAT TYPE BSIS-BUDAT, "Posting Date in the Document

AUFNR TYPE BSIS-AUFNR, " SO Number

WRBTR1 TYPE BSIS-WRBTR, " Amount in document currency

END OF IT_BSIS.

I want to collect the data on wrbtr1 .

LOOP AT IT_BSIS .

COLLECT IT_BSIS INTO IT_BSIS2 .

ENDLOOP.

data in table

1000 0000300000 20071024 0000100000 2560.00

1000 0000300000 20071117 0610000004 100000.00

1000 0000300000 20071201 0000100000 200.00

do i need to have char type fields in table atleast 1 to have proper answer ?

8 REPLIES 8
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,046

Use F1 help.

"Prerequisite for the use of this statement is that wa is compatible with the row type of itab and all components that are not part of the table key must have a numeric data type (i, p, f). "

Read only

Former Member
0 Likes
1,046

Hi,

Its not mandatory to have character type fields to use collect statement.

infact if u have character field , collect statement will not work

table key must have a numeric data type (i, p, f).

tc

sajimon chandran

Read only

Former Member
0 Likes
1,046

<<removed_by_moderator>>

Moderator message:

Don't Copy Paste SAP Help Documentation

Edited by: Vijay Babu Dudla on Apr 23, 2009 2:35 AM

Read only

0 Likes
1,046

hi,

my question is if my internal table has 5 flds all r integers then how does collect statement works ?

so is there any need for char type field

Read only

0 Likes
1,046

No need of char field.

You can collect the field of ur choice in an internal table.

Soemthing like:

Collect HKONT.

Append it_collect.

Read only

Former Member
0 Likes
1,046

Hi,

Loop at it_bsis into wa_bsis.

Read only

Former Member
0 Likes
1,046

Hi,

Collect compares all the char and if values in all char fields are same then the numeric fields are added.

In you case as posting date and SO number's are different it cannot add the WRBTR1 for the same BUKRS & HKONT.

Read only

Former Member
0 Likes
1,046

Read the F1 help or SAP Help documentation on Basic ABAP statements.

Thread is locked for Further posting.