Ansicht
Dokumentation

ABAPASSIGN_MAIN_TABLE_FIELD - ASSIGN MAIN TABLE FIELD

ABAPASSIGN_MAIN_TABLE_FIELD - ASSIGN MAIN TABLE FIELD

BAL_S_LOG - Application Log: Log header data   CL_GUI_FRONTEND_SERVICES - Frontend Services  
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






PERFORM Short Reference   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 2075 Date: 20240616 Time: 121812     sap01-206 ( 27 ms )