‎2007 Oct 29 7:49 PM
Hi all,
What is the meaning of FOR ALL ENTRIES IN.. as in the code below: where can I find the documentation of FOR ALL?
Code:
SELECT * INTO CORRESPONDING FIELDS OF TABLE L_SPETAB
FROM VBAK
FOR ALL ENTRIES IN LVBUK
WHERE VBELN = LVBUK-VBELN
AND LIFSK IN LIFSPE
AND VKORG = VKORG
AND VTWEG IN VTWEG
AND SPART IN SPART.
What is the meaning of IN (as in the last line of code above)?
Thanks,
Charles.
‎2007 Oct 29 7:55 PM
Hi,
From online help ...
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm
Tabular Conditions:
The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
<cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
Regards,
Ferry Lianto
‎2007 Oct 29 7:51 PM
Hello...
FOR ALL ENTRIES IN LVBUK
... Query will select the records for all the VBELN in the table LVBUK...
IN ... for select-options
When you want to use the select options you have to use the IN operator to check against your select-options.
Regards,
Naimesh Patel
‎2007 Oct 29 7:52 PM
Just put your cursor on WHERE in a SELECT statement and press F1. It will answer both questions.
Rob
‎2007 Oct 29 7:55 PM
Hi,
From online help ...
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm
Tabular Conditions:
The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
<cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
Regards,
Ferry Lianto
‎2007 Oct 29 7:57 PM
Check the below link for help docu:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/content.htm
Thanks
Seshu