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

APPEND

Former Member
0 Likes
384

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.

1 ACCEPTED SOLUTION
Read only

ravisankara_varaprasad
Active Participant
0 Likes
369

Hi,

SORT the internal table table before deleting the entries.

Kind Regards,

Ravi Sankar.Z

2 REPLIES 2
Read only

ravisankara_varaprasad
Active Participant
0 Likes
370

Hi,

SORT the internal table table before deleting the entries.

Kind Regards,

Ravi Sankar.Z

Read only

Former Member
0 Likes
369

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.