ABAPASSIGN_MAIN_TABLE_FIELD - ASSIGN MAIN TABLE FIELD
PERFORM Short Reference ABAP Short ReferenceThis documentation is copyright by SAP AG.
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 ASSIGNTABLE FIELD, this statement assigns a field to the field symbol <fs>. However, the system only looks for the field in the global data of themain programgroup 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
Addresses (Business Address Services) PERFORM Short Reference
This documentation is copyright by SAP AG.
Length: 2050 Date: 20120518 Time: 192606 triton ( 69 ms )






