Ansicht
Dokumentation

DDIF_TABL_PUT - DD: Interface to write a table in the ABAP Dictionary

DDIF_TABL_PUT - DD: Interface to write a table in the ABAP Dictionary

CPI1466 during Backup   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This function module writes the sources of a table to ABAP Dictionary. The new or revised version of the tables is written. If there is an active version of the table, it is not affected.

Before the table is written, there is first a check whether the action is allowed for the specific object. If this is not the case, for example because the name chosen violates the naming convention or because the object collides with the name of another ABAP Dictionary object, the exception PUT_REFUSED is raised. In this case the system variables contain a message which describes the reason why the action was rejected.

If only certain parts (e.g. the fields) of the table are changed, only the corresponding parameters of the function module should be defined. For the IMPORT parameters (DD02V_WA, DD09L_WA),"defined" means that a value other than SPACE is passed in field TABNAME. For TABLES parameters (DD03P_TAB, DD05M_TAB, DD08V_TAB, DD35V_TAB, DD36M_TAB), "defined" means that they are not specified at all in the call.
Caution: A TABLES parameter is considered to be defined if it is passed a table without rows. In this case the effect is completely different to that for not defining this parameter in the call.

The following constellations (or combinations) are possible:

  1. The table should be completely revised or redefined:
    In this case all the parameters should be defined. If it is a structure, the technical settings (DD09L_WA) should not be defined.
  2. The header should be changed:
    In this case you must define DD02V_WA. If DD02V_WA is not defined and the table is not yet in ABAP Dictionary, the exception TABL_NOT_FOUND is raised.
  3. The fields should be changed:
    In this case you must define DD03P_TAB. The fields must be stored in the order defined by POSITION. If a POSITION entry occurs more than once, the exception TABL_INCONSISTENT is raised. Only positive entries are allowed in POSITION.
    You should note that changes can be made to the foreign keys of the table when the fields are written. This occurs if the entry of CHECKTABLE is changed for a field. Therefore, if you do not ensure that no changes are made to field CHECKTABLE, the foreign key of the table should also be written again (see 4.). In the same way, changes can occur in the search help assignments of the table when the fields are written, namely if the entry for SHLPORIGIN is changed for a field (see 5.).
    If DD03P_TAB is defined but empty, and no active append structures can be found for the table, the exception TABL_INCONSISTENT is raised.
  4. Foreign keys should be changed:
    In this case, DD08V_TAB (foreign key header) and DD05M_TAB (foreign key fields) must be defined. If only one of these parameters is defined, the exception TABL_INCONSISTENT is raised.
    The following must be specified:
    1. All the foreign keys with check fields which lie directly in the table.
    2. Foreign keys which should not be copied automatically from an included structure. These must be indicated by assigning the field NOINHERIT the value 'Y'. There are two cases here: (i) An included field should not be the check field, not even if the field is the check field in the included structure. In this case the field CHECKTABLE must get the value '*' in the DD08V_TAB. (ii) An included field should be the check field of a certain foreign key dependency, even if the foreign key definition for this field is another one in the included structure. In this case CHECKTABLE must get the correct value.
    3. Foreign keys whose field assignment should be automatically copied from an included substructure but whose other attributes (text, appearance on the screen, semantic attributes) depend on the specific table. These must be identified by assigning the field NOINHERIT the value 'N'.
      In cases a) and b)(ii), the foreign key fields for this foreign key must still be passed to DD05M_TAB.
      A foreign key dependency is automatically appended to included fields which are the check field of a foreign key dependency in the included structure and for which no entry is passed according to b) or c). Its field assignment is copied from the foreign key dependency of the included structure. The remaining attributes are copied from an active version of the table itself if there is one (if the field is also a check field there). Only if this is not possible will these attributes be copied from the foreign key definition for the included table.
  5. The search help assignments of the table are to be changed:
    In this case, DD35V_TAB (search help assignment header) and DD36M_TAB (search help assignment parameter allocations) must be defined. If only one of these parameters is defined, the exception TABL_INCONSISTENT is raised.
  6. The technical settings of the table should be changed:
    Parameter DD09L_WA should be defined.

