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

Questions about types

Former Member
0 Likes
980

May be it is a bit silly,

but i want like to ask whether I can create self reference type

other than using objects

TYPES: BEGIN OF sub_struc,

col1 TYPE c LENGTH 10,

col2 TYPE c LENGTH 10,

col3 TYPE sub_struc,

END OF sub_struc.

Thanks in advance

Edited by: David Tai on Jul 2, 2009 5:36 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
948

Hi

This is allowed in ABAP .

Hi

This is allowed in ABAP .

7 REPLIES 7
Read only

Former Member
0 Likes
949

Hi

This is allowed in ABAP .

Read only

0 Likes
948

Thx first, Martina

But may i know the actual coding.

for the above sample code,

TYPES: BEGIN OF sub_struc,

col1 TYPE c LENGTH 10,

col2 TYPE c LENGTH 10,

col3 TYPE sub_struc,

END OF sub_struc.

i will get a error on col3 said type is unknown

Thx

Read only

0 Likes
948

Hi

I jus copied the same code . Its not showing any error for me .

Can you send the code and error msg as it is in the report ?

Read only

0 Likes
948

Thanks. It works.

Originally my code is

TYPES: BEGIN OF TY_ORG_UNIT,

OBJID TYPE HROBJID,

SUB_ORG TYPE TY_ORG_UNIT,

END OF TY_ORG_UNIT.

But once, i change the name TY_ORG_UNIT to ORG_UNIT, it pass the check

So i still don't know why is failed when the name is TY_ORG_UNIT

and i also try to change the name to ORGUNIT , it also failed...

Edited by: David Tai on Jul 2, 2009 6:14 AM

Read only

0 Likes
948

Hi David,

I checked the code what you have given it will not give any syntax error in ECC6.0 but if you use the same in the ECC5 then the syntax error occurs as you said TYPE SUB_STRUC unknown , so i think this is implemented in ECC6.0 but not in the older version of SAP.

when you are changing the code of the report program structure to org_unit it is a dictiionary type which is allowed but when you change it to the structure which is not declared completely it is not working in ECC5 just try to check in dictionary whether the type org_unit is existing or not?

Regards

Sarves

Read only

0 Likes
948

Hi David

Actually if u give org_unit in se12 in dataelement u can see its there .But ty_org_unit is not a data element / table or its nothing in sap. So it shows error .

Whereas both org_unit (data elemnt ) and sub_struc (structure) are componenets of data dictionary .

hope u get my point

Read only

0 Likes
948

Really thanks both of you !

I got it. Thanks for your explanations