cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing same ITAB in different methods.

Former Member
0 Kudos

Hi All.

I am calling on function which retrieves me back two tables. One i am displaying as such.The other one i want to display based on the row selected from the first table. If i write the code in the same method (modify view) it works.

But i want to write it on "lead selection " event, so that at runtime i am able to display the contents of second table. How can i access the previous table in this method.

plz help...

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Muzammil Bichoo ,

Create an attribute of type your second itab in component controller, and make it as public. you can now access that from any method in the component.

By doing like this based on lead selection of first table you can do a rea dfrom comp_controller-> itab_second to get the values corresponding to the lead selected row.

Regards

Sarath.

Former Member
0 Kudos

Hi...

I did the same, i read that node say itz "node1" , which is actually attached to the itab.

Then i did as :

LOOP at node into wa_dir_pos.

..

..

.

But it is showing the error :

"node1 " is neither specified under "TABLES" nor is it

defined as an internal table.

I actually want to read all the rows of this "node1", until it matches with the one provided at runtime..

Former Member
0 Kudos

hi bichoo.........

you should give the cardinality as 0...n.

you cannot loop it directly....

you should read it using code wizard and store it in an internal table and then loop the internal table.

---regards,

alex b justin

Former Member
0 Kudos

HI .

When i read that context node, it is a structure . So i created another structure of the same type and stored i say "struct2".

When i write loop at srtuct2......

It gives the error

"struct2ither specified under "TABLES" nor is it defined as internal table.

Also can we use loop at with structures?

Former Member
0 Kudos

You can get the elements as table from a node. Considering:

method EXAMPLE .

data: l_node type ref to IF_WD_CONTEXT_NODE,

l_my_table type ref to IF_MY_CONTROLLER=>elements_node_1.

. . . . . . . . .

l_node = wd_context->get_child_node( wd_this->wdctx_node_1 ).

l_node->bind_table( new_items = l_my_table ).

. . . . . . . . .

endmethod.

And also of course you can't loop to a structure.

FYI.

[http://help.sap.com/saphelp_nw70/helpdata/en/46/1c09f299cb4250e10000000a1553f6/frameset.htm]

Former Member
0 Kudos

hi bichooo.........

create a node that has the same fields as that of this itab...... with cardinality 0...n.

pass the itab to this node using bind_table() method.

now you cann acces it from any where.

---regards,

alex b justin

Former Member
0 Kudos

Hi Alex...

That part i have done.Here is what i have done

I am getting the table say "itab1". Using that i am writing:

LOOP AT itab1 INTO wa_dir_pos.

if itab1-DIRECTIVE_ID = lv_directive_id.

append wa_dir_pos to itab_dir_pos_disp.

Here lv_directive contains the value of the first row.

Now i want the itab1 values in "lead selection" method..

Can u plz tell me how to do that.

Former Member
0 Kudos

hi bichoo.....

create a node in your component controller with the same fields as that of the itab1......

now drag this node from the component controller into the view's contexr.

once the value of the itab1 is filled.....

use the following coding:

<reference>->bind_table(itab1).

now in your lead selection method......

read this node....

now you get the same values.

---regards,

alex b justin