If there is reprint please indicate the source: http://blog.csdn.net/donkey2004112103/archive/2009/05/03/4145450.aspx
The program often needs to get their description information based on the customer or supplier number, or the company code, distribution channel, etc., all need to get the description information according to the code, if the SELECT statement is used for inner join, it is only troublesome and not flexible. SAP provides many functions to read this information. Summary.
1. Function GroupApar_master
The function group contains the following four functions.
Knaw.read_single: obtains the customer information based on the customer code.
Knb1_read_single: Get customer master data (company code) Information
Lfaw.read_single: obtains supplier information based on supplier code.
Lfb1_read_single: obtains the supplier master data (company code ).
Appreciation of functions:
The function writing logic in this function group is the same. It is a clever use.StaticsThe variable is used to store the five records that have been read before, and is inserted in the form of a queue. This ensures that the recent query records are saved to increase the hit rate. This part is very well written:
Insert es_kna1 into st_kna1 Index 1.
Describe table st_kna1 lines ld_buffer_lines.
If ld_buffer_lines GT gc_knaw.max_lines.
Delete st_kna1 index ld_buffer_lines.
Endif.
The above Code ensures that the query results are first-in-first-out, and then-out to improve the query hit rate.
2. Function GroupMg05
This function group contains many function modules, but currently I am using t00w.single_read. It is a little different from the naming rules above. I don't know whether sap intentionally or accidentally made the mistake. The word order of read and signle has changed.
T0020.single_read: obtains company information based on company code.
Appreciation of functions:
The Statics variable is also used to save the query results, but a record is saved for the value. I don't know why sap only saves one record at this time. A variable such as fehler (1) is used to record whether a query result exists.
3. Function GroupMg46
Almost all functions in this function group have ended with single_read. Currently, the used functions are as follows.
Tvkot_single_read: obtains the text information of the sales organization based on the sales organization and language code.
Tvtwt_single_read: obtains text information about the distribution channel based on the distribution channel code and language.
4. Summary
To obtain text description information, you can search for these functions by keyword in se37. Another more common method is vkorg. In table vbrk, click entry help/check, and then double-click to enter check table: tvko of vkorg. Select goto> text table to find the table in which the corresponding primary record exists.
Search in se37 based on the text table to quickly find the function you want.