Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 1065

Re: Field symbol assignment

$
0
0

Hi AJ,

 

This way Assign ( lv_string) to <FS_ANY> , is called Dynamic Assign.

 

If you do not know the name of the field that you want to assign to the field symbol when you write a program, you can use a dynamic ASSIGN statement:

ASSIGN (dobj) TO <fs>.

This statement assigns the data object whose name is contained in the dobj field to the field symbol <fs>. You cannot use subfields in a dynamic ASSIGN.

At runtime, the system searches for the corresponding data object in the following order:

  1.  If the ASSIGN statement is in a procedure, the system searches first in its local data.

  2.  If it cannot find the object in the local data (or if the ASSIGN statement is not in a procedure), it then looks in the local data of the program.

  3.  If the field is not found in the global data of the program, the system looks in the table work areas declared with the TABLES statement in the main program of the current program group. A program group consists of a main program and all of the programs that are loaded into the same internal session as a result of other program calls.

If the search is successful and a field can be assigned to the field symbol, sy-subrc is set to 0. Otherwise, it is set to 4, and the field symbol remains unchanged. For security reasons, you should always check the value of sy-subrc after a dynamic ASSIGN to prevent the field symbol pointing to the wrong area.


Regards,


Viewing all articles
Browse latest Browse all 1065

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>