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

ACDOCA Select Query Issue

naveen_yadavs
Explorer
0 Likes
5,536

Hello All, I am fetching data from below select query -

SELECT rldnr,
rbukrs AS bukrs,
gjahr,
belnr,
"docln AS buzei,
drcrk AS shkzg,
hsl AS dmbtr,
wsl AS wrbtr,
zuonr,
sgtxt,
rcntr AS kostl,
anln1,
racct AS saknr,
ps_psp_pnr AS posid,
kunnr,
lifnr,
"wmwst,
kokrs,
awsys,
"projn,
ebeln,
ebelp,
racct AS hkont,
"mwsts,
koart,
ktosl
FROM acdoca
INTO CORRESPONDING FIELDS OF TABLE @lt_bseg
FOR ALL ENTRIES IN @lt_bkpf
WHERE rbukrs = @lt_bkpf-bukrs
AND belnr = @lt_bkpf-belnr
AND gjahr = @lt_bkpf-gjahr.

where lt_bkpf-bukrs = '1000', lt_bkpf-belnr = '1000002099' and lt_bkpf-gjahr = '2020', i got 26 records in my internal table (lt_bseg).

But when i am checking in SE16N with above BUKRS, BELNR & GJAHR, there are 50 records.

Any solution for above issue.

Thankyou In advance.

Regards,

Naveen

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
4,064

To prevent the FOR ALL ENTRIES suppression of duplicates I almost always extract the full primary keys of the database table, so no record will be discarded. So add fields RLDNR, and DOCLN (back) to your select and structure.

3 REPLIES 3
Read only

FredericGirod
Active Contributor
4,064

FOR ALL ENTRIES removes duplicates result of the fields indicated in the SELECT.

The entire logical expression sql_cond is evaluated for each individual row of the internal table itab. The results set of the SELECT statement is the union set of the results sets produced by the individual evaluations. Rows that appear in duplicate are removed from the results set automatically. If the internal table itab is empty, the entire WHERE condition is ignored and all rows from the database are placed in the results set.

Read only

RaymondGiuseppi
Active Contributor
4,065

To prevent the FOR ALL ENTRIES suppression of duplicates I almost always extract the full primary keys of the database table, so no record will be discarded. So add fields RLDNR, and DOCLN (back) to your select and structure.

Read only

naveen_yadavs
Explorer
0 Likes
4,064

Thankyou Frederic and Raymond,

For your quick response, both of you are right.