In SAP systems, custom lookup tables store associations between code values and names. Learn how you can simplify your SAP CRM system by combining all your lookup tables into a single, generic table. Also, see how you can use this single table to avoid hard coding and to make SAP CRM more flexible.
Key Concept
SAP allows developers to create custom tables to store information per your business needs. For example, you might need a table that stores country codes and names or default values for certain fields. As the number of custom tables in your application grows, the task of managing the tables can become difficult. You can simplify your SAP system by combining custom tables so you need to maintain just one.
In 2006, Dow Corning Corporation implemented SAP CRM 2005 as a foundation for our CRM-related workflows. During this implementation project, we encountered the need for a custom lookup table when we noticed that country codes coming in from another system did not match the codes in SAP CRM.
We created a lookup table to associate the incoming codes with the SAP equivalents. A few days later, we needed to link our internal market segment codes with a description for each segment. Shortly thereafter, we created a new table to store the email addresses of administrators who would receive system alerts when specific processes ran.
After creating several separate tables, we realized that we could simplify the system bycombining these values into a single table. By using just one table, we could avoid having to design and create each table. This meant that we didn’t have to spend time building separate maintenance dialogs, securing their contents, and documenting their purposes.
We developed one generic table containing all the previously created tables within our SAP CRM system. Now we have a single lookup table that we maintain with a simple maintenance dialog. Only authorized users can update the table, and we can transport values from our development system into our quality assurance and production systems.You can use the same concept in virtually any SAP solution.
Create the Custom Table
To combine our custom tables into a single one, we used transaction SE11 to create a table named ZVALUE, which contained the fields shown in Figure 1. The key values are MANDT, TYPE, and CODE because we want to require each code within a given type to be unique. The Initial Values column is checked for each of the fields that the system must populate. Note that the only optional field is the DESCR (description), which is for reference purposes only.

Figure 1
The fields in table ZVALUE
Figure 2 shows the Delivery and Maintenance settings for the ZVALUE table. We created the table in Delivery Class A (an application table), with Data Browser/Table View Maint. set to Display/Maintenance Allowed. This enables us to use transaction SM30 to maintain the entries on the table.

Figure 2
The Delivery and Maintenance settings for table ZVALUE
Finally, under the Technical Settings, we set the Data class to APPL0 (master data), as shown in Figure 3. This is the appropriate setting for tables that the system reads frequently but does not update often. The Size category is set to 0 because we do not expect the table to grow significantly.

Figure 3
The technical settings for the ZVALUE table
Using the Custom Table
In my example, the basic function of the ZVALUE table is to associate a code with a value. For example, to associate the country codes from an external system with their corresponding SAP code, I entered the records shown in Figure 4 into the ZVALUE table. In this example, the Code field corresponds to the country code in the external system, and the Value contains corresponding SAP country code.

Figure 4
The records in table ZVALUE for the country code conversion
Note that this group of records is categorized under the Type CTRY_REF, which is an arbitrary name the developer chose. By adding a unique type to each group of records, you can logically separate one set of records from another group that you use for a different purpose.
When referencing the ZVALUE table in ABAP routines, use the type and code fields to perform a lookup. In this example scenario, the lookup routine that converts the external code to the standard SAP code might look like Figure 5.
SELECT SINGLE value FROM zvalue INTO lv_ctry_code WHERE type = ‘CTRY_REF’ AND code = lv_external_code. |
Figure 5 | Example lookup routine |
Other Uses for the Custom Table
ZVALUEZVALUEZVALUEZVALUEZVALUEZVALUESECURITY_ SEND _CUSTOMERZVALUESECURITY_SEND_CUSTOMERCustom Table Limitations
ZVALUEZVALUEZVALUEZVALUEZVALUECODEVALUESTRINGSE75S010STXHREAD_TEXT William R. Pritchett
William (Bill) Pritchett has more than 25 years of IT industry experience and has worked at Dow Corning Corporation for the past 16 years. Over the past eight years he has focused on the company’s CRM systems and processes. His current responsibilities include expanding the capabilities of Dow Corning’s SAP CRM 7.0 system.
You may contact the author at bill.pritchett@dowcorning.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.