Skip to Content
Nov 08, 2015 at 05:16 PM

Use of "ASSIGN"


Dear all

not being an "ABAPer but referring to this thread.

Here discussion was regarding the use of ASSIGN like:

assign (gv_likp_lfart) to <fs_lfart>.

Here I would like to understand better the ABAP "internal" handling. According to "ABAP Reference" and to my understanding:

You can use Assign (X) to fieldsymbol to assign the "memory" of e.g. to a field symbol. The X can be a "SAP Routine/INCLUDE etc".

Using then ABAp you can manipulate the field symbol content. One use seems to be to make data available in subroutines/functions etc.

But should you not do then somethere an "Unassign" of the memory (with link to fieldsymbol) not to "block" memory in SAP?

Or is the "Unassign" somehow done by the ABAP environment somethere "implicit" (so you need not to du an "UNASSIGN" explicit?)

A "nearly" similar document is here:

Accessing to the stack memory - Code Gallery - SCN Wiki

I found as well: ASSIGN – Life made easy.

This document exactly reflect to my quesiotn:

In this document an example is provided like:

ASSIGN ('(SAPMF05A) POSTTAB[])') to <fs_postab>.

Or more preciscly:

Assign (program_name) to <fs>.

This will assign the starting memory address of the complete program ABAP memory to the field symbol.

If you have used this statement: Is there the need to use "UNASSIGN" later for <fs> or is this done by ABAP internally?

In the discussion of the document comment like:

"As an alternative, if you are on SAP release > ECC6.0, you can make use of an implicit enhancement to export the value of the required global data. This IMHO is a more cleaner approach."

comes up

So is ths now the Best practise in SAP? If I read cross all the discussion: the "assign" is not the best option to solve the demand