07-14-2017 10:01 AM
does ABAP allow linked lists,
with forward declaration of typed pointers?
I tried like so:
>>
types: begin of t_elem1,
kunnr type kunnr,
next type ref to t_elem1,
end of t_elem1.
<<
This gives Syntax Error: Type "T_ELEM1" is unknown
(at the penultimate line: "next type ref to t_elem1")
I guess it's a circular logic within this structure,
(which however worked in Pascal/C/Java, IIRC)
So I tried a logic like shown there:
https://archive.sap.com/discussions/thread/1512042
>>
types: begin of t_elem1,
kunnr type kunnr,
next type ref to data,
end of t_elem1.
<<
disadvantage e.g. field "next" is not "upfront type-compatible" 😉
("full" Syntax-Checks won't be there, auto-filler in se80 missing, etc.)
Now, I got that idea:
with Unit-Testing "definition deferred" can be used
to solve a circular logic of classes referring to one another;
as discussed there:
https://archive.sap.com/discussions/thread/1458598
Is there some "forward typing" or "type deferred" thing, to get this going
with structures (like this), too?
types: begin of t_elem1,
kunnr type kunnr,
next type ref to t_elem1,
end of t_elem1.
AHGA
07-14-2017 11:12 AM