Example

Transparent table TEST is in an active state in ABAP Dictionary. Its only field is key field F1, which refers to data element CHAR1. Data field F2 with data element CHAR2 should now be added to the table. The following code is used here:

DATA DD03P_TAB LIKE DD03P OCCURS 2 WITH HEADER LINE.
DD03P_TAB-TABNAME = 'TEST'. DD03P_TAB-FIELDNAME = 'F1'.
DD03P_TAB-POSITION = '1'. DD03P_TAB-KEYFLAG = 'X'.
DD03P_TAB-ROLLNAME = 'CHAR1'. APPEND DD03P_TAB.
DD03P_TAB-TABNAME = 'TEST'. DD03P_TAB-FIELDNAME = 'F2'.
DD03P_TAB-POSITION = '2'. DD03P_TAB-KEYFLAG = ' '.
DD03P_TAB-ROLLNAME = 'CHAR2'. APPEND DD03P_TAB.
COMMIT WORK.
CALL FUNCTION 'DDIF_TABL_PUT'
EXPORTING
NAME = 'TEST'
TABLES
DD03P_TAB = DD03P_TAB
EXCEPTIONS
PUT_FAILURE = 01
OTHERS = 02.
IF SY-SUBRC = 1.
ROLLBACK WORK.
ENDIF.
IF SY-SUBRC = 0.
COMMIT WORK.
WRITE / 'Table TEST is now revised with two fields.'.
WRITE / 'The active version is unchanged.'.
ELSE.
WRITE / 'Table TEST is still active in the old state.'.
ENDIF.

Notes

1. This function module does not perform any authorization check and does not write any correction entry.

2. If the write operation fails, the exception PUT_FAILURE is activated. In this case, part of the sources might already be written. A ROLLBACK should therefore be performed at a suitable time.

3. The module does not perform any COMMITs or ROLLBACKs. After writing, the caller should therefore perform a COMMIT.

  1. If a parameter is defined but has a value other than NAME in a line in field TABNAME, the exception NAME_INCONSISTENT is raised.
  2. If DD05M_TAB and DD08V_TAB are defined, the following cases result in the exception TABL_INCONSISTENT:
    1. Foreign key fields without foreign key header
    2. DD08V_TAB-NOINHERIT NA 'YN' for check fields which are included
    3. Check table in the foreign key field is defined other than in the corresponding foreign key header
  3. If foreign keys, but no fields, are to be written, this results in the latest fields of the table being read internally and possibly having to be written again with different CHECKTABLE entries. Therefore if the caller knows the correct values for the fields and if the check table really changed for at least one field, the performance will be better if you also define DD03P_TAB.
  4. This module does not support the writing of table indexes. In that case you can use the function module DDIF_INDX_PUT.
  5. The revised (or new) version of the table to be written can be activated by calling the function module DDIF_TABL_ACTIVATE.
  6. The specification described above for handling foreign keys of included fields might be changed. Refer to the ABAP Dictionary group if you have questions on this topic.
  7. If components typed with reference to a built-in dictionary type (DD03P_TAB-COMPTYPE = 'R') are passed in table DD03P_TAB, the field D03P_TAB-REFTYPE must be filled with 'B' (built-in type). In this case, you can also specify a text (DD03P_TAB-DDTEXT) for the component.

Further information





Parameters

DD02V_WA
DD03P_TAB
DD05M_TAB
DD08V_TAB
DD09L_WA
DD35V_TAB
DD36M_TAB
NAME
SAVE_ABAP_LANGUAGE_VERSION

Exceptions

NAME_INCONSISTENT
PUT_FAILURE
PUT_REFUSED
TABL_INCONSISTENT
TABL_NOT_FOUND

Function Group

SDIF

CL_GUI_FRONTEND_SERVICES - Frontend Services   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 9498 Date: 20240523 Time: 120004     sap01-206 ( 149 ms )