I. Notes for using for all entries in select statements
In ABAP programming, using for all entries in is an essential statement. I believe everyone has used it. For example:
Data: Begin of ig_bseg occurs 0,
Werks like bseg-werks,
Belnr like bseg-belnr,
Gjahr like bseg-gjahr,
Dmbtr like bseg-dmbtr,
End of ig_mseg.
If not ig_bkpf [] is initial.
Select werks belnr gjahr dmbtr into corresponding fields of table ig_bseg
From bseg for all entries in ig_bkpf
Where werks = ig_bkpf-werks and belnr = ig_bkpf-belnr and gjahr = ig_bkpf-gjahr.
Endif.
Pay attention to the following issues:
1. First, you must determine whether the internal table after for all entries in is null. If it is null, therefore, the results of comparing fields in the where condition with the internal table are all true, that is, all the conditions are met. This results in a large amount of data being retrieved, which greatly affects the system performance.
2. For the above example, all the line items of a credential can be retrieved by logical analysis, but the actual situation will be different from what you expected, if the dmbtr values of multiple row items of a credential are the same, you will only get one row of record in the ig_bseg of the internal table, instead of multiple rows. It automatically uses distinct, or you can delete duplicate rows. Program Logical errors are difficult to find. The solution is to ensure that the data retrieved from the ig_bseg must have a primary key field. In this example, you need to add the buzei field.
Ii. Notes for self-built tables and data import from outside the system
1. When creating text fields (creating domain by yourself) in a self-built table, be sure to allow the fields to retain the text case. Otherwise, all fields are converted to uppercase letters by default.
2. for various credential encoding fields, such as material credennr NR, kunnr, lifnr, and belnr, when importing data to a self-built table, pay attention to the supplement of leading 0, otherwise, the imported data may not contain leading 0. The function that supplements leading 0 is conversion_exit_alpha_input. In addition, when creating a self-built table, convert the domain corresponding to this field to convers. routine: Set to Alpha.