SAP structures, tables and internal tables

  • A structure is just a definition containing a list of fields under a name and does not contain any data within the SAP data dictionary. Although there is not data you can still view the definition within SE11 as you would a table.
  • A table is also a definition of fields within the data dictionary but unlike a structure it also has an actual underlying database table created in the database which holds data. This data can be added too or read using the appropriate ABAP commands.
  • Within an ABAP program you can create a local data type based on a structure, much the same as you can based on an table i.e. ld_test type SAP_STRUCTURE, ld_test type SAP_TABLE. This will then create a temporary work area(single line of data) based on the definition of that structure i.e. the list of fields which make up that structure definition which may or may not link directly back to one or more tables.
  • An internal table is also a temporary storage area created during runtime in your ABAP code , but instead of a single line of data it allows multiple lines of data to be added. This is defined using similar code to . it_test type standard table of SAP_STRUCTURE or it_test type standard table of SAP_TABLE
  • There is no direct link between tables and structures. If your screen field is based on a structure filed rather than the actual table the only thing you can do is perform a where used on the field(data element) and look at the various tables it is used in! You could also look at that ABAP code to see where the date gets passed too or use the SQL trace transaction ST05 to see which tables are being accessed.
  • Structures are useful for bringing data from multiple tables together. I.e. you can create a structure that contains all the fields you require for your report or transaction irrespective of which table they are in. You can then create an internal table or work area from it and use ABAP code to populate it from the various database tables.

Leave a Comment

Your email address will not be published. Required fields are marked *