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

Collect logic needed

Former Member
0 Likes
783

itdetail_

BUDAT PERIOD SAKNR AUFNR BLART DMBTR

19960329|199603|0000461100|12-6925-0203|VC | 1000.00

19960424|199604|0000461100|12-6925-0203|VC | 16534.00

19960627|199606|0000461100|12-5757-0403|IG | 65.79

I need to collect Collect DMBTR field using AUFNR and BLART

Ho to do this?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
731

hello kumar-

The best way of performing collect statement is upload itab with workarea.

types:begin of ty_collect,

aufnr type aufnr,

blart type blart,

end of ty_collect.

data:it_collect type table of ty_collect,

wa_collect type ty_collect.

loop at itab into wa_collect. ****Here itab is the internal table with data

coollect wa_collect into it_collect. ***it_collect is the new internal table

endloop.

Cheers,

~Srini...

5 REPLIES 5
Read only

Former Member
0 Likes
731

Hi,

see this example


DATA: BEGIN OF seats, 
        carrid   TYPE sflight-carrid, 
        connid   TYPE sflight-connid, 
        seatsocc TYPE sflight-seatsocc, 
      END OF seats. 

DATA seats_tab LIKE HASHED TABLE OF seats 
               WITH UNIQUE KEY carrid connid. 

SELECT carrid connid seatsocc 
       FROM sflight 
       INTO seats. 
  COLLECT seats INTO seats_tab. 
ENDSELECT. 

rgds,

bharat.

Read only

Former Member
0 Likes
731

any one help me pls

Read only

ThomasZloch
Active Contributor
0 Likes
731

you will need to collect into a separate table, which only has the fields AUFNR, BLART and DMBTR.

See also the ABAP help for the statement "COLLECT".

Greetings

Thomas

Read only

Former Member
0 Likes
731

Hi,

Refer to the following code:

SELECT RFAREA RBUKRS RPRCTR RACCT RYEAR HSLVT HSL01 HSL02 HSL03 HSL04 HSL05

HSL06 HSL07 HSL08 HSL09 HSL10 HSL11 HSL12 KSLVT KSL01 KSL02 KSL03

KSL04 KSL05 KSL06 KSL07 KSL08 KSL09 KSL10 KSL11 KSL12 FROM GLPCT

APPENDING TABLE INT_GLPCT WHERE RLDNR = '8A' AND RRCTY = '0'

AND RVERS = '000' AND KOKRS = '1000'

AND RBUKRS IN S_COMP AND RYEAR = P_YEAR

AND RPRCTR IN S_PROFIT AND RACCT IN S_ACCT

AND RFAREA IN S_COST.

LOOP AT INT_GLPCT.

MOVE-CORRESPONDING INT_GLPCT TO INT_GLPCT_COLLECT.

COLLECT INT_GLPCT_COLLECT.

ENDLOOP.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
732

hello kumar-

The best way of performing collect statement is upload itab with workarea.

types:begin of ty_collect,

aufnr type aufnr,

blart type blart,

end of ty_collect.

data:it_collect type table of ty_collect,

wa_collect type ty_collect.

loop at itab into wa_collect. ****Here itab is the internal table with data

coollect wa_collect into it_collect. ***it_collect is the new internal table

endloop.

Cheers,

~Srini...