‎2008 Mar 17 9:46 AM
Hi all
If u see below there are two SELECT statements.In the first statement am selecting RECORD1 and in the second SELECT statement i want to select RECORD2.But whats happening is RECORD 1 is getting selected TWICE and in the output am getting as
RECORD1
RECORD1
RECORD2.
I tried using INTO table it_bseg in the second statment but am not getting it.Am also using DELETE ADJACENT.....But am getting the same out put.Please help.
With regards
Vijay
SELECT
belnr gjahr buzei bschl koart shkzg wrbtr
sgtxt saknr hkont kunnr lifnr prctr FROM bseg
INTO TABLE it_bseg FOR ALL ENTRIES IN it_bkpf
WHERE bukrs EQ p_bukrs AND belnr EQ it_bkpf-belnr AND
gjahr EQ p_gjahr AND umskz NE 'F' .
if not it_bseg[] is initial.
SELECT
belnr gjahr buzei bschl koart shkzg wrbtr sgtxt saknr hkont kunnr lifnr prctr FROM bseg
APPENDING table it_bseg
FOR ALL ENTRIES IN it_bseg WHERE bukrs EQ p_bukrs AND belnr EQ it_bseg-belnr AND gjahr EQ p_gjahr
AND umskz NE 'F' AND bschl IN r_bschl.
DELETE ADJACENT DUPLICATES FROM it_bseg comparing bschl belnr prctr.
endif.
‎2008 Mar 17 1:20 PM
Hi,
SORT the internal table table before deleting the entries.
Kind Regards,
Ravi Sankar.Z
‎2008 Mar 17 1:20 PM
Hi,
SORT the internal table table before deleting the entries.
Kind Regards,
Ravi Sankar.Z
‎2008 Mar 17 5:02 PM
Hi,
The problem is due the condition "AND bschl IN r_bschl" in the second select statement since the select option may be initial. When you use select option, it will fetch a record even when the select option parameter field is initial and if all other conditions are satisfied.
Thanks,
Muthu.