AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 01.06.2012, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
emeadaxsupport: AX for Retail: Bulk insert error in Store connect when running P job (error 32769)
Источник: http://blogs.msdn.com/b/axsupport/ar...ing-p-job.aspx
==============

Version: AX 2012 FPK

Problem description:

When running a P job to pull the data from the POS, the store connect fails while inserting the data back to AX.

The error message is logged in the Event Viewer or Outgoingmessages table is this, depending on the

tracing options set in the store connect settings.

ORIGINAL MESSAGE

2012.5.30
16:5:57:989 (8396) [1] CCommMgr::HandleException:
Target request handler failed to process target request header:
Microsoft.Dynamics.Retail.StoreConnect.Request.AXHandler.SCAXRequestHandlerException:
AX target request handler failed to process request: AX Managed Interop
failure. ---> Microsoft.Dynamics.AX.ManagedInterop.ErrorException: Error
when bulk inserting data. Target table: RetailTransactionSalesTrans


System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.InvalidOperationException: The
given ColumnMapping does not match up with any column in the source or
destination.


at
System.Data.SqlClient.SqlBulkCopyColumnMappingCollection.Add(SqlBulkCopyColumnMapping
bulkCopyColumnMapping)

--- End of inner exception stack trace ---

at
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method,
Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes
methodAttributes, RuntimeType typeOwner)

at System.Reflection.RuntimeMethodInfo.Invoke(Object
obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean skipVisibilityChecks)

at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at
Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl*
, ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength,
ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)

at
Microsoft.Dynamics.AX.ManagedInterop.Object.CallWithReturnType(String
methodName, Type returnType, Object[] paramList)

at
Microsoft.Dynamics.AX.ManagedInterop.Object.Call(String methodName)

at
Microsoft.Dynamics.Retail.StoreConnect.Request.AXHandler.SCAXTargetRequestHandler.

ProcessTargetRequestHeader(ISCTargetRequestHeader
targetRequestHeader)

--- End of inner exception stack trace ---

at
Microsoft.Dynamics.Retail.StoreConnect.Request.AXHandler.SCAXTargetRequestHandler.

ProcessTargetRequestHeader(ISCTargetRequestHeader
targetRequestHeader)

at CCommMgr.ProcessTargetRequest(CCommMgr*
,
basic_string* r_file_path, SCRequestHandlerManager scRequestHandlerManager)





Since this error message only indicates a column mapping issue, it is not very informative.

Reason:

In the following example, we explain why and how we came to the solution.

When we generate Retail seed data in the Retail parameters/initialize,
we are inserting the data from a resource file (AOT). In that process Dynamics
AX is not validating the columns if configuration keys are enabled.

In the example we found out that the customer had disabled the SALES TAX configuration key.

In the table RetailTransactionSalesTrans there are 5 fields
that all are bound to the LedgerBasicSalesTax configuration key (sales tax) which as shown in the picture is
disabled in the configuration keys.

  • TaxAmount

  • TaxGroup

  • TaxItemGroup

  • OriginalTaxGroup

  • OriginalTaxItemGroup





Debugging the issue:

To debug the issue we first had to find were the error message originates from. By looking at the

String “Error when bulk inserting data. Target table: RetailTransactionSalesTrans” we could guess that
we had to look for Error when bulk inserting data. Target table:, which we also found in the class.

\Classes\RetailConnSCDataBulkCopy\bulkCopyToTemp

Enabling a breakpoint in that class and enabling debugging through the business connector, we could step through the code.




Through the debugger we saw that we had two containers keeping the source columns and target columns

The two containers are ColumnNames(Source), PhysicalColumnNames (target)


These two containers or list of columns must match; else we have a mapping issue.




As shown in the PhysicalColumnNames

The columns 31,32,58,59,60 are missing

As mentioned earlier, these columns were not activated by the configuration keys.



The call stack of the call






Solution and modification:

The solution is to either enable the License configuration keys affecting the Retail transaction tables or adjust the subjob transfer
field list.



The code change that introduces a better error handling



\Classes\RetailConnSCDataBulkCopy\bulkCopyToTemp

public void
bulkCopyToTemp(str
physicalTempDBTableName)

{

System.Data.SqlClient.SqlBulkCopy
sqlBulkCopy;

str
connStr;


System.Data.SqlClient.SqlBulkCopyColumnMappingCollection colMapping;

str
columnName;

str
dstTableName;

int
i;

System.Xml.XmlReader xmlReader;


Microsoft.Dynamics.Retail.StoreConnect.Request.Base.SCSimpleXmlDataReader
xmlDataReader;






System.Collections.Specialized.StringCollection columnNameCollection;


System.Collections.Specialized.StringCollection
guidColumnNameCollection;



System.Exception clrException;

str
exceptionMessage;



//MS CHANGE

str
columnName2;

str
missingColumns;

//MS CHANGE

;



columnNameCollection = new
System.Collections.Specialized.StringCollection();

guidColumnNameCollection = new
System.Collections.Specialized.StringCollection();





for
(i = 1; i Microsoft.Dynamics.AX.ManagedInterop.ErrorException: Error
when bulk inserting data.


Target table: RetailTransactionSalesTrans

Target
columns:
OriginalTaxGroup,OriginalTaxItemGroup,TaxAmount,TaxGroup,TaxItemGroup,




Check if these fields are disabled by the license configuration keys.

If the configuration keys are correct, change the transfer field list on the scheduler subjob



System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.InvalidOperationException: The
given ColumnMapping does not match up with any column in the source or
destination.


at System.Data.SqlClient.SqlBulkCopyColumnMappingCollection.Add(SqlBulkCopyColumnMapping
bulkCopyColumnMapping)

--- End of inner exception stack trace ---

at
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method,
Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes
methodAttributes, RuntimeType typeOwner)

at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean
skipVisibilityChecks)

at System.Reflection.RuntimeMethodInfo.Invoke(Object
obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture)

at
Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl*
, ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength,
ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)

at
Microsoft.Dynamics.AX.ManagedInterop.Object.CallWithReturnType(String
methodName, Type returnType, Object[] paramList)

at Microsoft.Dynamics.AX.ManagedInterop.Object.Call(String
methodName)

at
Microsoft.Dynamics.Retail.StoreConnect.Request.AXHandler.SCAXTargetRequestHandler.

ProcessTargetRequestHeader(ISCTargetRequestHeader
targetRequestHeader)

--- End of inner exception stack trace ---

at
Microsoft.Dynamics.Retail.StoreConnect.Request.AXHandler.SCAXTargetRequestHandler.

ProcessTargetRequestHeader(ISCTargetRequestHeader
targetRequestHeader)

at CCommMgr.ProcessTargetRequest(CCommMgr*
, basic_string* r_file_path, SCRequestHandlerManager scRequestHandlerManager)







Author: Kim Truelsen

Date: 1/6-2012






Источник: http://blogs.msdn.com/b/axsupport/ar...ing-p-job.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axinthefield: Dynamics Ax 2009 Retail Error Messages & Possible resolutions Blog bot DAX Blogs 0 23.05.2012 11:11
emeadaxsupport: AX for Retail 2012: Store Connect missing mfc100u.dll error Blog bot DAX Blogs 0 25.04.2012 03:18
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
emeadaxsupport: Debugging non-interactive X++ code in Dynamics AX 2009 when running on Windows Server 2008 Blog bot DAX Blogs 0 23.09.2009 13:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 21:03.