2008 Jan 17 12:09 PM
2008 Jan 17 12:22 PM
Move :- To assign the value of a data object <fl> to a variable < f2 >, use the following
statement:
MOVE < f1 > TO < f2 >.
or the equivalent statement
< f2 > = < f1 >.
The contents of < f1 > remain unchanged. < f1 > does not have to be a variable - it can also
be a literal, a text symbol, or a constant. You must always specify decimal points with a period
(.), regardless of the user's personal settings.
Multiple value assignments in the form
< f4 > = < f3 > = <f2 > = < f1 > .
Assign :- ASSIGN < f > TO < FS >.
When you assign the data object, the system checks whether the technical attributes of the
data object < f > correspond to any type specifications for the field symbol < FS >. The field
symbol adopts any generic attributes of < f > that are not contained in its own type
specification. Following the assignment, it points to < f > in memory.
What is the difference between Move & assign statement?
2008 Jan 17 12:12 PM
Hi,
Assign is used with field symbols to move data, whereas MOVE is used for variables.
Regards,
Pankaj
2008 Jan 17 12:13 PM
Hi,
Move c to w_var.
we r moving c into w_var.
Assign is used for field symbols
ASSIGN mem_area TO <fs> casting_spec range_spec.
Effect
This statement assigns the memory area specified using mem_area to the field symbol <fs>. You can assign a data object or a memory area calculated from the address of a data object. After the assignment, the field symbol refers to the assigned memory area and can be used in operand positions. When used in a statement, it behaves like a dereferenced data reference, meaning that the statement works with the content of the memory area.
The data type with which the assgigned memory area is treated, depends on the specifications in casting_spec . You can either execute an explicit casting or the field symbol takes on the data type of the data object specified in the assignment. A field symbol to which a memory area is assigned, has this data type after the assignment and behaves like a data object of this type.
The assigned memory area mem_area must be at least as long as the data type specified in casting_spec and must have the same alignment. If the data type determined in casting_spec is deep, the deep components with their type and position must appear in the assigned memory area exactly like this.
Use the specifications in range_spec to restrict the memory area that can be assigned to the field symbol.
Plzz reward points if it helps
2008 Jan 17 12:14 PM
In MOVE actually copies data into another data field.
while ASSIGN is used in field-symbols. and field symbols is used to reference another variable dynamically. So this field symbol will simply point to some other variable and this pointer can be changed at runtime.
(Assign is like Pointer in C)
2008 Jan 17 12:17 PM
Hi,
If f is source field and g is target field, then
MOVE f TO g.
Moves the contents of field f to field g. Field f remains unchanged.
This statement is equivalent to:
g = f.
Assign deals with field-symbols. Field-symbols are nothing but like pointers in C.
if you give ASSIGN f TO <fs>.
Then if u change the value of <fs> it will reflect in f also.
suppose lets say f = 5.
then give ASSIGN f TO <fs>.
then give <fs> = 10.
you can see the value of f changes to 10.
This is the difference between MOVE and ASSIGN.
Hope this helps you,
by-
Srinath S
2008 Jan 17 12:22 PM
Move :- To assign the value of a data object <fl> to a variable < f2 >, use the following
statement:
MOVE < f1 > TO < f2 >.
or the equivalent statement
< f2 > = < f1 >.
The contents of < f1 > remain unchanged. < f1 > does not have to be a variable - it can also
be a literal, a text symbol, or a constant. You must always specify decimal points with a period
(.), regardless of the user's personal settings.
Multiple value assignments in the form
< f4 > = < f3 > = <f2 > = < f1 > .
Assign :- ASSIGN < f > TO < FS >.
When you assign the data object, the system checks whether the technical attributes of the
data object < f > correspond to any type specifications for the field symbol < FS >. The field
symbol adopts any generic attributes of < f > that are not contained in its own type
specification. Following the assignment, it points to < f > in memory.
2008 Jan 17 12:22 PM
2008 Jan 17 12:29 PM
Hi,
MOVE:
For eg,
I_MARA is the internal table which has 1 record,
TYPES: BEGIN OF STRUCT_MARA,
MATNR TYPE MATNR,
MTART TYPE MTART,
MEINS TYPE MEINS,
END OF STRUCT_MARA.
DATA: I_MARA TYPE STANDARD TABLE OF STRUCT_MARA WITH HEADER LINE.
data: v_matnr type matnr.
(if V_MATNR is a variable of type matnr (V_MATNR TYPE MATNR)).
Then,
The data has to be moved into V_MATNR,
ie,
MOVE: I_MARA-MATNR TO V_MATNR.
Note: MOVE can be used for tranfering data between two variables of same type also.
ASSIGN:
I_MARA is the internal table which has 1 record,
TYPES: BEGIN OF STRUCT_MARA,
MATNR TYPE MATNR,
MTART TYPE MTART,
MEINS TYPE MEINS,
END OF STRUCT_MARA.
DATA: I_MARA TYPE STANDARD TABLE OF STRUCT_MARA WITH HEADER LINE.
data: <f1> type any.
(if <f1>is a field-symbol of type any (<f1> type any)).
Then,
ASSIGN I_MARA-MATNR TO <f1>.
The field-symbol <f1> will point the address of the I_MARA-MATNR
Note: ASSIGN i s only used for field-symbols and it is used by the field-symbols to point the address of a field used in ASSIGN syntax.
hope this helps.
2008 Jan 17 1:08 PM
Hi Sneha,
Move :- To assign the value of a data object <fl> to a variable < f2 >, use the following
statement:
MOVE < f1 > TO < f2 >.
or the equivalent statement
< f2 > = < f1 >.
The contents of < f1 > remain unchanged. < f1 > does not have to be a variable - it can also
be a literal, a text symbol, or a constant. You must always specify decimal points with a period
(.), regardless of the user's personal settings.
Multiple value assignments in the form
< f4 > = < f3 > = <f2 > = < f1 > .
Assign :- ASSIGN < f > TO < FS >.
When you assign the data object, the system checks whether the technical attributes of the
data object < f > correspond to any type specifications for the field symbol < FS >. The field
symbol adopts any generic attributes of < f > that are not contained in its own type
specification. Following the assignment, it points to < f > in memory.
Hope this helps ...
Reward if useful
Cheers
Kripa Rangachari..
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |