In testing Dynamics GP 2016 SBA Service I have two problems:
1. when I use myhost/.../Transactions.xml to create SOP Invoice I always get a Document Date "0000-00-00". why?
<DexRequest>
<Payload>
<SOPTransaction>
<SOPTransactionHeader>
<SOPType>Invoice</SOPType>
<SOPNumber>CLPASTDINV</SOPNumber>
<BatchNumber>SOP INVOICES</BatchNumber>
<DocumentID>STDINV</DocumentID>
<DocumentDate>2016-09-22T00:00:00</DocumentDate>
<CustomerNumber>LASERMES0001</CustomerNumber>
<CurrencyID>Z-US$</CurrencyID>
</SOPTransactionHeader>
</SOPTransaction>
</Payload>
</DexRequest>
to fix it I create my service procedure to set invoice document date: SetDocumentDate
in integer SOPType;
in 'SOP Number' SOPNumber;
inout 'Document Date' DocumentDate;
local string sSOPNumber;
sSOPNumber=upper(SOPNumber);
open form SOP_Entry;
'SOP Type' of window SOP_Entry of form SOP_Entry=IntToSOPType(SOPType);
'SOP Number' of window SOP_Entry of form SOP_Entry=sSOPNumber;
run script 'SOP Number' of window SOP_Entry of form SOP_Entry;
'Document Date' of window SOP_Entry of form SOP_Entry=DocumentDate;
run script 'Document Date' of window SOP_Entry of form SOP_Entry;
run script 'Save Button' of window SOP_Entry of form SOP_Entry;
close form SOP_Entry;
it is working by using: myhost/.../SetDocumentDate(3;CLPASTDINV).xml
<DexRequest>
<Payload>
<DocumentDate>2016-09-01</DocumentDate>
</Payload>
</DexRequest>
2. I write a very simple service procedure to wraps an existing procedure "ServiceCreateSOPTransaction".
ServiceCreateSOPTransactionEx:
using Microsoft.Dynamics.GP.Svc.Application;
inout Microsoft.Dynamics.GP.BusinessObjects.Sales.SOPTransaction SOPDoc;
'User Date' of globals=sysdate(CURRENT_SERVER);
call ServiceCreateSOPTransaction,SOPDoc;
When I call ServiceCreateSOPTransactionEx by use myhost/.../Transactions.xml
i get the error, the invoice is not created. I check the log and get the details information. the the following is the part of log (whole log is too long):
...
10:30:02.450 | SS:[ 'SOP_Entry Currency ID_CHG on form SOP_Entry']
10:30:02.450 | SS:[ 'SOPTypeToInt()', 0, 4, 0.00000]
10:30:02.451 | SS:[ 'SetCurrencyID() of form SOP_Entry', 0, 1, 3, "CLPASTDINV", "", 0.0000000, 0000-00-00, 2017-05-23, "SOP INVOICES", "LASERMES0001", "Z-US$", 0, "", "", 0.0000000, 0000-00-00, 00:00:00 , 0, 0, 0.00000, 0, 0.0000000, 0, 0000-00-00, -Z-US$, 0.00000, 0.00000, "Net 30", 0, 0.00000, 0.00000, 0, 1-, "", 0, 1, table 'Batch_Headers', table 'MC_Currency_SETP', table 'MC_SETP', table 'MC_Exchange_Rate_MSTR', table 'RM_Customer_MSTR', table 'SY_Payment_Terms_MSTR']
10:30:02.451 | SS:[ 'MC_Curr_Verification of form SOP_Entry', 1, 3, "CLPASTDINV", "", "", 0.0000000, 0000-00-00, 2017-05-23, "SOP INVOICES", "LASERMES0001", "Z-US$", 0, "", "", 0.0000000, 0000-00-00, 00:00:00 , 0, 0, 0.00000, 0, 0.0000000, 0, 0000-00-00, -Z-US$, table 'Batch_Headers', table 'MC_Currency_SETP', table 'MC_SETP', table 'MC_Exchange_Rate_MSTR', 0]
10:30:02.451 | SS:[ 'MC_Currency_ID_Without_Scroll_Win', "", "", 0000-00-00, 2017-05-23, "", "SOP INVOICES", "Sales Entry", 3, "LASERMES0001", 0, 0, 0, 0, "Z-US$", 0, "", "", 0.0000000, 0000-00-00, 00:00:00 , 0, 2, 0, 0.00000, 0, 0.0000000, 0, table 'MC_Currency_SETP', table 'MC_SETP', table 'MC_Exchange_Rate_MSTR']
10:30:02.451 | SS:[ 'MC_Return_View_Mode_Without_View_Menu', 0]
10:30:02.452 | SS:[ 'MC_Verify_Batch_Frequency_is_Single_Use', "SOP INVOICES", "Sales Entry", "Z-US$", 0]
10:30:02.453 | SS:[ 'MC_Verify_Currency_ID', 0, -1, "Z-US$", 0, 0, table 'MC_Currency_SETP']
10:30:02.453 | SS:[ 'SQLPath', 0, 7, 150, ""]
10:30:02.455 | SS:[ 'MC_Set_Currency_Index_Without_ScrollWin', 0, 2, "", 0.0000000, "", 0000-00-00, 00:00:00 , 0.0000000, 0, "Z-US$", 4, table 'MC_Currency_SETP']
10:30:02.455 | SS:[ 'MC_Get_Currency_Note_Index', "Z-US$", 0.00000, 0]
10:30:02.455 | SS:[ 'Check_For_Record_Note', 0.00000, 0]
10:30:02.456 | SS:[ 'SOP_Entry l_Note Show Hide[6]_CHG on form SOP_Entry']
10:30:02.456 | SS:[ 'Check_For_Record_Note', 0.00000, 0]
10:30:02.456 | SS:[ 'MC_Set_Prev_Fields of form SOP_Entry', 1, "Z-US$", "", "", 1007, 0.0000000, 0000-00-00, 00:00:00 , 0000-00-00, 0, -Z-US$]
10:30:02.456 | SS:[ 'Default_Payment_Terms of form SOP_Entry', 1, 3, -Z-US$, "Net 30", 0, 0.00000, 0.00000, 0, table 'SOP_HDR_WORK', table 'RM_Customer_MSTR', table 'SY_Payment_Terms_MSTR']
10:30:02.456 | SS:[ 'CalculateTermsDiscBeforeTaxes() of form coTaxSetup', 0]
10:30:02.456 | SS:[ 'IsCompanyOptionActive()', 0, -1, 2]
10:30:02.457 | SS:[ 'CustomLinks_Fill of form coCustomLinks', 3, Zoom Buttons, 0, "Z-US$"]
10:30:02.457 | SS:[ 'Create() of form coCustomLinks', 0, 0-0-0-0-0-0-0-0, table 'coCustomLinks', 0, "", ""]
10:30:02.457 | SS:[ 'SetRange of form coCustomLinks', 1-0-0-1-0-0-1-1, 3-, 3-]
10:30:02.457 | SS:[ 'GetOrderBy() of form TableObj', 0, 1-0-0-1-0-0-1-1]
10:30:02.457 | SS:[ 'GetOrderBy() of form TableObj', 0, 1-0-0-1-0-0-1-1]
10:30:02.457 | SS:[ 'Get() of form coCustomLinks', 0, 1-0-0-1-1-1-1-1, 11]
10:30:02.457 | SS:[ 'Get() of form TableObj', 0, 1-0-0-1-1-1-1-1, table 'coCustomLinks', 11]
10:30:02.457 | SS:[ 'ClearRange of form coCustomLinks', 1-0-0-1-1-1-1-1]
10:30:02.458 | SS:[ 'Destroy of form coCustomLinks', 1-0-0-1-1-0-1-1]
10:30:02.461 | [*Error*]::Request Exception (pipeline - unexpected) :: System.NullReferenceException: Object reference not set to an instance of an object.
at si_inst_newobject(PROCESS* cur_process, Int16* exectop_ptr)
at script_run_with_args(SCRIPT_TYPE_TAG , Int16 , Int16 , UInt32 , Void** )
at DtwVSToolsScripts.Invoke(Int16 script_type, Int16 script_id, Int16 form_id, Argument[] argArray)
at AppDispatch.InvokeScript(Int16 scriptType, String scriptName, String formName, Argument[] arguments)
at Microsoft.Dexterity.Bridge.AppController.Invoke(Script script, Argument[] args, Int32 options)
at Microsoft.Dexterity.Applications.ClpaTestDictionary.ClpaCreateSopTransactionProcedure.Invoke(Field`1& SopDoc)
at Microsoft.Dexterity.Applications.ClpaTestDictionary.ClpaCreateSopTransactionProcedure.Invoke(IRequestParser parser, IResponseBuilder builder)
at Microsoft.Dynamics.GP.Svc.DexterityProcess.DexInterop.ScriptExecutionHandler.ExecuteForegroundScripts(ExecutionContext context)
at Microsoft.Dynamics.GP.Svc.DexterityProcess.DexInterop.Steps.ForegroundStep.ExecuteInternal(ExecutionContext context)
at Microsoft.Dynamics.GP.Svc.DexterityProcess.DexInterop.ExecutionPipeline.Execute(ExecutionContext context)
10:30:02.462 | Step End :: Name:[Foreground], Elapsed:[642 ms]
10:30:02.462 | Step Begin :: Name:[Logout]
if i make a direct call "ServiceCreateSOPTransaction" by use of myhost/.../Transactions.xml
similar part of normal log is:
...
09:54:32.205 | SS:[ 'SOP_Entry Currency ID_CHG on form SOP_Entry']
09:54:32.206 | SS:[ 'SOPTypeToInt()', 0, 4, 0.00000]
09:54:32.206 | SS:[ 'SetCurrencyID() of form SOP_Entry', 0, 1, 3, "CLPASTDINV", "", 0.0000000, 0000-00-00, 2017-05-23, "SOP INVOICES", "LASERMES0001", "Z-US$", 0, "", "", 0.0000000, 0000-00-00, 00:00:00 , 0, 0, 0.00000, 0, 0.0000000, 0, 0000-00-00, -Z-US$, 0.00000, 0.00000, "Net 30", 0, 0.00000, 0.00000, 0, 1-, "", 0, 1, table 'Batch_Headers', table 'MC_Currency_SETP', table 'MC_SETP', table 'MC_Exchange_Rate_MSTR', table 'RM_Customer_MSTR', table 'SY_Payment_Terms_MSTR']
09:54:32.206 | SS:[ 'MC_Curr_Verification of form SOP_Entry', 1, 3, "CLPASTDINV", "", "", 0.0000000, 0000-00-00, 2017-05-23, "SOP INVOICES", "LASERMES0001", "Z-US$", 0, "", "", 0.0000000, 0000-00-00, 00:00:00 , 0, 0, 0.00000, 0, 0.0000000, 0, 0000-00-00, -Z-US$, table 'Batch_Headers', table 'MC_Currency_SETP', table 'MC_SETP', table 'MC_Exchange_Rate_MSTR', 0]
09:54:32.206 | SS:[ 'MC_Currency_ID_Without_Scroll_Win', "", "", 0000-00-00, 2017-05-23, "", "SOP INVOICES", "Sales Entry", 3, "LASERMES0001", 0, 0, 0, 0, "Z-US$", 0, "", "", 0.0000000, 0000-00-00, 00:00:00 , 0, 2, 0, 0.00000, 0, 0.0000000, 0, table 'MC_Currency_SETP', table 'MC_SETP', table 'MC_Exchange_Rate_MSTR']
09:54:32.206 | SS:[ 'MC_Return_View_Mode_Without_View_Menu', 0]
09:54:32.206 | SS:[ 'MC_Verify_Batch_Frequency_is_Single_Use', "SOP INVOICES", "Sales Entry", "Z-US$", 0]
09:54:32.207 | SS:[ 'MC_Verify_Currency_ID', 0, -1, "Z-US$", 0, 0, table 'MC_Currency_SETP']
09:54:32.207 | SS:[ 'SQLPath', 0, 7, 150, ""]
09:54:32.208 | SS:[ 'MC_Set_Currency_Index_Without_ScrollWin', 0, 2, "", 0.0000000, "", 0000-00-00, 00:00:00 , 0.0000000, 0, "Z-US$", 4, table 'MC_Currency_SETP']
09:54:32.208 | SS:[ 'MC_Get_Currency_Note_Index', "Z-US$", 0.00000, 0]
09:54:32.209 | SS:[ 'Check_For_Record_Note', 0.00000, 0]
09:54:32.209 | SS:[ 'SOP_Entry l_Note Show Hide[6]_CHG on form SOP_Entry']
09:54:32.209 | SS:[ 'Check_For_Record_Note', 0.00000, 0]
09:54:32.209 | SS:[ 'MC_Set_Prev_Fields of form SOP_Entry', 1, "Z-US$", "", "", 1007, 0.0000000, 0000-00-00, 00:00:00 , 0000-00-00, 0, -Z-US$]
09:54:32.209 | SS:[ 'Default_Payment_Terms of form SOP_Entry', 1, 3, -Z-US$, "Net 30", 0, 0.00000, 0.00000, 0, table 'SOP_HDR_WORK', table 'RM_Customer_MSTR', table 'SY_Payment_Terms_MSTR']
09:54:32.209 | SS:[ 'CalculateTermsDiscBeforeTaxes() of form coTaxSetup', 0]
09:54:32.209 | SS:[ 'IsCompanyOptionActive()', 0, -1, 2]
09:54:32.210 | SS:[ 'CustomLinks_Fill of form coCustomLinks', 3, Zoom Buttons, 0, "Z-US$"]
09:54:32.210 | SS:[ 'Create() of form coCustomLinks', 0, 0-0-0-0-0-0-0-0, table 'coCustomLinks', 0, "", ""]
09:54:32.210 | SS:[ 'SetRange of form coCustomLinks', 1-0-0-1-0-0-1-1, 3-, 3-]
09:54:32.210 | SS:[ 'GetOrderBy() of form TableObj', 0, 1-0-0-1-0-0-1-1]
09:54:32.210 | SS:[ 'GetOrderBy() of form TableObj', 0, 1-0-0-1-0-0-1-1]
09:54:32.210 | SS:[ 'Get() of form coCustomLinks', 0, 1-0-0-1-1-1-1-1, 11]
09:54:32.210 | SS:[ 'Get() of form TableObj', 0, 1-0-0-1-1-1-1-1, table 'coCustomLinks', 11]
09:54:32.211 | SS:[ 'ClearRange of form coCustomLinks', 1-0-0-1-1-1-1-1]
09:54:32.211 | SS:[ 'Destroy of form coCustomLinks', 1-0-0-1-1-0-1-1]
09:54:32.214 | SS:[ 'GetTraceReference()', <uninitialized reference>]
09:54:32.214 | SS:[ 'Trace of form Trace', 1-, 0, "script MapSOPEntryFields of form ServiceSOPTransaction", "Exit method.", 2, 0]
09:54:32.214 | TRACEMSG:[0,script MapSOPEntryFields of form ServiceSOPTransaction,Exit method.]
09:54:32.214 | SS:[ 'vatDaybookCloseVATColViewerSOP']
09:54:32.214 | SS:[ 'SOP_Entry Save Button_CHG on form SOP_Entry']
It seems GetTraceReference() throws NullReferenceException. why?
Could anyone help me about that? thanks in advance.