Monday, 6 January 2014

Add New Fields to DATABASE Table in SAP ABAP

Add New Fields to DATABASE Table in SAP ABAP

Next, a new field will be added. This will be a non-key field and will be called INITIALS.
Create a new Data element for this named ZINITIALS using forward navigation. For the data element, set the short text to ‘Initials’ and set the domain to CHAR03 (a character string of length 3). In the Field label boxes type ‘Initials’, then activate the Data element. The table should now have a new field like this
Create another 3 more new fields and configure them as follows

Add New Fields to DATABASE Table in SAP ABAP

Field Name ‘GENDER’
o Set the Data element to ‘ZGENDER’. Configure the data element as follows:
   § Short text: ‘Gender’
   § Domain: ‘CHAR01’
   § Field labels set to ‘Gender’


SALARY
o Set the Data element to ZSALARY
  § Short text: ‘Salary’
  § Domain: ‘CURR9’ (This has a length of 9, with 2 decimal places)
  § Field labels set to ‘Salary’.

One thing to note about the Salary field is that, because it is a currency, another field for this currency must be created and attached to ZSALARY to indicate what currency the sal-ary is in. If you try to activate the table without doing this, an error message will appear asking for a reference field to specify the currency
Create a new field called ECURRENCY. Currency fields should already exist in the system, so the Data element here will be a pre-existing one named CURCY. Type this, press enter and the remaining fields should fill in automatically, leaving the new section of the table looking like this
     
Add New Fields to DATABASE Table in SAP ABAP


Next, the system must be told that the Salary field is referencing the Currency field. Above the table will be able to see a tab labelled ‘Currency/Quantity Fields’. Click this and the table will be shown with two boxes to be filled in for the Salary field, since it has already been specified that the domain for this field is Currency. In the ‘Reference table’ column enter the name of the table, ‘ZEMPLOYEES2’ and in the ‘Reference field’ column, the name of the new Currency Key, ‘ECURRENCY’. Now the table can be activated error free
Add New Fields to DATABASE Table in SAP ABAP

No comments:

Post a Comment