on 2009 Aug 27 2:45 PM
Hello Everyone,
I am trying to execute BAPI_ACC_DOCUMENT_POST multiple times in an application. My requirement is to post multiple documents in one click. The Context is as follows.
--Context
-
BAPI_ACC_DOCUMENT_POST(model node)---cardinality(0..1)
-
Accountgl(model node)---cardinality(0..n)
-
AccountPayable(model node)---cardinality(0..n)
-
Currencyamount(model node)---cardinality(0..n)
-
DocumentHeader(model node)---cardinality(0..1)
-
Output(model node)---cardinality(0..1)
-
-Document(Value Node)-cardinality(0..n)
I have create the Value node Document and I am trying to get few values from the user and assigning it to the model nodes during runtime. The BAPI should execute depending on the number of rows in the Document Table that the user decides at the runtime.
Could anyone give me some basic idea about how to acheive this requirement. I hope you can understand my requirement and please do let me know if you need any further explanation. I would greatly appreciate your help.
Regards,
Gopal.
Hi Gopal,
As per my understanding -Document(Value Node) size will decide the BAPI calls.
Then try this out:
for (int i=0; i<wdContext.nodeDocument().size();i++)
{
//access value node attribute here and set them to model e.g.
// declare model node element use setter methods
wdContext.nodeDocument().getDocumentElementAt(i).get<attributename>();
// like get all attribute and set
// execute BAPI here
}
Let me know if you are not clear yet.
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
Thanks a lot for you reply. My code is as follows.
I have no problem assigining the values from Document node to the other model nodes apart from the "Currencyamount" table.
I have to take a value from the "Amount" field of the Document table and assign it to two different rows in the "Currencyamount" table. For Eg:-
Document Table
row 1----
Amount = 100 (this is bigdeciaml value)
Now I have to take this amount value and add it in two rows of the currencyamount table like:-
Currencyamount table
row1----
Amount =-100
row2----
Amount = 100
Can you help me with some code to do this. I hope you can understand my requirement . Please do, let me know if you dont undestand my requirement, I will try to explain in more detail.
Thanks a lot for your help.
Regards,
Gopal.
Hi Siva,
My issue is resolved by using the following code.
public void onActionPostDocument(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionPostDocument(ServerEvent)
//$$begin ActionButton(-761385096)
for(int i=0; i<wdContext.nodeDocument().size(); i++){
wdContext.currentDocumentheaderElement().setHeader_Txt(wdContext.nodeDocument().getDocumentElementAt(i).getHeader_Txt());
wdContext.currentDocumentheaderElement().setRef_Doc_No(wdContext.nodeDocument().getDocumentElementAt(i).getRef_Doc_No()); wdContext.currentAccountglElement().setGl_Account(wdContext.nodeDocument().getDocumentElementAt(i).getGl_Account());
wdContext.currentAccountglElement().setCostcenter(wdContext.nodeDocument().getDocumentElementAt(i).getCostcenter());
wdContext.currentAccountpayableElement().setVendor_No(wdContext.nodeDocument().getDocumentElementAt(i).getVendor_No());
wdContext.nodeCurrencyamount().setLeadSelection(0);
wdContext.currentCurrencyamountElement().setAmt_Doccur(wdContext.nodeDocument().getDocumentElementAt(i).getAmt_Doccur().negate());
wdContext.currentCurrencyamountElement().setItemno_Acc("0000000001");
wdContext.nodeCurrencyamount().setLeadSelection(1);
wdContext.currentCurrencyamountElement().setAmt_Doccur(wdContext.nodeDocument().getDocumentElementAt(i).getAmt_Doccur());
wdContext.currentCurrencyamountElement().setItemno_Acc("0000000002");
wdThis.wdGetMultipleDocCompController().executeBapi_Acc_Document_Post_Input();
}
Thanks a lot for your help.
Regards,
Gopal.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.