2006 Jul 21 3:28 AM
Hi all,
My question is here.
Structure A is deep structure.
Structure B is nested in Structure A.
However, a table type C is nested in Structure B.
How complex structure!
user will input the name of A from the screen.
now my code is here.
Data: lref type ref to data.
FIELD-SYMBOLS:<fs_serv> TYPE any,
<fs_logfm> TYPE any,
<fs_lt_data> TYPE ANY TABLE.
create data lref type of (input_name).
assign lref->* to <fs_serv>.
<b> ASSIGN COMPONENT 1 OF STRUCTURE <fs_serv> TO <fs_logfm>.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_logfm> TO <fs_lt_data>.</b>
I think it works, but the 'BLACK' sentences is error.
I cannot access to structure B and table C.
Could any expert to help me with this?
Thank you.
Yan
Hi all,
My question is here.
Structure A is deep structure.
Structure B is nested in Structure A.
However, a table type C is nested in Structure B.
How complex structure!
user will input the name of A from the screen.
now my code is here.
Data: lref type ref to data.
FIELD-SYMBOLS:<fs_serv> TYPE any,
<fs_logfm> TYPE any,
<fs_lt_data> TYPE ANY TABLE.
create data lref type of (input_name).
assign lref->* to <fs_serv>.
<b> ASSIGN COMPONENT 1 OF STRUCTURE <fs_serv> TO <fs_logfm>.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_logfm> TO <fs_lt_data>.</b>
I think it works, but the 'BLACK' sentences is error.
I cannot access to structure B and table C.
Could any expert to help me with this?
Thank you.
Yan
2006 Jul 21 3:33 AM
Here you go ......
I am assuming all these are tables.
DATA : T_A TYPE A
DATA : T_B TYPE B
DATA : T_C TYPE c
LOOP AT T_A.
T_B = T_A-B
* Here you can access B Contents
LOOP AT T_B.
T_C = T_B-C.
*Here you can access C contents
ENDLOOP.
ENDLOOP.Regards,
Ravi
Note : Please mark all the helpful answers
2006 Jul 21 3:50 AM
Hi Ravi,
Sorry, I cannot specific A B and C.
Because structure name A is input by user I don't know.
For example, in selection screen.
User will input 'S_Service_Time' or 'S_Service_SLD', etc.
So I have to create data A dynamicly. And then Access to nested sturcture B.
Thanks,
Yan
Message was edited by: Yan Chen
2006 Jul 21 3:53 AM
Can you show the structures in detail, or put the code here.
Regards,
Ravi
2006 Jul 21 4:24 AM
Hi Ravi,
the sample code works,
but i define the structure in DDIC, not in program
I don't know whether it is the problem.
TYPES: BEGIN OF typ_c,
name(10) TYPE c,
age(2) TYPE c,
END OF typ_c.
data lt_c type table of typ_c.
types: Begin of typ_B,
people like lt_c,
end of typ_B.
types:
begin of typ_a,
company type typ_b,
end of typ_a.
data: lref type REF TO data.
data: name(5) type c.
field-SYMBOLS:
<fs_l1> type ANY,
<fs_l2> type any,
<fs_l3> type ANY TABLE.
name = 'typ_a'.
create DATA lref type (name).
ASSIGN lref->* to <fs_l1>.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_l1> to <fs_l2>.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_l2> to <fs_l3>.
clear name.
This sample is correct. But define the type in DDIC
cause the problem.
Thanks
Yan
Message was edited by: Yan Chen
2006 Jul 21 4:39 AM
Hello Ravi,
Thank you for push
I compare the sample code with my actual code.
I found I miss lref<b>->*</b> the 'BLACK' part.
I will give you awards.
Thanks
Yan
Message was edited by: Yan Chen