Ansicht
Dokumentation

ABAPASSIGN_MAIN_TABLE_FIELD - ASSIGN MAIN TABLE FIELD

ABAPASSIGN_MAIN_TABLE_FIELD - ASSIGN MAIN TABLE FIELD

General Data in Customer Master   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

ASSIGN LOCAL COPY OF MAIN TABLE FIELD

Variant 4c

ASSIGN LOCAL COPY OF MAIN TABLE FIELD (f) TO <f>.


This statement is for internal use only.
It must not be used in application programs.


Siehe No Local Copies Allowed With ASSIGN.

Effect

As with ASSIGN TABLE FIELD, this statement assigns a field to the field symbol <fs>. However, the system only looks for the field in the global data of the main program group declared using TABLES. The field symbol does not point directly to the field, but instead to a copy of this field on the value stack.
This variant ensures that you can read ABAP Dictionary fields of a different program group, but not change them.

Example

PROGRAM P1MAIN.
  TABLES TRDIR.
  MOVE 'XYZ_PROG' TO TRDIR-NAME.
  CALL FUNCTION 'EXAMPLE'.


FUNCTION-POOL FUN1.
  FUNCTION EXAMPLE.
    DATA NAME(30) VALUE 'TRDIR-NAME'.
    FIELD-SYMBOLS <FS> TYPE ANY.
    ASSIGN LOCAL COPY OF MAIN
      TABLE FIELD (NAME) TO <FS>.
    IF SY-SUBRC = 0.
      WRITE <FS>.
    ELSE.
      WRITE / 'Cannot find TRDIR-NAME'.
    ENDIF.
  ENDFUNCTION.

Output: XYZ_PROG






Fill RESBD Structure from EBP Component Structure   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 2075 Date: 20240329 Time: 060115     sap01-206 ( 22 ms )