I will no longer be posting to Dynamics GP Land, and all new posts will be at https://blog.steveendow.com
Thanks!
By Steve Endow
A customer asked for sample XML for the RMApplyType / taRMApply eConnect transaction type. I couldn't find one handy during a search, so I had to cobble together some .NET code and generate the XML.
I'm wondering if there is an easier way to generate the sample eConnect XML. In theory, eConnect Requester with the eConnect Outgoing Service can send certain XML documents to MSMQ, but that is a hassle to setup properly, and I don't know that all transaction types are supported by eConnect Requester--such RMApplyType.
So, here is a sample Dynamics GP eConnect XML document for RM Apply (RMApplyType / taRMApply)
<?xml
version="1.0"?>
<eConnect
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RMApplyType>
<eConnectProcessInfo xsi:nil="true" />
<taRequesterTrxDisabler_Items xsi:nil="true"
/>
<taAnalyticsDistribution_Items xsi:nil="true"
/>
<taRMApply>
<APTODCNM>SALES100001</APTODCNM>
<APFRDCNM>PYMNT100001</APFRDCNM>
<APPTOAMT>123.45</APPTOAMT>
<APFRDCTY>9</APFRDCTY>
<APTODCTY>1</APTODCTY>
<DISTKNAM>0</DISTKNAM>
<APPLYDATE>2017-04-12</APPLYDATE>
<GLPOSTDT>2017-04-12</GLPOSTDT>
</taRMApply>
</RMApplyType>
</eConnect>
Discount Taken, Apply Date, and GL Post Date are optional, and do not have to be assigned or included in the XML if they are not needed.
Here is the eConnect documentation on taRMApply.
Steve Endow is a Microsoft MVP in
Los Angeles. He is the owner of Precipio Services, which provides
Dynamics GP integrations, customizations, and automation solutions.
Hi Steve
ReplyDeleteI have a question. We have developed a tool to take users through workflow of what to apply etc. Mainly for discounts that need approval.
When we use eConnect to generate teh apply, GP does not generate teh tax entry in the GL batch. We have the "Tax Rebate" option marked in teh company setup. When you manually apply GP writes a3rd line in teh GL batch for teh tax when pricessing discount.
Riaan
Hi Riaan,
ReplyDeleteI'd like to get more information about your GP setup and the transaction you are trying to import.
Can you please contact me at steveendow (at) gmail / com so that I can get more info?
Thanks,
Steve
Hi Steve,
ReplyDeleteI'm trying to apply the amounts to the posted invoices by using CreditMemos in GP. It is throwing an exception as "Object reference not set to an instance of an object." at the last line which is in BOLD letters.Below is the sample code . Please tell me where i'm missing.
RMApplyType[] rmarray = new RMApplyType[1];
taRMApply taApplyArray = new taRMApply();
decimal amount = 150;
taApplyArray.APFRDCTY = 7;
taApplyArray.APFRDCNM = "CREDT000000000034";
taApplyArray.APTODCTY = 1;
taApplyArray.APPLYDATE = System.DateTime.Now.ToString();
taApplyArray.APPTOAMT = amount;
taApplyArray.APTODCNM = "STDINV027";
rmarray[0].taRMApply = taApplyArray;
Regards,
Pavan G.
Hi Pavan,
ReplyDeleteI can't tell why you are getting the object reference error, but I see that my RM Apply code is slightly different. Notice that I don't create an RMApplyType array. I just create a single instance, and then assign it to the eConnect.RMApplyType, and type it as an array (last line of code below).
Since I typically only send one transaction at a time to eConnect, this has always worked for me. Let me know if this works for you.
taRMApply rmApply = new taRMApply();
rmApply.APTODCNM = applyTo;
rmApply.APTODCTY = applyToType;
rmApply.APFRDCNM = applyFrom;
rmApply.APFRDCTY = applyFromType;
rmApply.APPTOAMT = applyAmount;
rmApply.WROFAMNT = 0;
rmApply.DISTKNAM = 0;
rmApply.DISTKNAMSpecified = true;
RMApplyType rmApplyType = new RMApplyType();
rmApplyType.taRMApply = rmApply;
eConnectType eConnect = new eConnectType();
eConnect.RMApplyType = new RMApplyType[] { rmApplyType };
Hi Pavan,
ReplyDeleteI think I see the cause of the error. On your last line:
rmarray[0].taRMApply = taApplyArray;
rmarray[0] has not yet been assigned, so I'm guessing index 0 is null / empty, so there is no rmarray[0].taRMApply yet.
Give my code sample a try and see if that works for you.
Steve
This comment has been removed by the author.
DeleteHi Steve,
DeleteI have resolved the previous issue .But i'm getting the another Error while CreateTransactionEntity as "
The INSERT statement conflicted with the CHECK constraint "CK__RM20201__DATE1__5105F123". The conflict occurred in database "B_BD", table "dbo.RM20201", column 'DATE1'.
The statement has been terminated." I googled this,some one suggested to me as,do alter that Check Constraint .BUt we should not dot hat .Please suggest me in this regard.
Hi Pavan,
ReplyDeleteYou should NOT alter the Check Constraint. The issue is that you are sending in a Date Time string to eConnect. You must send a date value only.
This is the line that is causing the error:
taApplyArray.APPLYDATE = System.DateTime.Now.ToString();
Try something like this:
DateTime.Today.ToShortDateString();
Thank you very much Steve.
ReplyDeleteU r nailed it to explain for queries.I have cleared with your explanations.
Once again Thank u very much..Keep rocking.
Regards,
Pavan .
Hi Steve
ReplyDeleteI am having a problem with my econnect taRMApply. When processing APFRDCTY = 8 or 9, it works through GP, but when APFRDCTY =7
It throws error code 680 where the error is
taGLTransactionLineInsert which says :
A null was found in at least one input parameter for GL Trx Line Insert. Why is this procedure taGLTransactionLineInsert throwing an error when im using taRMApply?
Thanks
Hi Steve,
ReplyDeleteI’m currently experiencing problems with the Dynamics GP econnect procedure taRMApply(). When passing values where APFRDCTY = 8 or 9 it processes but when I pass APFRDCTY=7, it throws an error code 680 which states that “A null was found in at least one input parameter for GL Trx Line Insert” . I’m not using the taGLTransactionLineInsert procedure so I don’t understand why I get this error.
Please could you assist?
Hi Riaan,
ReplyDeleteThe taRMApply procedure will sometimes create GL JE adjustments, depending on how the payment application is performed.
Are you specifying an amount for Discount Taken or Write Off Amount in your RM Apply? I believe those can result in a JE being created as part of the apply process.
Steve