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

Declaring deep structures in OOP

Former Member
0 Likes
1,323

Hello experts,

I would like to ask for your help in solving a problem, i'm currently stuck at this and can't proceed with the requirement.

I would like to declare a deep structure in a table and was able to come up with this in procedural programming:

****************************************************

tables: zsd_output_net.

data: begin of t_table_structure occurs 0.

include structure zsd_output_net.

data end of t_table_structure.

types: begin of t_output_all,

bukrs type anla-bukrs,

out_table like t_table_structure occurs 0,

end of t_output_all.

data: gt_output_all type standard table of t_output_all with header line,

wa_out_table like line of t_table_structure.

**************************************************

This worked and I was able to append entries to table out_table. However, I'm having trouble translating this to OOP since OOP does not support declaration with "OCCURS".

Here's what I came up in OOP:

**************************************************

data: begin of t_table_structure.

include structure zsd_output_net.

data end of t_table_structure.

types: begin of t_inner_table,

in_table like t_table_structure,

end of t_inner_table.

types: begin of t_output_all,

bukrs type anla-bukrs,

out_table type t_inner_table initial size 1,

end of t_output_all.

data: gt_output_all type standard table of t_output_all,

wa_output_all type t_output_all,

gt_inner_table type standard table of t_inner_table,

wa_inner_table type t_inner_table,

wa_out_table like t_table_structure.

**************************************************************

This did not work because out_table just became a structure and not a table in a table. What should I do so that I would get the same effect as with structural programming?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
765

what I came up in OOP:

**************************************************

data: begin of t_table_structure.

include structure zsd_output_net.

data end of t_table_structure.

types: begin of t_inner_table,

in_table like t_table_structure,

end of t_inner_table.

data :gt_inner_table type standard table of t_inner_table,

wa_inner_table type t_inner_table.

types: begin of t_output_all,

bukrs type anla-bukrs,

out_table type gt_inner_table ,

end of t_output_all.

data: gt_output_all type standard table of t_output_all,

wa_output_all type t_output_all,

wa_out_table like t_table_structure.

2 REPLIES 2
Read only

Former Member
0 Likes
766

what I came up in OOP:

**************************************************

data: begin of t_table_structure.

include structure zsd_output_net.

data end of t_table_structure.

types: begin of t_inner_table,

in_table like t_table_structure,

end of t_inner_table.

data :gt_inner_table type standard table of t_inner_table,

wa_inner_table type t_inner_table.

types: begin of t_output_all,

bukrs type anla-bukrs,

out_table type gt_inner_table ,

end of t_output_all.

data: gt_output_all type standard table of t_output_all,

wa_output_all type t_output_all,

wa_out_table like t_table_structure.

Read only

Former Member
0 Likes
765

You nailed it PBS! Thanks a lot 😃