Problem solve Get help with specific problems with your technologies, process and projects.

How to use ASSIGN LOCAL COPY OF MAIN TABLE FIELD

Using syntax ASSIGN LOCAL COPY OF MAIN TABLE FIELD you can refer to the value of TABLE FIELDS defined in calling programs.

Using the syntax ASSIGN LOCAL COPY OF MAIN TABLE FIELD you can refer to the value of TABLE FIELDS defined in calling...

programs.


REPORT ZZ_TEST_ASSIGN.
TABLES:TRDIR.
START-OF-SELECTION.
TRDIR-NAME = 'ZZ_AANROEP'.
CALL FUNCTION 'Z_TEST_ASSIGN'.

FUNCTION-POOL ZTEST.                   
tables: trdir.

FUNCTION z_test_assign.
*"----------------------------------------------------------------------
*"*"Local interface:
*"----------------------------------------------------------------------


  DATA: tp_fieldname(30) TYPE c.


  FIELD-SYMBOLS: 
 
   TYPE ANY.
* This TRDIR entry refers to global TABLES from function-pool ZTEST.
  trdir-name = 'ZZ_TEST'.

  tp_fieldname = 'TRDIR-NAME'.
* This ASSIGN refers to value from the main / calling PROGRAM!!
  ASSIGN LOCAL COPY OF MAIN TABLE FIELD tp_fieldname) TO 
  
   .
  IF sy-subrc = 0.
* 
   
    contains value 'ZZ_AANROEP'
    WRITE 
    
     . 
  ELSE.
    WRITE: 'Error in dynamic ASSIGN statement for', tp_fieldname.
  ENDIF.

    
   
  
 
This was last published in October 2001

Dig Deeper on SAP ABAP

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close