cancel
Showing results for 
Search instead for 
Did you mean: 

retrieving an attribute from a table via lead-select

Former Member
0 Kudos

hi all,

i want to retrieve a particular value from a table.Here is what i hav done so far.

on the lead-select event i read the particular attribute say item_id , now i create a context node and store this item_id in it.

There is another click event wherein i am passing this value which is read b4(ie item_id) to a bapi and doin a dynamic bindin...

But the problem is as soon as i perform lead-select on my table it gives me the error "Access using a 'ZERO' object reference is not possible"

am i proceeding in the rite track?wat causes dis error..plz help me out as til nw u've been helpin..

Thanks n regards,

Urbashi

Accepted Solutions (1)

Accepted Solutions (1)

former_member182190
Active Participant
0 Kudos

Hi Urbashi,

Generally we get the error if an object type if_wd_context_node is not filled.

Please check whether the node object created in your ONlead selection action is

filled.

Have you used the method

lo_node = wd_context->get_child_node( 'NODE' ) again in your onlead selection event

handler method.

Hope this solves your problem.

Regards,

Ismail.

Former Member
0 Kudos

HI ISMAIL,

ur idea worked now it can read the value...but how can i store this value in the global memory?because now i want another bapi to take dis value as the import parameter.

regards,

Urvashi

Former Member
0 Kudos

Hi Urbashi Dewan ,

Create public attributes in the componet controller and store values in that. so that you can access these values when ever and where ever you want in this component.,

Regards

Sarath

Former Member
0 Kudos

hi urbashi.....

just as you did before....

create an attribute inside a node....

now you are having the selected value in val1.

now use this coding:

<reference->set_attribute(

name = <attribute name>

value = val1.

---regards,

alex b justin

Former Member
0 Kudos

HI SHARATH,

once i read the context-node attribute i.e item_id i call the bapi and write the code

CALL FUNCTION 'ZRFC_PD_RESULTS'

EXPORTING

I_ITEM_ID = lv_item_id

IMPORTING

E_TAB_RESULT = PD_RES_ITAB.

.

PD_RESULTS_TAB = wd_context->get_child_node( name = wd_this->wdctx_PD_RESULTS_TAB ).

PD_RESULTS_TAB->bind_table( PD_RES_ITAB ).

since i've creatd a context node and the table should display the result is binded to the context node but nothin gets displayd on the table...wat m i 2 do,Plz help

regards,

Urvashi

Former Member
0 Kudos

hi urbashi......

place a break point before the bind_table and check whether your internal table has any values....

then check the lv_item_id that you are passing...

in se37 check the function module with the same value.

---regards,

alex b justin

Former Member
0 Kudos

Hi Urbashi Dewan ,

if your PD_RES_ITAB is having values, then also table is not displaying any thing mens , binding is not hapenning.

this is because PD_RES_ITAB fields and attributes of the node you are binding are of not same type. some difference will be there. IF any slight difference between them is there means , bind table will fail. one think you can do if you are not able to change the type of attributes is loop PD_RES_ITAB and bind elem by elem.

Regards

Sarath

Former Member
0 Kudos

HI SHARATH,

YOU KNW WAT...in the lead-select i read the attribute item-id ok,then i creatd a another node of the same type item_id and now i again read this new node and used the set-attribute to trap the value in the context-controller..

now in another view i again read this new node but dat value of item-id is not present in this new atrtribute....when u run the de-bugger it shows empty..though when u run the d-buggr in the lead-select action the value is present on the new node creatd..

Former Member
0 Kudos

Hi Urbashi Dewan ,

where did you created the new node?

create the new node in the componet controller nad bibd the value to the node.. once the value is binde to the node in the component controller means, it will be available across all nodes.

Since you just required to pass only one attribute, its better to us the componet controller attriburte. create a component controller public attribue nad set value of item-id on that. then read this attribute where ever you want.

Regards

Sarath

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Urbashi..

Ur approach is right, but everytime you move to a new context node, u have to navigate to it. Try navigating to the other node and it should work.

regards,

Lloyd

former_member182190
Active Participant
0 Kudos

Hi Urbashi,

As you are using only one item_id, create a public attribute in your component controller

and fill it with the value in your event handler.

for eg: if its name is dv_item_id

then wd_comp_controller->dv_item_id = lv_item_id.

where lv_item_id is the item_id value you have.

Again when you are passing to the bapi

directly give wd_Comp_controller->dv_item_id there.

Regards,

Ismail.

former_member182190
Active Participant
0 Kudos

Hi Urbashi,

Does lv_item_id has any value before you are passing it to the FM ?

Is the table PD_RES_ITAB being filled by the FM ?

Check these 2 things...

Hope this solves your problem.

Regards,

Ismail.

former_member182190
Active Participant
0 Kudos

Hi Urbashi,

Create a public attribute in your component controller and pass the required value to it

in your event handler.

You can use the same public attribute of Component controller to pass as input to

your BAPI.

Hope this solves your problem.

Regards,

Ismail.

Former Member
0 Kudos

hi urbashi.....

just make sure that the value is getting read correctly and then passed to the bapi.

just check this link:

[link|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/2e71ce83-0b01-0010-11a4-98c28a33195f ]

---regards,

alex b justin