on 09-15-2006 3:27 PM
hi all,
I have to populate a model node and execute the RFC so that its updated at the backend and the nodes are once again refreshed.
<b>It_Prcgprdg()</b> is the model to which i have to add the record which should be added in the backend and the outputnode should be refreshed.
here's my code.
IPrivatePriProdGrpView.IIt_PrcgprdgElement prod = wdContext.createIt_PrcgprdgElement(new Zsd_Pmt_S_Prcgprdg());
wdContext.nodeIt_Prcgprdg().validate();
prod.setZprigrp(wdContext.nodeEt_Pricegrp_out().getEt_Pricegrp_outElementAt(lead1).getZprigrp());
int Size = wdContext.nodeEt_Prodgrp_out().size();
for( int i = 0; i< Size;i++)
{
int lead = wdContext.nodeEt_Prodgrp_out().getLeadSelection();
if(wdContext.nodeEt_Prodgrp_out().isMultiSelected(i) || lead == i )
{
prod.setZchngusr(Username);
prod.setZprodgrp(wdContext.nodeEt_Prodgrp_out().getEt_Prodgrp_outElementAt(lead).getZprodgrp());
wdContext.nodeIt_Prcgprdg().addElement(prod);
}
wdThis.wdGetPricingGrpCompController().execute_RFC();
Please correct if my code is wrong.
Thanks in advance,
Gopi
Gopi,
Instead of creating new elements and adding them to the node, create suitable structural instances and add them to the suitable modelObject. For that, you may modify your code like this.
Zsd_pmt_price_input priceInput = new Zsd_pmt_price_input();
wdContext.nodeZsd_pmt_price_input().bind(priceInput);
int outSize = wdContext.nodeEt_Prodgrp_out().size();
for( int j = 0; j< outSize ;j++)
{
if(wdContext.nodeEt_Prodgrp_out().isMultiSelected(j) ||
lead == j )
{
/** Find out what is Struct by using the steps
mentioned below */
Struct x = new Struct();
x.setZprigrp(wdContext.nodeEt_Pricegrp_out()
.getEt_Pricegrp_outElementAt(lead1).getZprigrp());
x.setZchngusr(Username);
x.setZprodgrp(wdContext.nodeEt_Prodgrp_out()
.getEt_Prodgrp_outElementAt(lead).getZprodgrp());
priceInput.addIt_Prcgprdg(x);
}
}
wdContext.nodeZsd_pmt_price_input().modelObject().execute();
wdContext.nodeOutput().invalidate();
Steps to find out the structure associated with the node It_Prcgprdg:
1) Go to the context tab of the view/CC whereever you have this node It_Prcgprdg.
2) Right Click the node It_Prcgprdg and select properties.
3) Look for a property called "Structure" and note down the value of this property. (Say, Struct)
Bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi bala,
<b>Zsd_Pmt_Pricegrp_Rfc_Input input1 = new Zsd_Pmt_Pricegrp_Rfc_Input();
wdContext.nodeZsd_Pmt_Pricegrp_Rfc_Input().bind(input1);
int lead1 = wdContext.nodeEt_Pricegrp_out().getLeadSelection();
int outSize = wdContext.nodeEt_Prodgrp_out().size();
for( int i = 0; i< outSize;i++)
{
int lead = wdContext.nodeEt_Prodgrp_out().getLeadSelection();
if(wdContext.nodeEt_Prodgrp_out().isMultiSelected(i) || lead == i )
{
//Zsd_Pmt_S_Prcgprdg prod is the struc of It_Prcgprdg
Zsd_Pmt_S_Prcgprdg prod = new Zsd_Pmt_S_Prcgprdg();
prod.setZchngusr(Username);
prod.setZprigrp(wdContext.nodeEt_Pricegrp_out().getEt_Pricegrp_outElementAt(lead1).getZprigrp());
prod.setZprodgrp(wdContext.nodeEt_Prodgrp_out().getEt_Prodgrp_outElementAt(lead).getZprodgrp());
input1.addIt_Prcgprdg(prod);
}
}
wdContext.currentZsd_Pmt_Pricegrp_Rfc_InputElement().setIv_Zoperation("P");
wdThis.wdGetPricingGrpCompController().execute_RFC();</b>
I have written the above code in the <b>onActionAddProduct</b> method of the iview. I need to add the products to backedn when user clicks the buttonADD.
<b>Zsd_Pmt_Pricegrp_Rfc_Input input1 = new Zsd_Pmt_Pricegrp_Rfc_Input();
wdContext.nodeZsd_Pmt_Pricegrp_Rfc_Input().bind(input1);
<b>Zsd_Pmt_Pricegrp_Rfc_Input input1 = new Zsd_Pmt_Pricegrp_Rfc_Input();
wdContext.nodeZsd_Pmt_Pricegrp_Rfc_Input().bind(input1);
<b>Zsd_Pmt_Pricegrp_Rfc_Input</b> node i have already initialized in compcontroller as
Zsd_Pmt_Pricegrp_Rfc_Input inpri = new Zsd_Pmt_Pricegrp_Rfc_Input();
wdContext.nodeZsd_Pmt_Pricegrp_Rfc_Input().bind(inpri);
Still i am unable to update the data. Do i need to write the code in compcontroller only?
<b>Iv_Zoperation</b> is the import parameter in RFC. i need to send this as "P".
Please suggest me.
gopi
Message was edited by: gopi nidjelli
hi Subramanian,
If i remove the below code from CC i am getting null pointer exception.
<b>Zsd_Pmt_Pricegrp_Rfc_Input inpri = new Zsd_Pmt_Pricegrp_Rfc_Input();
wdContext.nodeZsd_Pmt_Pricegrp_Rfc_Input().bind(inpri);</b>
when i run the application for the first time i need output nodes values to fill up and when i select the record from the displayed list it should add to another table.
how can we get the instance <b>inpri</b> in the view so that i can set the data to that element.
Thanks in advance,
Gopi
<i>Q: Still i am unable to update the data. Do i need to write the code in compcontroller only?</i>
1. No not necessary. You may do it from the view as well.
2. Add a debug code to the "for" loop and check if the control actually enters the loop.
3. From what you are trying to acheive, I guess your code in the for loop for setting Zprodgrp should be
prod.setZprodgrp(wdContext.nodeEt_Prodgrp_out().
getEt_Prodgrp_outElementAt(<b>i</b>).getZprodgrp());
Bala
hi Bala,
I am getting the Et_Prodgrp_out as Zero before the For loop begins. this is because I am creating the instance of the node.
i,e
Zsd_Pmt_Pricegrp_Rfc_Input input1 = new Zsd_Pmt_Pricegrp_Rfc_Input();
// wdContext.nodeZsd_Pmt_Pricegrp_Rfc_Input().bind(input1);
if i do not put this code then iam getting the size of the node.
with out creating the instance how can we add ?
Thanks in advance,
Gopi
Remove
Zsd_pmt_price_input priceInput = new Zsd_pmt_price_input();
wdContext.nodeZsd_pmt_price_input().bind(priceInput);
and use
int outSize = wdContext.nodeEt_Prodgrp_out().size();
for( int j = 0; j< outSize ;j++)
{
if(wdContext.nodeEt_Prodgrp_out().isMultiSelected(j) ||
lead == j )
{
/** Find out what is Struct by using the steps
mentioned below */
Struct x = new Struct();
x.setZprigrp(wdContext.nodeEt_Pricegrp_out()
.getEt_Pricegrp_outElementAt(lead1).getZprigrp());
x.setZchngusr(Username);
x.setZprodgrp(wdContext.nodeEt_Prodgrp_out()
.getEt_Prodgrp_outElementAt(i).getZprodgrp());
<b><i>wdContext.currentZsd_Pmt_Pricegrp_Rfc_InputElement().
modelObject().addIt_Prcgprdg(x);</i></b>
}
}
wdContext.currentZsd_Pmt_Pricegrp_Rfc_InputElement().
modelObject().setIv_Zoperation("P");
wdThis.wdGetPricingGrpCompController().execute_RFC();
Bala
hi bala,
Context Structure
zsd_pmt_price_input
Et_Pricegrp Et_Prodgrp It_Prcgprdg Output |
Et_Pricegrp_out
Et_Prodgrp_out
It_Prcgprdg_out
Intially i am executing the RFC and displaying the Et_Pricegrp_out
Et_Prodgrp_out
nodes data in tables.
I am populating It_Prcgprdg node with the data and once again executing the RFC.
But the data is not reflected in the backend.
Thanks in advance,
gopi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Try this
call the execute method first
wdThis.wdGetPricingGrpCompController().execute_RFC();
wdContext.nodeIt_Prcgprdg().invalidate();
int Size = wdContext.nodeEt_Prodgrp_out().size();
for( int i = 0; i< Size;i++)
{
int lead = wdContext.nodeEt_Prodgrp_out().getLeadSelection();
prod.setZchngusr(Username);
prod.setZprodgrp(wdContext.nodeEt_Prodgrp_out().getEt_Prodgrp_outElementAt(lead).getZprodgrp());
prod.setZprigrp(wdContext.nodeEt_Pricegrp_out().getEt_Pricegrp_outElementAt(lead1).getZprigrp());
wdContext.nodeIt_Prcgprdg().addElement(prod);
}
see this thread
/message/2187817#2187817 [original link is broken]
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Post the context structure (including the attributes) of your RFC. Then it becomes easy for us to help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
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.