on 05-31-2006 10:43 PM
Hi all,
I have a specific problem about executing BAPI multiple times for different input values and didplay result in a table.
I am using the code similar to the following logic.
Bapi_Mydata_Input in = new Bapi_Mydata_Input();
wdContext.nodeBapi_Mydata_Input().bind(in);
String in = wdContext.currentperdataElement.getnumber();
in.setDestination_From(10)
wdThis.wdGetMydataComponentController().executeBapi_Mydata_Input();
in.setDestination_From(20)
wdThis.wdGetMydataComponentController().executeBapi_Mydata_Input();
in.setDestination_From(30)
wdThis.wdGetMydataComponentController().executeBapi_Mydata_Input();
And I want to display the data in a single table. I want the result in a table for Bapi execution based on input parameters passed 10,20 30.
But I am getting the table data only for the input parameter 30.I mean its actually display the data in table only for the last input parameter.
So May I ask you all if you know the solution for this problem.PLease advise me with some tips .or sample code is very much appreciated.I promise to award points to the right answer/nice advises.
Regards
Maruti
Thank you in advance.
Maruti,
Create separate context node with cardinality 0..n and same model class as output table in your BAPI.
Next, after every BAPI invocation copy model objects from BAPI output table to this new node, i.e. add new elements to new node.
Display aforementioned new node to user via Table UI control.
Valery Silaev
EPAM Systems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Valery Silaev ,
Thank you for your reply. I am trying as you suggested. I have created new model context which is same as first model.
and after executing BAPI I am trying to copy elements from fist node to second node.The second node is bound to table to display result in table form.
The code I used is
-
String fr1=wdContext.currentE_Lfa1Element().getZzpernr1();
frelan_in.setEmployeenumber(fr1);
wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
But in rum time I got the error.
java.lang.ClassCastException
Please suggest me if I miss anything.Thank you in advance.
Regards
Maruti
Maruti,
<i>Thank you for your reply. I am trying as you suggested. I have created new model context which is same as first model.</i>
I'm not sure whether you perform this step correctly. you have the following context structure:
- Context
- Bapi_Persdata_Getdetailedlist_Input (0..1)
(model class Bapi_Persdata_Getdetailedlist_Input)
- Bapi_Persdata_Getdetailedlist_Output (0..1)
(model class Bapi_Persdata_Getdetailedlist_Output)
- Personaldata (0..n)
(model class <b>Personaldata</b>)
Now you have to add the following:
- Context
- NewPersonaldata (0..n)
(model class <b>Personaldata</b>)
Does you create new node in this way? Or you were used wrong class?
VS
Hi Valery Silaev ,
Thank you for your reply.Please have a look at my context structure created with its cardinality which is automatically generated as follows.
Bapi_Persdata_Getdetailedlist_Input (0..n)
perOutput (0..1)
personaldata (0..n)
Employeenumber
Timeintervalhigh
Timeintervallow
newout (0..n)
newperOutput (0..1)
newpersonaldata (0..n)
Employeenumber
Timeintervalhigh
Timeintervallow
Please suggest me if I need to change any cardinalities..
Regards
Maruti
Hi Valery Silaev ,
Thank you for your reply.Please have a look at my context structure created with its cardinality which is automatically generated as follows.
Context
-Bapi_Persdata_Getdetailedlist_Input (0..n)
--perOutput (0..1)
---personaldata (0..n)
-
Employeenumber
-
Timeintervalhigh
-
Timeintervallow
-newout (0..n)
--newperOutput (0..1)
---newpersonaldata (0..n)
-
Employeenumber
-
Timeintervalhigh
-
Timeintervallow
Please suggest me if I need to change any cardinalities..
Regards
Maruti
Hi Valery Silaev ,
Thank you for your reply.Please have a look at my context structure created with its cardinality which is automatically generated as follows.I am trying to put in proper structure. employeenumber,Timeintervalhigh (optional input),Timeintervallow (optional input)are input parameters
Context
-Bapi_Persdata_Getdetailedlist_Input (0..n)
--perOutput (0..1)
---personaldata (0..n)
--Employeenumber
--Timeintervalhigh
--Timeintervallow
-newout (0..n)
--newperOutput (0..1)
---newpersonaldata (0..n)
--Employeenumber
--Timeintervalhigh
--Timeintervallow
Please suggest me if I need to change any cardinalities..
Regards
Maruti
Maruti,
First, there is no need to mimic structure. So instead of
-newout (0..n)
--newperOutput (0..1)
---newpersonaldata (0..n)
-
@Employeenumber
-
@Timeintervalhigh
-
@Timeintervallow
just use
---newpersonaldata (0..n)
-
@Employeenumber
-
@Timeintervalhigh
-
@Timeintervallow
However, it is critical that "newpersonaldata" should be a model node with the very same model class as "personaldata"
VS
Hi Valery Silaev ,
Good evening againg. I used the code
WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
Copy service seams to be working. But data is not beeing updated. Could you please suggest me any approach to append data to table.
One of my friend has suggested me its only possible if i create context programically.How to create context programically.Any suggestions please..?.Thank you for your continious support.
Regards
Maruti
Hi Valery Silaev
Good morning.Thank you for your mail.Copy service is working. But data is not beening appended in to second table.
Code I am write is as follows
-
Bapi_Persdata_Getdetailedlist_Input frelan_in = new Bapi_Persdata_Getdetailedlist_Input();
wdContext.nodeBapi_Persdata_Getdetailedlist_Input().bind(frelan_in);
String fr1 = wdContext.currentE_Lfa1Element().getZzpernr1();
frelan_in.setEmployeenumber(fr1);
wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
String fr2=wdContext.currentE_Lfa1Element().getZzpernr2();
frelan_in.setEmployeenumber(fr2);
wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
I am getting the result in the firts table and second table only based on the second part of execution. I need the result in second table with execution results both for first input parameter and second parameter combined and displayed in second table.So I need to know how to append data in to a new table.
Thank you and best regards
Maruti
Maruti,
It seems that WDCopyService replaces content of node, rather then adds to content.
Try this:
Bapi_Persdata_Getdetailedlist_Input frelan_in = new Bapi_Persdata_Getdetailedlist_Input();
wdContext.nodeBapi_Persdata_Getdetailedlist_Input().bind(frelan_in);
final Collection personalData = new ArrayList();
String fr1 = wdContext.currentE_Lfa1Element().getZzpernr1();
frelan_in.setEmployeenumber(fr1);
wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
/*
WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
*/
for (int i = 0, c = wdContext.nodePersonaldata().size(); i < c; i++)
personalData.add( wdContext.nodePersonaldata().getElementAt(i).model() );
String fr2=wdContext.currentE_Lfa1Element().getZzpernr2();
frelan_in.setEmployeenumber(fr2);
wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
/*
WDCopyService.copyElements(wdContext.nodePersonaldata(), wdContext.nodeNewPersonaldata());
*/
for (int i = 0, c = wdContext.nodePersonaldata().size(); i < c; i++)
personalData.add( wdContext.nodePersonaldata().getElementAt(i).model() );
wdContext.nodeNewPersonalData().bind( personalData );
Valery Silaev
EPAM Systems
Hi Maruti,
I think you need to change the code after you get data from the BAPI execution. Since yours is a table, you append the result to the previous one, instead of displaying the latest one.
This is an example code to display in table:
IPrivate<view>.I<node> xyz = wdContext.create<node>;
xyz.set<UIElement>();
wdContext.node<nodename>.addElement(xyz);
IPrivate<view>.I<node> xyz1 = wdContext.create<node>;
xyz1.set<UIElement>();
wdContext.node<nodename>.addElement(xyz1);
This will create two rows instead of creating the latest one.
Anyways try this one.
Thanks,
Raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
This is my code. So I am trying to add the lines for appending . But it seam like I am missing at adding the node for context'wdContext.createPersonaldataNode' . as soon as I press dot'.' after wdcontext. I am not seeing createPersonaldataNode . I am not getting any Node at the place to create but getting only elements. Can you suggest me ..?
String fr1=wdContext.currentE_Lfa1Element().getZzpernr1();
frelan_in.setEmployeenumber(fr1);
wdThis.wdGetFreLanReEngCompController().executeBapi_Persdata_Getdetailedlist_Input();
IPrivateVendorlist_View.IPersonaldataNode xyz = wdContext.
Plz reply me.Thank you
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.