Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

what we can do with REF type

Former Member
0 Likes
910

DATA g_ref TYPE REF TO char10.

CREATE DATA g_ref.

Now we can write like:

g_ref->* = 'xyz'.

But how we can do with 'g_ref'?

Is there anythin like p++ in C?

DATA g_ref TYPE REF TO char10.

CREATE DATA g_ref.

Now we can write like:

g_ref->* = 'xyz'.

But how we can do with 'g_ref'?

Is there anythin like p++ in C?

4 REPLIES 4
Read only

Former Member
0 Likes
891

For example, if I want to loop internal table

how can I use type ref to to replace LOOP it_tab ASSIGNING <fs>?

Read only

Former Member
0 Likes
891

This message was moderated.

Read only

0 Likes
891

Hi, thank you for the reply.

REF type is a little bit diff from pointer.

I only know dereference it by g_ref->*, but  how can I use g_ref itself?

Read only

0 Likes
891

Hi Ming,

As far as I know,

Reference variables are initial when you declare them. They do not point to an object. You cannot dereference an initial reference variable. A data reference variable can point to a data object if you

·  Use it to create a data object dynamically.

·  Use it to get a reference to a data object.

·  Assign an existing data reference to it from another data reference variable.

For more details pls check.

http://help.sap.com/saphelp_nw70/helpdata/en/9a/871ad40c6c11d3b9350000e8353423/content.htm