‎2007 May 28 11:41 AM
Hi all,
I have written a code like this.
SELECT
AUFNR
AEDAT
WERKS
GAMNG
GMEIN
PLNBEZ
DISPO
OBJNR
FROM CAUFV
INTO TABLE IT_CAUFV
WHERE CAUFV~AEDAT IN S_AEDAT
AND CAUFV~AUFNR = '000001000932'.
SORT IT_CAUFV BY OBJNR.
SELECT coep~MATNR
COEP~WTGBTR
COEP~MEGBTR
COEP~MEINH
COEP~OBJNR
MARA~MTART
FROM COEP INNER JOIN MARA
ON COEPMATNR = MARAMATNR
INTO TABLE IT_RESB
FOR ALL ENTRIES IN IT_CAUFV
WHERE
coep~OBJNR = IT_CAUFV-OBJNR
AND MARA~MTART IN ('YFLM','YCHE','YRAW').
Here my prob is in my 2nd select statement.
My 2nd select is not fetching all the records frm coep table.
Can anyone explain y this happens and pls suggest me a solution.
Thanks in advance.
alex
‎2007 May 28 11:48 AM
Hi alex,
In your second select you need to fetch all the primary keys (data) also to get the exact data..
give the primary key fields also in the select statement..
See for eg: Take MARD.. you have three primary keys..(MATNR ,WERKS,LGORT)
and if you are fetching onlt matnr and werks some data would be missing when fetching them/.
see the CODE INSPECTOR of your program you will know the problem..
rewards if useful,
regards,
nazeer
‎2007 May 28 11:45 AM
hi Alex,
do this way
IF NOT IT_CAUFV[] IS INITIAL.
SELECT coep~MATNR
COEP~WTGBTR
COEP~MEGBTR
COEP~MEINH
COEP~OBJNR
MARA~MTART
FROM COEP INNER JOIN MARA
ON COEPMATNR = MARAMATNR
INTO <b>CORRESPONDING FIELDS OF</b> TABLE IT_RESB
FOR ALL ENTRIES IN IT_CAUFV
WHERE
coep~OBJNR = IT_CAUFV-OBJNR
AND MARA~MTART IN ('YFLM','YCHE','YRAW').
ENDIF.
Message was edited by:
Santosh Kumar Patha
‎2007 May 28 11:48 AM
Hi alex,
In your second select you need to fetch all the primary keys (data) also to get the exact data..
give the primary key fields also in the select statement..
See for eg: Take MARD.. you have three primary keys..(MATNR ,WERKS,LGORT)
and if you are fetching onlt matnr and werks some data would be missing when fetching them/.
see the CODE INSPECTOR of your program you will know the problem..
rewards if useful,
regards,
nazeer
‎2007 May 28 11:49 AM
‎2007 May 28 11:50 AM
HI,
Actually if there are duplicate entries when comparing the fields that you are retreiving, the select statements will not retrieve tha duplicates entries but the first one!
Try by retreiving more fields like buzei , even if you are not using them!
Hope that this helps you,