For all entries in itab usage

Source: Internet
Author: User

Instance used:

 1 IF gt_knvv[] IS NOT INITIAL. 2 SELECT kunnr vkorg vtweg spart kunn2 3 FROM knvp 4 INTO CORRESPONDING FIELDS OF TABLE gt_knvp 5 FOR ALL ENTRIES IN gt_knvv 6 WHERE kunnr = gt_knvv-kunnr 7 AND vkorg = gt_knvv-vkorg 8 AND vtweg = gt_knvv-vtweg 9 AND spart = gt_knvv-spart10 AND parvw = 'WE'.11 END IF.

 

Note:

1. With this statement, the system automatically deletes duplicate rows for the final result set.

Therefore, if you want to keep repeated Row Records, remember to add enough key-value items in the SELECT statement (add all key-value items if necessary ),

To ensure that repeated items in the result set are not deleted. (For example, when selecting the payment amount, the payment event may be different, but the amount may be the same. Pay attention to this to avoid incorrect deletion of the result record .)

2. If the internal table itab used after for all entries in is empty, the system selects all records under the current client. Therefore, to avoid meaningless searches, you must determine whether the itab in the internal table is null before using this statement. If it is null, the Database Retrieval Processing containing this statement is not executed.

3. Because itab-F is actually replaced as a placeholder, the internal table itab should not contain header rows (Project ID name rows) to avoid confusion and retrieval errors.

4. the type and length of the item used as a condition replacement in the itab internal table must be the same as that in the Retrieval Database. Otherwise, the compilation fails.

5. The like, between, and in comparison operators cannot be used to replace items in the itab table as conditions.

6. When this statement is used, the order by statement and having statement cannot be used.

7. When this statement is used, All Aggregate functions (max, Min, AVG, sum) except count (*) cannot be used.

Bytes -----------------------------------------------------------------------------------------------

In addition, the inner join statement of open SQL can be replaced by the for all entries in statement:

① Inner join statement:

1 SELECT DISTINCT knb1~bukrs t001~butxt2     FROM knb1 INNER JOIN t0013     ON knb1~bukrs = t001~bukrs4     INTO CORRESPONDING FIELDS OF TABLE tb_bukrs5     WHERE kunnr IN rn_kunnr.

 

② For all entries in statement

 1 SELECT DISTINCT bukrs  2   INTO CORRESPONDING FIELDS OF TABLE gt_knb1 3   FROM knb1. 4  5 IF gt_knb1[] IS NOT INITIAL. 6 SELECT DISTINCT butxt FROM t001 7  INTO CORRESPONDING FIELDS OF TABLE gt_too1 8  FOR ALL ENTRIES IN gt_knb1 9  WHERE bukrs = gt_knb1-bukrs.10 END IF.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.