Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to assign a value to Component controller node

Hi Experts,

Suppose, I'm getting the pernr & ename from pa0001 by using select statement...... and now

What my question is how to assign the values of pernr & ename to the component nodes of attribute..

Please, give me the details...

Regards,

J.Pavan.

Former Member
replied

suppose you have created a node PA_ND1 in the compcontroller

which has these two fields

map the node to one node in the view also

where you want to fill the attributes.

then

write the code like below for the requirement.

data nd type ref to if_wd_context_node.
nd = wd_context->get_child_node( 'PA_ND1' ).
data ls_pa_nd1 type wd_this->element_pa_nd1.


select *  from pa0001 into CORRESPONDING FIELDS OF ls_pa_nd1 where  pernr = '00000003'.
endselect.
nd->bind_structure( ls_pa_nd1 ).

and for this

Hi sarbjeet singh,

I'm using the following code to get the pernr & ename
now i want to assign the pernr & ename in my node of attribute * l_pernr & l_ename. *
now you tell me what to do???

DATA: gv_pernr TYPE persno,
gv_ename type EMNAM,
lt_ee_tab TYPE TABLE OF pernr_us,
ls_ee_tab TYPE pernr_us.

SELECT SINGLE pernr FROM pa0105 INTO gv_pernr
WHERE usrty EQ '0001' AND
usrid EQ sy-uname AND
begda LE sy-datum AND
endda GE sy-datum.

select single ename from pa0001 into gv_ename
WHERE pernr EQ gv_pernr AND
begda LE sy-datum AND
endda GE sy-datum.

Regards,
J.Pavan.

data nd type ref to if_wd_context_node.
nd = wd_context->get_child_node( 'PA_ND1' ).

nd->set_attribute(
name = 'l_pernr '
value =  gv_pernr

)
nd->set_attribute(
name = ' l_ename'
value = gv_ename

)

thanks

sarbjeet singh

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question