sapdev logo background
sapdev logo sapdev logo

SAP text table create

Although it is not that obvious how to create a SAP text table, once you know it is very simple. Below is a simple step by step guide detailing how it is done and how you then assign it to your master data table. Once finished clicking on the 'Goto->Text Table' option within SE11 will take you to your text table. The other advantage of creating a separate text table is that F4 drop downs will automatically show the code and text without the need for a search help.

Step 1 - Create your ID table via SE11
Create your main table which includes the id field of your data, you can add as many non key fields as you want to this table to store other master data values. You can also add more key fields but you will need to ensure these key fields are also part of the text table we are going to create in a sec. This is all you need to do to this table.

Step 2 - Create your text table via SE11
Next step is to create your text table ensuring its key consists of a field with a data element of type 'SPRAS', a field to store the text plus all key fields from your ID table.

Step 3 - Add foreign keys for MANDT & SPRAS to text table
Still within SE11 you need to create the foreign key relationships for the fields MANDT, SPRAS. To create the foreign key for MANDT place the cursor on the appropriate table row and press the foreign key button

You will then see a popup asking if you want to create a proposal with 0001 as the checktable, click yes on this popup!

Then just accept the proposal by pressing the copy button

Repeat the above process for the SPRAS field, only difference will be that it will propose T002 as the check table.

Step 4 - Add foreign keys for your table ID
Next you need to create the foreign key relationships for your table ID. This is very similar to the steps performed in step 3 so first select the ID table row and press the foreign key button.

You will then be presented with an empty proposal screen

Simple enter the name of your ID table and press the generate proposal button. At this point you need to make a slight change to what is generated automatically by selecting the 'Key fields of a text table' option and adding a cardinality of '1 : N'. Once this is done accept the proposal by pressing the copy button.

Step 5 - Save and Activate
Now save and activate both tables.

Step 6 - Test
If you now open the ID table ZTABLE_ID in SE11 and select the option 'Goto->Text Table' it should load up your text table ZTABLE_TXT. Also now whenever you add your ID field(myid) to another table and link it via a foreign key/checktable the F4 dropdown help for this field will include the text description for possible entries (assuming you have added entries to the ID table(ZTABLE_ID).

comments powered by Disqus