cancel
Showing results for 
Search instead for 
Did you mean: 

How to move a value from an object ???

gerd_hotz
Contributor
0 Kudos

Hello experts,

I've the follwoing problem:

I get a parameter where I set the focus on a cell in an alv table, but how can

I move the value to another paramerter ?

Example:

DATA: lv_cell TYPE REF TO data.

lv_cell = r_param->value.

' lv_cell has the value 1, now I should give this value to another field in order to execute a fm

move lv_cell to contact. => retunrs error

call fm.....

Any solutions ???

Thanks GD

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You need to take that from a data reference to a normal variable before it will match the parameter of your FM call. You can de-reference in this way. Let's say you need to pass this to a field with the data type S_CARR_ID.

You can cast data references just like you would object references.

DATA: lv_cell TYPE REF TO S_CARR_ID.

DATA: lv_carrid TYPE S_CARR_ID.

lv_cell ?= r_param->value.

Then you can de-reference (that is the ->*) back into a normal variable.

move lv_cell->* to lv_carrid.

gerd_hotz
Contributor
0 Kudos

Ho Thomas,

I've done it !

DATA: lv_cell TYPE REF TO BU_CONTACT.

DATA: contacti TYPE BU_CONTACT.

move lv_cell->* to contacti.

That was it !

T H A N K S

BR Gerd

Edited by: Gerd Hotz on Mar 12, 2010 3:24 PM

Answers (0)