I need to insert adjusment document (bill doc) in Documents to Apply of the screen Checks and Payments (AP302000). This adjustment document need to insert based on current "Prepayment" document. I need to do this for set off the "prepayment" with the spesific "bill". Note: both of this "Prepayment" and "Bill" documents already released in previous session. So I just have to call spesific reference nbr of Prepayment Doc in header, and then call the spesific Reference Nbr of Bill Doc in Documents to Apply (detail transaction).
Please refer to this screenshot below.
I tried to provide my goal using this code below.
context.CookieContainer = new System.Net.CookieContainer();
context.Timeout = System.Threading.Timeout.Infinite;
context.Url = "http://localhost/AcuInterface/(W(3))/Soap/SOD.asmx";
LoginResult result = context.Login("admin", "123");
AP302000Content checkSchema = context.AP302000GetSchema();
List<Command> cmds = new List<Command>();
cmds.Add(new Value { LinkedCommand = checkSchema.PaymentSummary.Type, Value = "Prepayment" });
cmds.Add(new Value { LinkedCommand = checkSchema.PaymentSummary.ReferenceNbr, Value = "1600001331"});
cmds.Add(checkSchema.DocumentsToApply.ServiceCommands.NewRow);
cmds.Add(new Value { LinkedCommand = checkSchema.DocumentsToApply.DocumentType, Value = "Bill" });
cmds.Add(new Value { LinkedCommand = checkSchema.DocumentsToApply.ReferenceNbrAdjdRefNbr, Value = "1600003050"});
cmds.Add(new Value { LinkedCommand = checkSchema.DocumentsToApply.AmountPaid, Value = "80000" });
try
{
cmds.Add(checkSchema.Actions.Save);
var result = context.AP302000Submit(cmds.ToArray());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
context.Logout();
}
But when I debug this code, I got this error message. Please refer to this screenshot below.
Does anyone knows to solve this issue ?
On Screen with a type selector before the reference number, you must add an additional action, the insert action.
Also there seem to be an issue with how the page is structured and it is trying to commit the change on the detail level after each and every field entered. So since it doesn't have yet all the required information for it to be valid it return the error you are seeing.
Here is a code sample that should work: