on 08-25-2005 7:00 AM
hi,
I am facing a problem in passing import values to a 2nd BAPI which is actually supplied to me from the export values of my 1st BAPI.
The 1st BAPI is used to retrieve present data from the R/3 server. Say i have 3 values returned in the from of rows, now in case i manipulate these values and want to submit it(to store in R/3) how do i go abt doing this?
thanks
Hi Srikant,
No Offence intended, but as Bharat pointed out, it would be better if you go through some atricles or weblogs on the topic before starting your coding.
And abt your code, can you please explain why you need these lines of code :
<b>
Zsdsubscrbe table = null;
for(int k =0; k<wdContext.nodeOutput().nodeLi_Subscript().size();k++)
{
table = new Zsdsubscrbe()
table.setCust_No("");
table.setEventid("");
table.setMailerid("");
table.setSubscr_Value("");
}
</b>
Can you try executing the following lines & see the result :
Z_Sd_Update_Subscription_Input updateInput = new Z_Sd_Update_Subscription_Input();
IPublicBPSubscComp.ILi_SubscriptElement Element1 = null;
for(int j =0; j<wdContext.nodeOutput().nodeLi_Subscript().size(); j++)
{
Element1 = wdContext.nodeLi_Subscript().getLi_SubscriptElementAt(j);
table = new Zsdsubscrbe();
table.setCust_No("11");
table.setEventid("CONTRACT");
table.setMailerid("MAIL11");
table.setSubscr_Value("0");
updateInput.addLi_Subscrbe(table);
}
wdContext.nodeZ_Sd_Update_Subscription_Input().bind(updateInput);
wdContext.currentZ_Sd_Update_Subscription_InputElement.modelObject().execute();
In the Catch block try to print the exeception as Bharath pointed out.
Hope this helps,
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi srikant,
<b>Zsdsubscrbe table = null;
for(int k =0; k<wdContext.nodeOutput().nodeLi_Subscript().size();k++)
{
table.setCust_No("");
table.setEventid("");
table.setMailerid("");
table.setSubscr_Value("");
}</b>
I think you are getting the Null pointer exception here since yu have not assigned any memory to the variable 'table'.
Add 'table = new Zsdsubscrbe()' as the first line inside the for loop.
Hope this helps,
Best Regards,
Nibu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There might be an error.Since you are givin printStackTrace() it wont give the error in the console ..Check it !
use wdComponentAPI.getMessageManager().reportException(e.getCause(),false);
And I would suggest you to go through SDN forums for previous posts and check for articles on the same topic.
This is a extensively discussed topic.. and it will be easy for u if u go through the previous queries !
It might hep u understand the whole stuff better,instead of getting into a confusion !
Please go through this link !
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/linking rfc to web dynpro.pdf
and check out the featured weblog in SDN webdynpro section by Alfred !
Regards
Bharathwaj
Strange ! I cant see the full content i had typed ! Check my next post !
Hi,
There might be an error.Since you are givin printStackTrace() it wont give the error in the console ..Check it !
use wdComponentAPI.getMessageManager().reportException(e.getCause(),false);
And I would suggest you to go through SDN forums for previous posts and check for articles on the same topic.
This is a extensively discussed topic.. and it will be easy for u if u go through the previous queries !
It might hep u understand the whole stuff better,instead of getting into a confusion !
Please go through this link !
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/li... rfc to web dynpro.pdf
and check out the featured weblog in SDN webdynpro section by Alfred !
Regards
Bharathwaj
Hi Srikant,
Make sure you are providing all the input data correctly. For testing, try hardcoding the input parameters and see if it runs without any error.
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Nibu,
the problem is not resolved if i remove the code under ExecuteModify() method, atleast my old funtionality is restored. So there is some error in the code by the way its written by me
can u tell me where is the error??
I've tried to hardcode the values.
i puttting the code below can u tell me where is my error.
Z_Sd_Update_Subscription_Input updateInput = new Z_Sd_Update_Subscription_Input();
IPublicBPSubscComp.ILi_Subscrbe_updateElement element = null;
IPublicBPSubscComp.ILi_SubscriptElement Element1 = null;
Zsdsubscrbe table = null;
for(int k =0; k<wdContext.nodeOutput().nodeLi_Subscript().size();k++)
{
table.setCust_No("");
table.setEventid("");
table.setMailerid("");
table.setSubscr_Value("");
}
for(int j =0; j<wdContext.nodeOutput().nodeLi_Subscript().size(); j++)
{
Element1 = wdContext.nodeLi_Subscript().getLi_SubscriptElementAt(j);
table = new Zsdsubscrbe();
//table.setCust_No(Element1.getCust_No());
table.setCust_No("11");
table.setEventid("CONTRACT");
table.setMailerid("MAIL11");
//table.setEventid(Element1.getEventid());
//table.setMailerid(Element1.getMailerid());
table.setSubscr_Value("0");
/* boolean nodeEmail = wdContext.nodeBPSubsc().nodeOutput().nodeLi_Subscript().nodeCmpEmailNode(j).currentCmpEmailNodeElement().getEmail();
boolean nodeWeb = wdContext.nodeBPSubsc().nodeOutput().nodeLi_Subscript().nodeCmpWebNode(j).currentCmpWebNodeElement().getWeb();
if(nodeEmail == false && nodeWeb == false)
{
table.setSubscr_Value("0");
}
else if(nodeEmail == true && nodeWeb == false)
{
table.setSubscr_Value("1");
}
else if(nodeEmail == false && nodeWeb == true)
{
table.setSubscr_Value("2");
}
else
{
table.setSubscr_Value("3");
}
*/
//updateInput.addLi_Subscrbe(table);
}
try
{
wdContext.nodeBPUpdate().bind(updateInput);
wdContext.nodeBPUpdate().currentBPUpdateElement().modelObject().execute();
wdContext.nodeOutput_Update().invalidate();
}
catch(Exception err){
err.printStackTrace();
}
Thanks in advance
Srikant
Hi Srikant,
You can do it in two ways:
1) You can define a method in the controller which calls the RFC. In the event handler of the submit button call the method through the code 'wdThis.wdGet<controller-name>.method_name();'
2) Map the entire context of the RFC from the controller to the view and call it directly from the view.
But the code 'wdThis.wdGet<your component controller name>().wdGetContext().currentUpdateElement().modelObject().execute();' I gave in the previous post is specifically for calling the RFC from the view. To call it from the controller you just need to write 'wdContext().currentUpdateElement().modelObject().execute();
Best Regards,
Nibu.
Message was edited by: Nibu Wilson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nibu,
I was able to do the whole coding without any errors. Thanks to you.
but on running the application its giving following error
<i>java.lang.NullPointerException
at com.sap.ngi.BPSubscComp.ExecuteModify(BPSubscComp.java:204)
at com.sap.ngi.wdp.InternalBPSubscComp.ExecuteModify(InternalBPSubscComp.java:227)
at com.sap.ngi.CustomerSubscView.wdDoModifyView(CustomerSubscView.java:134)
at com.sap.ngi.wdp.InternalCustomerSubscView.wdDoModifyView(InternalCustomerSubscView.java:353)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)
at com.sap.tc.webdynpro</i>
Intially it was able to display data but now the above error is coming. and ExecuteModify is the method in which i'm doing this
Can you point to my cause of error
Thanks
Srikant
Hi Srikant,
1) Can you explain what do you mean by
<b>How do i define the object when i use the update(Zsdsubscrbe o) and i have declared obj = new Zsdsubscrbe();</b> and <b>if i'm reading you write I need to include that node which below which the export parameters are listed which become the import parameters for second BAPI</b>
As far as I understand your situation the lines of code to be written are:
Z_Sd_Update_Input updateInput = new Z_Sd_Update_Input();
IPublicControllerComp.ILi_Subscript element = null;
Zsdsubscrbe table = null;
for(int j =0; j<wdContext.nodeOutput().nodeLi_Subscript().size(); j++)
{
element = wdContext.nodeLi_Subscript().getLi_SubscriptElementAt(j);
table = new Zsdsubscrbe();
table.setAttr1(element.getAttr1());
table.setAttr2(element.getAttr2());
table.setAttr3(element.getAttr3());
updateInput.addLi_Subscrbe(table)
}
2 & 3,
This occurs bcos you have the node Li_Subscript() defined in your controller and not in your view. Iprivate..() is basically used to access the view elements wgile Ipublic...is used to access the controller elements.
Try this code for executing the RFC
wdThis.wdGet<your component controller name>().wdGetContext().currentUpdateElement().modelObject().execute();
I hope you have mapped the Update node to the input node of the RFC.
Hope this helps,
Best Regards,
Nibu.
Message was edited by: Nibu Wilson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nibu,
the issue with "updateInput(table)" was resolved.
<b>This occurs bcos you have the node Li_Subscript() defined in your controller and not in your view. Iprivate..() is basically used to access the view elements wgile Ipublic...is used to access the controller elements.
Try this code for executing the RFC
wdThis.wdGet<your component controller name>().wdGetContext().currentUpdateElement().modelObject().execute();
I hope you have mapped the Update node to the input node of the RFC.</b>
Now i have binded the update node to input node of RFC.
now do i have to context mapping with view as I'm writing this code in a method defined in controller and calling this method in the submit button .
can u tell me what i should do further?
thanks in advance
Srikant
P.S. :Thanks for the help, wish i could give u more points.
Hi Srikant,
Why do you need the following line of code ?<b>table.toString();</b>
Please explain when you say 'Li_Subscrbe' is of boolean type.
<b>//updateInput.addLi_Subscrbe()
// its not taking as Li_Subscrbe of boolean type</b>
There need to be some function updateInput.add<some>() which will take an input parameter of type Zsdsubscrbe.
Else there will be some 'add..()' function which will have the input parameter as a list.
And please pt the declaration of Zsdsubscrbe object outside the loop. Let's say
Zsdsubscrbe obj = null;
for(....)
{
obj = new Zsdsubscrbe();
.
.
}
Best Regards,
Nibu.
Message was edited by: Nibu Wilson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
i have to problems:
1.update.addLi_Subscrbe(Zsdsubscrbe o)should be the entry, where o is an object. How do i define the object when i use the update(Zsdsubscrbe o)
and i have declared obj = new Zsdsubscrbe();
2.<i>wdContext.nodeBPUpdate().currentBPUpdateElement().modelObject().execute();</i> is giving the WDRFCExecutionException
why its giving error.
I don't know why this is giving the error
thanks in advance
hi
when i tried the following code:
IPrivateCustomerSubscView.ILi_SubscriptElement Element = null;
{
Element = wdContext.nodeLi_Subscript().getLi_SubscriptElementAt(j);
}
this is giving error as type mismatch.
but on giving the following code
IPublicBPSubscComp.ILi_SubscriptElement Element = null;
it gets okay.
if i'm reading you write I need to include that node which below which the export parameters are listed which become the import parameters for second BAPI
correct if i'm wrong???
thanks in adv
I shall provide a code snipet for an example.
nodeABC
|___ZInput
|___input1(String)
|___input2(Boolean)
|____ZOutput(Node)
|____output1(String)
Then
ZnodeABC inp=new ZnodeABC();
wdContext.nodeABC().bind(inp);
ZInput val_in=new ZInput();
for(int i=0;i<wdContext.node<fromNode>().size();i++){
val_in.setinput1(wdcontext.node<fromNode>().get<fromNode>elmentat(i).get<attribute>());
val_in.setinput2(wdcontext.node<fromNode>().get<fromNode>elmentat(i).get<attribute>());
inp.addZInput(val_in);
}
I hope this is your requirement.
Hi Srikant,
1) You can use the same controller. But if you have used the node 'Output' for the first RFC already , give another name for the second RFC's output node
2) Yes, you need to write this code inside 'onActionSubmit EventHandler'.
3) I am not very clear when you say 'how do I include the manipulated values of check boxes in loop'. But you can browse through the element for the table node and use the get<attribute>() method for the attribute you have bound to 'checked' property of the checkbox. This will return the boolean value saying whether it is checked or not.
Hope this helps,
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nibu,
I tried the code which u gave me, but some where i'm not able to write that properly
Before i tell my problems: I would like you to explain about the present Context of Controller :
Context
|------Subsc
|----
Output
|----
LiSubscript
|------Update
|----
LiSubscrb
|----
Output_Update
Here the node(Subsc)used for displaying data in the table. and was binded Z_Sd_Table Input. LiSubscript has the export parameters
and node (Update) used for updation. LiSubscrb is the node which has the import parameters. which is equivalent to Lisubscript.
so those export parameters have to be sent to the second node.
The table name Zsdsubscrbe.
and the Model class for update is Z_Sd_Update.
the view name is CustView and Controller name Controller
I have following code which is not working properly:
Z_Sd_Update_Input updateInput = new Z_Sd_Update_Input();
IPublicControllerComp.ILi_Subscript element = null;
for(int j =0; j<wdContext.nodeOutput().nodeLi_Subscript().size(); j++)
{
element = wdContext.nodeLi_Subscript().getLi_SubscriptElementAt(j);
Zsdsubscrbe table = new Zsdsubscrbe();
table.toString();
table.setAttr1(element.getAttr1());
table.setAttr2(element.getAttr2());
table.setAttr3(element.getAttr3());
//updateInput.addLi_Subscrbe()
// its not taking as Li_Subscrbe of boolean type
}
wdContext.nodeBPUpdate().bind(updateInput);
// wdContext.nodeBPUpdate().currentBPUpdateElement().modelObject().execute();
//the WDRFCExecutionException occuring.
wdContext.nodeOutput_Update().invalidate();
My question is:
1. how do modify my error in the above code
2. how do add the table element in following line
"updateInput.addTable()" as its of boolean type
Thanks in advance
Srikant
Hi Srikant,
As far as I understand, you have executed one RFC and have the data in one output node say 'Output1'. Let's say Output1 has a subnode 'sub_output1' with an attribute 'attr1'.
Now, you need to call another RFC and pass a table as input parameter with the values returned from RFC1. Hope you have done the data binding for the second RFC (say ZMYRFC')too.
Assume that RFC 'ZMYRFC' uses a table 'mytable' of type some type 'ZTAB' . When binding this node make sure you bind the tables inside the 'output' node and not those outside to it. The lines of code you need to write to invoke this RFC with the table as input are :
ZMYRFC_Input input = new ZMYRFC_Input() // create an instance of the Input class;
Iprivate<your view name>.ISub_output1Element elmt = null;
for(int i=0;i<wdContext.nodeSub_output1.size();i++)
{
elmt = wdContext.getSub_output1ElementAt(i);
ZTAB table = new ZTAB();
//if you do not know table type of 'mytable', check the function input.addMytable(<table type>)
table.set<property>(elmt.getAttr1());
.
.
table.set<property>('value');
input.addMytable(table);
}
wdcontext.currentZMYRFC_inputElement.bind(input);
wdContext.currentZMYRFC_inputElement().modelObject().execute();
wdContet.nodeOutput.invalidate()
// clears the old value in the output node
Hope this helps,
Best Regards,
Nibu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Nibu,
Your answer is been very helpful. and tell you frankly you are just fabulous.
But still i have few questions to clarify:
The structure the Bapi from which i get data is following ways:
Context
|_____Model_Output
|___ModelFun
|____Input value 1(Name)
|____Input value 2(No)
|____Event Id
|____Event Value
The table which I'm displaying is like this :
|::EventID::|::EventValue|::Check1::|::Check2
on the basis of value under the "EventValue" checks in Check1 and Check2:
example:
::EventValue:: | ::Check1:: | ::Check2:: |
::____2_____:: ::true :: :: true ::|
(this functionality i have achieved )
*********************************************************
the structure of other model is :
the values of tables become the import parameters, as u said " i hope u have done with databinding of other RFM"
<i>My question with which controller i have to bind the RFM, as the Component Controller is already used for the binding for the first RFM!!!</i>
Since i have to do these actions on click of the button "SUBMIT" do i have to include this code in the a method called by onActionSubmit EventHandler.
Thirdly how do I include the manipulated values of check boxes in loop.
I'm grateful for the solution(I'm gonna paste the code, in my next post, which i'm using please tell me whether i'm right or wrong)
Thanks in advance
Srikant
Hi,
Are u able to execute your first BAPI or model successfully?
If so it should not be a problem, Store these output values of the BAPI into the context and then pass on this values as input to ur second BAPI..
I doubt its in webdynpro only right?
Thanks and regards,
Sirisha.R.S.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rowtula,
I am able to execute the BAPI1 successfully and retrieve info into a table.
Now i need to send these values to the BAPI2 to update the table. The values obtained from BAPI1 are in the form of multiple values under a single parameter. How do i store this into a context and pass it into the import parameter of BAPI2. (the input parameter for BAPI2 is of the Table parameter type)
thanks
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.