on 05-06-2006 3:26 AM
I need to do a Create BAPI the structure is as follows:
-Orders
-Operations_create (Afvgd - BAPI table structure)
On a click of a InsertOperation button, I should be able to insert the line Items to the Operations_create node and then set them finally to the Model node. Then do the order create(Insert BAPI as a whole).
The problem is there is an already existing element (framework created). So if I do the following code in onActionInsertOperation. I am getting an extra duplicate record.
Is there a easy fix to this . I am not sure Supplyfunction will help here. If so, How?
Or Can I tweak the code here?
Thank you ... Any help is appreciated
View Controller:
onActionInsertOperation(){
IOperations_CreateElement oprEle = wdContext.createOperations_CreateElement();
oprEle .setGLAccount(wdContext.currentOperations_CreateElement().getGLAccount());
oprEle .setVendorNo(wdContext.currentOperations_CreateElement().getVendorNo());
wdContext.nodeOperations_Create().addElement(oprEle);
}
onActionCreateOrder(){
wdThis.wdGetVmrsCustController().callBapi_CreateOrder();
wdThis.wdGetVmrsCustController().callBapi_Commit();
}
Custom Controller:
callBapi_CreateOrder(){
for(int i=0;i<wdContext.nodeOperations_Create().size();i++) {
Afvgd item = new Afvgd();
item.setGLAccount(wdThis.wdGetContext().nodeOperations_Create().getOperations_CreateElementAt(i).getGLAccount());
item.setVendor(wdThis.wdGetContext().nodeOperations_Create().getOperations_CreateElementAt(i).getVendorNo());
inputCreateOrder.addOperations(item) ;
}
// Executing the Model
// Invalidating ...
}
Before you create a new element in the model node,
call method invalidate on the model node.
This will delete existing elements from that node so you won't get any duplicates...
Message was edited by: Abhijit V Patil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Abhijit,
Thank You Very much for your reply.
That is a very good idea to invalidate the record. However, in the View Controller, I should be able to show what ever the Operation they are inserting.
For instance, if we click on the Insert Operation button 4 times, I should show them 4 records what we inserted in the table format below(this should happen before going to the Custom Controller where I set to the Model Object). So, for that reason I need to stream line those line items in the node in the View Controller.
Please let me know any other options OR way around....
Thank You
--Vivek
Hi Vivek,
In your eventHandler check if your context node has a value for the first time?
Just do something like
{
IWDNode yourNode = wdContext.node<your node name>;
if(yourNode.size != 0 && yourNode.size == 1){
yourNode.removeElement((IWDNodeElement)yourNode.getElementAt(0));
//Add now, but make sure you add some elements.
}
}
Hope this helps.
Regards,
Satyajit.
Hi Bala,
Thank You very much for the reply.
I tried both the ways you mentioned.
1) Changing to bind instead of add. I could only see one element in the node. I mean, I should be able to insert multiple operations (with a click of Insert Operation button). So if I click on that now I could only have one element in the list(1..n cardinality).
2) I tried the second option of changing this Value Node's cardinality from 1...n to 0...n . With this in the View the form data entry fields are disabled.
So any other thoughts or something I must be doing ? Please let me know.
Thank You Again....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vivek,
If the node <b>Operations_create</b> is a Value Node then you may <b>bind</b> the oprEle element to
the <b>nodeOperations_Create()</b> instead of adding it to the Node.
onActionInsertOperation()
{
IOperations_CreateElement oprEle =
wdContext.createOperations_CreateElement();
oprEle .setGLAccount
(wdContext.currentOperations_CreateElement().getGLAccount());
oprEle .setVendorNo
(wdContext.currentOperations_CreateElement().getVendorNo());
<b>wdContext.nodeOperations_Create().bind(oprEle);</b>
}
Also, you may change the cardinality of the Operations_Create node to 0:1 or 0:N (from 1:N).
By doing this, you can prevent automatic generation and addition of an element by the WDF.
Bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.