on 05-17-2011 10:09 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use set_attribute method fo the context node to set the value of the attribute.
have you got the values in an internal table.
loop on this and then you can either directly fill the node by using the bind_table( ) method of the node .
or you can fill it one by one .
thanks
sarbjeet singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for reply,
No, am not taking the internal table am just taking an variable that should be assign to the node of attribute.
because pernr and ename should be automatically populated to the input field of UI element that's the reason am taling the variable.
Is that set attribute method and bind method is enough are any methods should i call???
Regards,
J.Pavan.
Hi Venkat,
Using SET_ATTRIBUTE you can set values to attributes.. for single attribute
lo_el_current->set_attribute(
name = `EMP_NAME`
value = lv_emp_name ).
If you want to set values to all attributes.. use .. // for table(list of values ) use bind_table
set all declared attributes
lo_el_new->set_static_attributes(
static_attributes = ls_new ).
node->bind_table( lt_new ).
Chers,
Kris.
Edited by: kissnas on May 17, 2011 11:52 AM
Hi Venkat
This is simple Example based on perner iam retriving name and position. and i am setting this valeus to some attributes.
Check the example code..
DATA lo_nd_input TYPE REF TO if_wd_context_node.
DATA lo_el_input TYPE REF TO if_wd_context_element.
DATA ls_input TYPE wd_this->element_input.
DATA lv_pernr TYPE wd_this->element_input-pernr.
navigate from <CONTEXT> to <INPUT> via lead selection
lo_nd_input = wd_context->get_child_node( name =
wd_this->wdctx_input ).
get element via lead selection
lo_el_input = lo_nd_input->get_element( ).
set single attribute
lo_el_input->get_attribute(
EXPORTING
name = `PERNR`
IMPORTING
value = lv_pernr ).
select single ename
into lv_ename
from pa0001
where pernr = lv_pernr.
select single plans
into lv_pos
from pa0001
where pernr = lv_pernr.
lo_el_current->set_attribute(
name = `EMP_GRP`
value = lv_ename).
lo_el_current->set_attribute(
name = `EMP_SUB_GRP`
value = lv_pos).
Cheers,
Kris.
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.
Hi Venkat,
// Read your node here.. which contains pernr and ename attributes.. and this code after that.
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.
lo_el_current->set_attribute( // instead of lo_el_current give your element name
name = `PERNR`
value = lv_pernr).
lo_el_current->set_attribute(
name = `NAME`
value = lv_name).
cheers,
Kris.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.