cancel
Showing results for 
Search instead for 
Did you mean: 

structure of the context for declaring internal table

Former Member
0 Kudos

Hi,

Can we use the structure of the context for declaring the internal ?

-Sid

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Sid,

For each node <node> of a controller context, a structure type element_<node> is implicitly generated in the interface IF_<ctrl>. Similarly, for each node <node> of a controller context, a standard table of

type elements_<node> is also generated in the interface IF_<ctrl>. The line type of this table is element_<node>.

So suppose your view name is INPUT_VIEW and your context node name is NODE_VBAK then you can declare a structure as shown below:

data stru_main type if_input_view=>element_node_vbak.

Similarly you can declare an internal table as:

data lt_main type if_input_view=>elements_node_vbak.

Regards,

Uday

Answers (3)

Answers (3)

Former Member
0 Kudos

Thnx to all of u for your inputs.

-Sid

uday_gubbala2
Active Contributor
0 Kudos

Hi Sid,

You can use the above element_ & elements_ notation to define workarea & internal table similar to your context. But the disadvantage of this approach as how pointed out by Thomas in 1 of his earlier threads is that this coding would work fine only for that particular view. If you copy the same code from your view input_view and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_input_view to if_view1. So its suggested to use the below approach:

DATA: lt_main TYPE wd_this->elements_node_vbak,  " Internal table
          wa_main TYPE wd_this->element_node_vbak.  " Work area

Try go through this excellent [article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60730016-dbba-2a10-8f96-9754a865b814]. It would help you understand what all you need to know about working with the context & its attributes.

Regards,

Uday

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Yes

IF_<View_name>=>Element_<context_node_name>.

However this is possible only with in your view or with in your component.

Abhi