09-03-2009 8:11 AM
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.
09-03-2009 10:39 AM
>
> 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
09-03-2009 8:15 AM
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
09-03-2009 8:19 AM
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 .
09-03-2009 8:23 AM
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
09-03-2009 8:23 AM
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
09-03-2009 9:16 AM
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.
09-03-2009 8:25 AM
Hi, Ratil
SELECT ALL Key Fields as Ritesh Suggested it will solve out your problem,
Regards,
Faisal
09-03-2009 8:26 AM
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
09-03-2009 8:28 AM
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
09-03-2009 8:55 AM
put the below fields i your select query too
BUKRS
HKONT
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
I Think it will serve the purpose.
09-03-2009 9:16 AM
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
09-03-2009 10:39 AM
>
> 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
10-05-2009 3:25 PM
Poonam,
I too faced the same problem.
It could be resolved if you select BUZEI field in the select statement.
rgds
Siva
10-05-2009 3:26 PM
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