Skip to Content
0
Former Member
Feb 17, 2011 at 08:07 PM

How to identify a data reference

50 Views

Hi,

Probably a very simple question, but i was not able to find the answer (yet). Hopefully you can help me.

I have a data reference, which is a TYPE REF TO data

In some cases the reference can point to a table and in the other cases it points to a structure.

Now i want to know how i can identify the DATA reference if it is a table or structure?

Regards,

/Peter

In the expample below, how to i know LR_DATATAB is refering to a table and LR_DATASTRUC is refering to a structure?

====example===

REPORT zpval_test01.

TYPES ty_t_t001 TYPE STANDARD TABLE OF t001.

DATA lt_t001 TYPE STANDARD TABLE OF t001.

DATA ls_t001 LIKE LINE OF lt_t001.

DATA lr_datatab TYPE REF TO data.

DATA lr_datastruc TYPE REF TO data.

START-OF-SELECTION.

SELECT *

FROM t001

INTO TABLE lt_t001.

READ TABLE lt_t001 INTO ls_t001

INDEX 1.

CREATE DATA lr_datatab TYPE ty_t_t001.

GET REFERENCE OF lt_t001 INTO lr_datatab.

CREATE DATA lr_datastruc TYPE t001.

GET REFERENCE OF ls_t001 INTO lr_datastruc.