cancel
Showing results for 
Search instead for 
Did you mean: 

problem in declaring internal table

Former Member
0 Kudos

hai experts ,

i am new to web dynpro abap .. my problem is i want to declare a internal table for a table using the web dynpro code wizard .. i found many threads regarding that .. but for mee its not working .. many of them posted that get_static_attributes_table method will solve the problem .. but i used the method in the wizard but it saying that method does not exist ..pls solve the problem ..

say where to enter the method in the wizard ..

thanks & kind regards

chinnaiya

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Chinnaiya,

If you however just intend to read your entire tables data into a local internal table then you can proceed as follows. You can make use of the GET_STATIC_ATTRIBUTES_TABLE method of IF_WD_CONTEXT_NODE to download the contents of your entire context of cardinality 1..n into an internal table of the same structure. Refer the example coding as shown below.

DATA: node_flighttab TYPE REF TO if_wd_context_node,
          lt_sflight TYPE if_resultview=>elements_node_flighttab.
 
 node_flighttab = wd_context->get_child_node( name = `NODE_FLIGHTTAB` ). " NODE_FLIGHTTAB is the node that you have bound to your table
node_flighttab->get_static_attributes_table( IMPORTING table = lt_sflight ). " Get all tables data into your internal table lt_sflight

Regards,

Uday

Answers (3)

Answers (3)

Former Member
0 Kudos

thanks you for you valuable post ..

uday_gubbala2
Active Contributor
0 Kudos

Hi Chinnaiya,

Your post isnt that clear as to what you intend to do. Do you intend to just create an internal table declaration which would be able to hold your context nodes data or do you wish to use the get_static_attributes method to fetch all your tables data into this internal table?

If you want to just declare an internal table which can hold the data then you would have to do it manually. You can't generate your internal table declaration using the code wizard. Suppose your context nodes name is SFLIGHT then you can use the below syntax to declare a table & work area respectively.

DATA: lt_sflight TYPE wd_this->elements_sflight,  " Internal table
            wa_sflight TYPE wd_this->element_sflight.  " Work area

For each node <node> of a controller context, a structure type element_<node> is implicitly generated in the interface IF_<ctrl>. The structure fields correspond to the attributes a node element consists of. Similarly for each node <node> of a controller context, a standard table type elements_<node> is implicitly generated in the interface IF_<ctrl>. The line type of this table is element_<node>. This constant can be used to

type an internal table that can hold the attributes of multiple node elements. So as how said here you can even declare the work area and internal table like shown below in your MAIN view:

DATA: lt_sflight TYPE if_main=>elements_sflight,  " internal table
           wa_sflight TYPE if_main=>element_sflight.  " work area

But the disadvantage of this approach as how pointed out by Thomas in 1 of this earlier threads is that this coding works fine only for this particular view. If you copy the same code and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_main to if_view1. So its suggested to use the earlier approach.

Regards,

Uday

Former Member
0 Kudos

The node for which you want to read the the internal table. Follow these steps,

1- click on code wizard and mention the name of ur node in read context input field and click Ok

2- It will generate a code for you which will have get_static_attribute method at the end.

3- This method will return one strucutre...so whatever values you have in work area it will return in these strucure. But in ur case i think you want the whole internal table. so the change in code is requried here.

4- change the object in this method, for structure to internal table...which would be like lo_node (which is the object reference of ur node) and change the method from get_static_attribute to get_static_attribute_table and in the importhing parameter...mention a reference varible to your context node..you can also do like this..e.g if your node is built from sflight ...then you can define

data: lt_sflight type table of sflight...

So this will contain the whole internal table...

I Hope this will solve your problem.