05-20-2008 11:37 AM
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
05-20-2008 11:39 AM
05-20-2008 11:39 AM
05-20-2008 11:41 AM
use sort it1 by aufgl befor using delete adjacent duplicates
regards
prasanth
05-20-2008 11:45 AM
Hi,
Sort it1 by augbl.
Delete adjacent duplicates from it1.
Regards,
Narasimha
05-20-2008 11:45 AM
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
05-20-2008 12:04 PM
05-20-2008 12:18 PM
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