19.2.11

SAP Note 22640 - ABAP/4 query: Add. structures in logical databases

Symptom:

Question: How can structures which are connected to logical databases as an extension be used by ABAP/4 query?
Some logical databases use structures as an extension of the tables in the tree. With every read entry of the table, the database program sets up additional information for this entry in the structure.
Example: The logical database DDF contains the table BSEG with the fields BSEG-DMBTR (amount in local currency) and BSEG-SHKZG (debit indicator/credit indicator). To this table, an additional structure, BSEGA exists, in which the fields BSEGA-DMSOL (debit amount in local currency) and BSEGA-DMHAB (credit amount in local currency) are contained. The database program puts the additional information in this structure for each read entry of the table BSEG. The contents of the fields BSEGA-DMSOL and BSEGA-DMHAB are calculated from the fields BSEG-DMBTR and BSEG-SHKZG.
BSEG and BSEGA are both defined in the Dictionary. However, only BSEG exists as a table in the database. If you want to access the fields in a report via the logical database DDF from BSEGA, the statement TABLES BSEGA must be entered in the report. When GET BSEG is executed, the field string BSEGA then is supplied by the database program with the correct values.
The problem when using fields of this type in functional areas of the ABAP/4 query, are that the additional structures of the logical database can not simply be connected as additional tables in the functional area, as additional tables must be accessible to read with SELECT. The specification of the values has already succeeded via the database program.

Solution
An access to the fields of the additional structures can only be implemented for the definition of a functional area with additional fields. The statement TABLES structure must be entered first in the DATA program code of the functional area. An additional field which receives its value from a simple MOVE statement from the corresponding field of the structure must then be defined for every field in this structure which is to be included in the functional area.
Example: The field BSEGA-DMSOL should be included in a functional area via a functional area of the logical database DDF. As explained above, this is not directly possible. Therefore, the statement TABLES BSEGA is stored in DATA program code of the functional area. An additional field is then defined with the name DMSOL when GET BSEG is executed. The type of the additional field can be specified in the field BSEGA-DMSOL with LIKE. The program code for the additional field is DMSOL = BSEGA-DMSOL.
The additional field can be included afterwards in the functional area, and it makes the field BSEGA-DMSOL accessible to query lists.

1 comment:

  1. thanks for given information i followed your instruction
    training on sap oss note view here

    ReplyDelete