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: 

report-wrong o/p

Former Member
0 Kudos

hi all, in the code below am getting a wrong o/p that o/p values are repeated,kindly check n plz help me...

loop at it_docu where awtyp = 'BKPF'.

select AUGBL

INTO TABLE IT1

from bseg

where bukrs = '1000'

and belnr = it_docu-docnr

and gjahr = it_docu-ac_gjahr.

endloop.

delete adjacent duplicates from it1 comparing augbl.

loop at IT1.

write 😕 it1-augbl.

endloop.

every helpfull answers will be rewarded

1 ACCEPTED SOLUTION

Bema
Active Participant
0 Kudos

sort it1 by augbl.

then use delete adjacent duplicates...

6 REPLIES 6

Bema
Active Participant
0 Kudos

sort it1 by augbl.

then use delete adjacent duplicates...

prasanth_kasturi
Active Contributor
0 Kudos

use sort it1 by aufgl befor using delete adjacent duplicates

regards

prasanth

Former Member
0 Kudos

Hi,

Sort it1 by augbl.

Delete adjacent duplicates from it1.

Regards,

Narasimha

Former Member
0 Kudos

Hi Sreejith,

find below the changed code.

*loop at it_docu where awtyp = 'BKPF'.

select BUKRS

BELNR

GJAHR

BUZEI

AUGBL

INTO TABLE IT1

from bseg

for all entries in it_docu

where bukrs = '1000'

and awtyp = 'BKPF'

and belnr = it_docu-docnr

and gjahr = it_docu-ac_gjahr.

*endloop.

sort it1 by augbl

delete adjacent duplicates from it1 comparing augbl.

loop at IT1.

write 😕 it1-augbl.

endloop.

check this code, it might be helpful your requirement.

Regards,

Boobalan Suburaj.

Edited by: Boobalan Suburaj on May 20, 2008 1:47 PM

Former Member
0 Kudos

thank u all...

Former Member
0 Kudos

Hello Sreejith,

As you have written the codes it may give the output incorrect and also the runtime will be high.

Firstly if you have declared the tables it_docu and it1 wit header line or with occurs statement then remove that and declare them simply.

Then declare the datas below first.

TABLES: bseg.

DATA: wa_docu LIKE LINE OF it_docu,

wa1 LIKE LINE OF it1.

Then at the place of the code what you have written replace the following code-

*LOOP AT it_docu INTO wa_docu *

WHERE wa_docu-awtyp = 'BKPF'.

READ TABLE bseg WITH KEY

bukrs = '1000'

belnr = wa_docu-docnr

gjahr = wa_docu-ac_gjahr.

IF sy-subrc = 0.

wa1-augbl = bseg-augbl.

APPEND wa1 TO it1.

CLEAR wa1.

ENDIF.

ENDLOOP.

SORT it1.

DELETE ADJACENT DUPLICATES FROM it1

COMPARING augbl.

LOOP AT it1 INTO wa1.

WRITE 😕 wa1-augbl.

ENDLOOP.

Edited by: GAURAV SINGH on May 20, 2008 1:20 PM