Skip to Content

In this example we have a new config table that defines a code and its meaning.  Let’s say the code is for ‘Cancellation reason’ a two character code (Data element ZCANC_REASON) with a twenty character description (Data element ZCANC_DESC).  In a SAP delivered config table this description would be language dependent and whether or not our system is running multiple languages we should really do the same.

So first we create a config table for just the reason code.  Create it as defined in part 1 of this blog, but don’t create the maintenance dialog yet.

image

Next a text table is needed.  The convention for naming is to take the config table name and suffix it with _T.  Use the same key as the config table, but add a field for language, then the text field.

image

On the key field (CANC_REASON) in the text table we need to define a Foreign key.

image

Enter the original config table (ZMM_REASON) as the check table and in the ‘Foreign key field type’ choose the option ‘Key fields of a text table’.

Now this relationship has been defined, create the maintenance dialog for table ZMM_REASON. 

When we maintain table ZMM_REASON the maintenance dialog gives us this;

image

By setting the foreign key the description is included in the maintenance dialog and will store the text in my logon language.

So, if I enter this;

image

It creates this entry in the text table, as well as the value AB in table ZMM_REASON;

image

If I then log in using another language, I get this view because the config entry exists but without a text for the logged on language.  The heading shows a question mark because I haven’t translated the texts for the DDIC definitions of the tables.

image

If I enter a text now I have these entries in the text table, but still with only one entry in ZMM_REASON;

image

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Fred Verheul
    Hi Nick,

    In most SAP-defined text tables, SPRAS is the first key field, for buffering reasons (generic buffering), as explained in greater detail in the excellent book of Rich and Thomas: “Next Generation ABAP Development”. Apart from that, again a perfect blog. The series is much appreciated!

    Cheers, Fred

    (0) 
    1. Former Member Post author
      Hi Fred,

      Thanks for the feedback.  As you say “most SAP-defined text tables, SPRAS is the first key field”, sadly not the one that I referenced when I started using this technique.

      Clearly not all the SAP developers have read Rich and Thomas’ book.

      Regards,
      Nick

      (0) 

Leave a Reply