Monday, 6 January 2014

Append Structures in SAP TABLES

Append Structures in SAP  TABLES

Having looked at foreign keys, the next thing to look at are Append structures. These can be used to add additional fields. This is the preferred method for maintaining SAP deliv-ered tables and quite often for customer-specific tables. If one does not use Append struc-tures, problems can arise if, for example, a new version of SAP is used which does not cor-respond with aspects of the tables already created, resulting in serious errors.
Append structures give a safe way to enhance tables. When these are used, the initial ta-ble remains unchanged, removing any risk of changes being overwritten later if a different version of SAP is used. Quite often, a table may have multiple Append structures applied to it, because different development needs have arisen as time has gone by and people have wanted to add further fields to the standard SAP tables
In the SE11 Maintain Table screen, go to the ‘Append structure’ button on the right of the top toolbar
Append Structures in SAP  TABLES

Click this, and the system will suggest a name, ZAZEMPLOYEES2 (note that this, again, must begin with a Z). Accept this and you will be presented with what looks like an empty table structure. Enter the Short text “Extra Fields For Employees”, and then move down to the table.
Note that the first field now is called ‘Component’. This is where new fields are created. However, it may be useful to differentiate between fields created in the main table, and the new components created here in the Append structure. Since both must comply with the customer name rules, where Z was used in the main table, here use ZZ.
For the first component, a ‘Department’ field will be created. Type in the ‘Component’ box ‘ZZDEPT’ and the same again in ‘Component type’. For this Component type, use forward navigation in the same way that it was used for the Data element before, double-clicking to create. Save the Append structure as a local object when prompted, and then select to create a Data element when prompted subsequently
The familiar data element screen will now appear. Type ‘Department’ for the short text, use CHAR10 for the domain and ‘Department’ again for the Field labels, then activate the data element. Step back to the Append structure screen, then Activate:
     
 


Append Structures in SAP  TABLES

Return to the main table screen, where a new row displaying the Append structure will have been created. To then access this structure, simply double-click the row. In Change mode only the ‘.APPEND’ line will be visible by default, but in Display mode the fields cre-ated within this will appear below
Append Structures in SAP  TABLES

This is a very useful way to add new fields to a table without affecting the structure of the table itself. If one then browses the data as normal, a new column will have been called ‘Department’. Data can then be entered into this field just like it can for any other
                             
Append Structures in SAP  TABLES


No comments:

Post a Comment