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: 

FOR ALL ENTRIES stmnt. in SELECT query is not running properly

Former Member
0 Kudos

Hello experts,

In my report program, I write one query on table BSIS.

Internal table declaration -

DATA : BEGIN OF DLC_BSIS OCCURS 0,

BUKRS LIKE BSIS-BUKRS,

GJAHR LIKE BSIS-GJAHR,

BELNR LIKE BSIS-BELNR,

SHKZG LIKE BSIS-SHKZG,

BSCHL LIKE BSIS-BSCHL,

AUFNR LIKE BSIS-AUFNR,

HKONT LIKE BSIS-HKONT,

QSSKZ LIKE BSIS-QSSKZ,

DMBTR LIKE BSIS-DMBTR,

END OF DLC_BSIS.

Query as follows --

SELECT BUKRS

GJAHR

BELNR

AHKZG

BSCHL

AUFNR

HKONT

QSSKZ

DMBTR FROM BSIS

INTO TABLE DLC_BSIS

FOR ALL ENTRIES IN IT_BKPF2

WHERE BELNR = IT_BKPF2-BELNR

AND BUKRS = IT_BKPF2-BUKRS

AND GJAHR = IT_BKPF2-GJAHR.

IT_BKPF2 internal table having -- BUKRS - LT01

BELNR - 6400000061

GJAHR - 2009.

And in BSIS database table -- 3 entries are there for the above documnet.

But, in my internal only one entry has come for the same above document.

I think For all entries stmnt. is not running properly. But Why it's not running properly.??

What would be the reason..??

Thanks in advance....!!

Regards,

Poonam.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

>

> Hello experts,

> In my report program, I write one query on table BSIS.

>

> Internal table declaration -

>

> DATA : BEGIN OF DLC_BSIS OCCURS 0,

> BUKRS LIKE BSIS-BUKRS,

> GJAHR LIKE BSIS-GJAHR,

> BELNR LIKE BSIS-BELNR,

> SHKZG LIKE BSIS-SHKZG,

> BSCHL LIKE BSIS-BSCHL,

> AUFNR LIKE BSIS-AUFNR,

> HKONT LIKE BSIS-HKONT,

> QSSKZ LIKE BSIS-QSSKZ,

> DMBTR LIKE BSIS-DMBTR,

> END OF DLC_BSIS.

>

> Query as follows --

>

> SELECT BUKRS

> GJAHR

> BELNR

> AHKZG

> BSCHL

> AUFNR

> HKONT

> QSSKZ

> DMBTR FROM BSIS

> INTO TABLE DLC_BSIS

> FOR ALL ENTRIES IN IT_BKPF2

> WHERE BELNR = IT_BKPF2-BELNR

> AND BUKRS = IT_BKPF2-BUKRS

> AND GJAHR = IT_BKPF2-GJAHR.

>

> IT_BKPF2 internal table having -- BUKRS - LT01

> BELNR - 6400000061

> GJAHR - 2009.

>

> And in BSIS database table -- 3 entries are there for the above documnet.

>

> But, in my internal only one entry has come for the same above document.

>

> I think For all entries stmnt. is not running properly. But Why it's not running properly.??

> What would be the reason..??

>

>

> Thanks in advance....!!

>

> Regards,

> Poonam.

include the buzei field in selection criteria i have faced the same situation earlier.

always select all the key fields.

varun

13 REPLIES 13

Former Member
0 Kudos

hi,

try this..

first you take all the KEY FIELDS from the BFPE as well as in BSIS table..

hope this helps you

Regards

Ritesh j

0 Kudos

First of all use into corresponding fields of table. Now which test data ur using be sure that they are right means just check them in table again .

former_member404244
Active Contributor
0 Kudos

HI,

1> For all entries deletes the duplicate entries... Hence u might not be getting the record information..

Also its always suggestable u should first check the initiality of the table which u r writing for all entries.

IF NOT IT_BKPF2[] IS INITIAL.

SELECT BUKRS

GJAHR

BELNR

AHKZG

BSCHL

AUFNR

HKONT

QSSKZ

DMBTR FROM BSIS

INTO TABLE DLC_BSIS

FOR ALL ENTRIES IN IT_BKPF2

WHERE BELNR = IT_BKPF2-BELNR

