‎2014 May 26 8:53 AM
Hello Experts, Good Day.
I am facing problem with SELECT statement when I am using FOR ALL ENTRIES.
When I am using FOR ALL ENTRIES IN <tab> WHERE <field> = <tab-field> some entries are not getting fetched from the database. That time if I am using Select-Option like appending required conditions into Select option and using normal SELECT statement with WHERE <field> IN <s_option> then all the required entries are getting captured.
SELECT VBELN MBDAT MATNR WERKS LFIMG VRKME VGBEL FROM LIPS
INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
FOR ALL ENTRIES IN IT_LIKP
WHERE VBELN = IT_LIKP-VBELN
AND WERKS EQ P_WERKS.
The above select query missing some entries from database. But if am using as below, I am getting all the entries.
LOOP AT IT_LIKP INTO WA_LIKP.
S_VBELN-SIGN = 'I'.
S_VBELN-OPTION = 'EQ'.
S_VBELN-LOW = WA_LIKP-VBELN.
APPEND S_VBELN.
CLEAR S_VBELN.
ENDLOOP.
SELECT VBELN MBDAT MATNR WERKS LFIMG VRKME VGBEL
FROM LIPS
INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
* FOR ALL ENTRIES IN IT_LIKP
WHERE VBELN IN S_VBELN
* WHERE VBELN = IT_LIKP-VBELN
AND WERKS EQ WERKS.
‎2014 May 26 9:05 AM
The FOR ALL ENTRIES will remove duplicate results, if you do not provide the full primary key, some identical records may (and will) be removed. So add POSNR in the result of the SELECT statement.
NB: You could also get back to the LIKP select and try a JOIN with LIPS in case of performance problem : Remenber FOR ALL ENTRIES get bad performance for big set of data when IN RANGE option often get dumps in the same case...
Regards,
Raymond
‎2014 May 26 9:05 AM
The FOR ALL ENTRIES will remove duplicate results, if you do not provide the full primary key, some identical records may (and will) be removed. So add POSNR in the result of the SELECT statement.
NB: You could also get back to the LIKP select and try a JOIN with LIPS in case of performance problem : Remenber FOR ALL ENTRIES get bad performance for big set of data when IN RANGE option often get dumps in the same case...
Regards,
Raymond
‎2014 May 26 9:29 AM
Hi Raymond,
Thanks for the explanation and additional information provided.
Vijay
‎2014 May 26 9:10 AM
Hello Vijay,
Add POSNR in your select query and check.
SELECT VBELN
POSNR " Add posnr
MBDAT MATNR WERKS LFIMG VRKME VGBEL FROM LIPS
INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
FOR ALL ENTRIES IN IT_LIKP
WHERE VBELN = IT_LIKP-VBELN
AND WERKS EQ P_WERKS.
Thanks
‎2014 May 26 9:21 AM
Hi,
You are trying to fetch delivery items(LIPS) but you havent included item no(POSNR).
Please pass POSNR then let us know.
Regards,
Vadamalai A