AND BUKRS = IT_BKPF2-BUKRS

AND GJAHR = IT_BKPF2-GJAHR.

ENDIF.

Regards,

Nagaraj

Former Member
0 Kudos

Hi,

That sounds strange. Just for testing purpose instead of using for all entries and IT_BKPF2 , directly hardcode the values in the where condition and check if the three records are fetched and let us know the status.

Regards,

Vikranth

0 Kudos

Hi Vikranth,

I already tested that one. When i hardcode it, it coming all 3 records.

But, not in for all entries case.

Thanks,

Poonam.

faisal_altaf2
Active Contributor
0 Kudos

Hi, Ratil

SELECT ALL Key Fields as Ritesh Suggested it will solve out your problem,

Regards,

Faisal

Former Member
0 Kudos

Hi,

First check again that there are 3 enteries in BSIS table with the given combination of the value.

If it is then try to use this statement.

if it_bkpf2[] is not intial.

SELECT BUKRS

GJAHR

BELNR

AHKZG

BSCHL

AUFNR

HKONT

QSSKZ

DMBTR FROM BSIS

INTO corresponding fields of TABLE DLC_BSIS

FOR ALL ENTRIES IN IT_BKPF2

WHERE BELNR = IT_BKPF2-BELNR

AND BUKRS = IT_BKPF2-BUKRS

AND GJAHR = IT_BKPF2-GJAHR.

endif.

Regards,

Rajesh Kumar

Former Member
0 Kudos

Hi,

Try with on econcition at a time and see which condition is causing the problem like just use the belnr and comment the other two conditions then check if all the desired entries are getting selected or not.

Regards,

Himanshu

Former Member
0 Kudos

put the below fields i your select query too

BUKRS

HKONT

AUGDT

AUGBL

ZUONR

GJAHR

BELNR

BUZEI

I Think it will serve the purpose.

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Poonam,

As suggested in some posts while SELECTing using FOR ALL ENTRIES(FAE) you should always make a point of using all the KEY fields even if they are not required.

You may ask WHY? Do an F1 on FAE, it tells that FAE deletes the duplicate entries and then populates the target internal table.

Hope i am clear.

BR,

Suhas

Former Member
0 Kudos

>

> Hello experts,

> In my report program, I write one query on table BSIS.

>

> Internal table declaration -

>

> DATA : BEGIN OF DLC_BSIS OCCURS 0,

> BUKRS LIKE BSIS-BUKRS,

> GJAHR LIKE BSIS-GJAHR,

> BELNR LIKE BSIS-BELNR,

> SHKZG LIKE BSIS-SHKZG,

> BSCHL LIKE BSIS-BSCHL,

> AUFNR LIKE BSIS-AUFNR,

> HKONT LIKE BSIS-HKONT,

> QSSKZ LIKE BSIS-QSSKZ,

> DMBTR LIKE BSIS-DMBTR,

> END OF DLC_BSIS.

>

> Query as follows --

>

> SELECT BUKRS

> GJAHR

> BELNR

> AHKZG

> BSCHL

> AUFNR

> HKONT

> QSSKZ

> DMBTR FROM BSIS

> INTO TABLE DLC_BSIS

> FOR ALL ENTRIES IN IT_BKPF2

> WHERE BELNR = IT_BKPF2-BELNR

> AND BUKRS = IT_BKPF2-BUKRS

> AND GJAHR = IT_BKPF2-GJAHR.

>

> IT_BKPF2 internal table having -- BUKRS - LT01

> BELNR - 6400000061

> GJAHR - 2009.

>

> And in BSIS database table -- 3 entries are there for the above documnet.

>

> But, in my internal only one entry has come for the same above document.

>

> I think For all entries stmnt. is not running properly. But Why it's not running properly.??

> What would be the reason..??

>

>

> Thanks in advance....!!

>

> Regards,

> Poonam.

include the buzei field in selection criteria i have faced the same situation earlier.

always select all the key fields.

varun

sivaprasad_ml
Participant
0 Kudos

Poonam,

I too faced the same problem.

It could be resolved if you select BUZEI field in the select statement.

rgds

Siva

sivaprasad_ml
Participant
0 Kudos

Poonam,

I too faced the same problem.

It could be resolved if you select BUZEI fieldalong with others in the select statement for BSIS.

rgds

Siva