Thursday, February 21, 2008

EDI: Table passed to EDI_SEGMENTS_ADD_BLOCK is empty.

The error "EDI: Table passed to EDI_SEGMENTS_ADD_BLOCK is empty"* was thrown by the SAP .NET connector after sending an IDoc to SAP. The reason was that we've set data fields inside the EDI_DC40 element that SAP had to fill on its own, such as
  • DOCNUM
  • CREDAT
  • CRETIM
  • RCVPOR
  • SNDPOR
  • DOCNUM from the DATAHEADERREC element
Now, we are leaving these empty, and the IDoc can be received by SAP.

Thus, if you get the same error, check which fields you should set, and which SAP should set on its own.

----------
* in German SAP systems: "EDI: Die an EDI_SEGMENTS_ADD_BLOCK übergebene Tabelle ist leer"

Wednesday, February 20, 2008

Short Installation guide to integrate SAP-BizTalk connectivity in Visual Studo 2005

To integrate SAP connectivity into BizTalk 2006 R2 and Visual Studio 2005, you have to follow these steps:

1. Install the runtime version of SAP .NET Connector (NCO) for Visual Studio v1.0.x which is a prerequisite for (2) - you can download the connector from the SAP Marketplace Web site.

2. Install BizTalk Adapter v2.0 for mySAP Buesiness Suite which is available here: https://www.ms2.cn/downloads/details.aspx?FamilyId=7DBF88DE-8C23-4B25-A389-D5ACF1B1FCBE&displaylang=en

3. Install the adapter's Service Pack 1 and ignore the obsolete Error 6000-message by clicking "OK".

Monday, February 4, 2008

Using BizTalk's command xpath(msg,string) correctly

If you want to use BizTalk's xpath()-method in an Expression shape of Visual Studio's BizTalk Orchestration designer, you have to think of the return of the xpath carefully.

If you use the following:

[string] s = xpath(msg1, "/*[local-name()='Root' and namespace-uri()='http://TestBiztalkXPathCommand.Schema1'] /*[local-name()='name' and namespace-uri()='']")

to get the value at node "name", you'll receive the following error while running the orchestration:

...
Inner exception: There is an error in the XML document.
Exception type: InvalidOperationException
Source: System.Xml
[...]
Additional error information:
was not expected.
[...]
Target Site: System.Object Read_string()



The reason is that this XPath statements navigates to an XML node and, thus, an object of the class System.Xml.XmlNode is returned (and not a String). Since the XPath statement is not analyzed while building the DLL, the error occurs while running primary.

Thus, you should add /text() to your XPath statement, so that a string is returned. In this case, the following would work successfully:

[string] s = xpath(msg1, "/*[local-name()='Root' and namespace-uri()='http://TestBiztalkXPathCommand.Schema1'] /*[local-name()='name' and namespace-uri()='']/text()")


Charles Young's blogpost on xpath() was helpful to fix this problem.

Addition (June 3, 2008) : My colleague Christian found out that you should invoke some mysterious "string()"-method inside the xpath statement:

xpathExpression = "/*[local-name()='Root' and namespace-uri()='http://TestBiztalkXPathCommand.Schema1'] /*[local-name()='name' and namespace-uri()='']";
[string] s = xpath(msg1, "string(" + xpathExpression + "/text())")

Thus, you get less XPath errors (I don't know yet how that exactly works; but I know that string(...) is not an XPath expression).

Using CASE in SQL Queries

This morning, I've got to know the CASE functionality of SQL Server (which surely exists in other databases, too). With CASE you can set values for a column under specified conditions, e.g.

SELECT
Column1,
Column2 = CASE
WHEN Column1 = '1' THEN 'Y'
ELSE 'N'
END
FROM Table1

Thus, column2 will be set with 'Y' if column1 has the value '1'; otherweise 'N' will be set.

PS: An overview by Craig S Mullins helps to understand this method in more detail.

Wednesday, January 30, 2008

Visual Studio throws error while building: The process cannot access the file as it is being used by another process.

The error "The process cannot access the file as it is being used by another process." is thrown by Visual Studio (here 2005) if an assembly, that is used by the building process, is blocked by another process.

A useful program to find the blocking process is Process Explorer (v11.04). Furthermore, you should check other sessions on the development system and, also, other machines that could have the same solution opened remotely.

Monday, December 17, 2007

Shrinking SQL Server Log file

The logfile of the BizTalk Server Message Box database (BiztalkMsgBoxDb) is rapidly growing if you the recovery model is set to "full".

At first you should try this (taken from here):


ALTER DATABASE BiztalkMsgBoxDb
SET RECOVERY SIMPLE;
GO

DBCC SHRINKFILE (BiztalkMsgBoxDb_log, 1);
GO

ALTER DATABASE BiztalkMsgBoxDb
SET RECOVERY FULL;
GO


In some cases you're not able to shrink this file.
This may refer to some dead processes and unfinished transactions.

Your can check for the oldest transactions using:

DBCC OPENTRAN ('BizTalkMsgBoxDb')

If you find a very old transaction there you may kill the PID with the Acitvity Monitor of the SQL Server Studio.
Repeat the last two steps until all old transactions are disappeared.
Finally do
BACKUP LOG BizTalkMsgBoxDb WITH TRUNCATE_ONLY

DBCC Shrinkfile ('BizTalkMsgBoxDb_log',2)
(where "2" is the targeted Logfile size)

and enjoy the new log sizes.

Monday, November 19, 2007

Error message can be found in BizTalk's Message Flow window

Sometimes it seems like BizTalk is trying to hide error messages. So, if you can't find any sufficient message neither at the suspended instances nor in the event viewer, here is another source of information:

BizTalk's Message Flow Window

1. Open the Message Flow using the instance's context menu of HAT or Administration Console
2. Use the link "Show tracked Orchestration Exceptions".

This will show you an error text, which actually explains the error. :-)

Monday, November 12, 2007

Error: BizTalk receives"empty" messages from WebService

Biztalk could receive "empty" messages from the Web Service, as it is deployed. Empty in this case means that the message looks like this:

<?xml version="1.0"?>
<account xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" xmlns="http://schemas.microsoft.com/crm/2006/WebServices" />

As you can see, only the root element "account" was given (so it's not really empty).

However, the system that invokes the Web Service is definitly setting the input parameters.

This happens, if the input schema of the orchestration is changed, but the Web Service is not created and deployed afterwards (e.g. using Visual Studio's wizard). Then, the out-dated Web Service receives unexpected parameters and passes only the root node to BizTalk.

Thursday, October 11, 2007

Workaround for the BizTalk 2006/CRM Problem stating "Error in XML document (2, 2)"

After upgrading from BizTalk 2004 to BizTalk 2006, an error occured when receiving an error from the CRM WebService saying that there is an "Error in XML document (2, 2)".

The message received by the orchestration changed, as the namespace was now given (the red part has not been given in BizTalk 2004):

<?xml version="1.0" ?>
<guid xmlns="http://schemas.microsoft.com/crm/2006/WebServices" >E4096CF2-2777-DC11-B068-001A4BAF607E</guid>


And, the namespace http://schemas.microsoft.com/crm/2006/WebServices indeed does not have a root name entry for "guid" (as you can see in the Administration Console/Application X/Schema).

I unfortunately don't know the reason for this, but, at least, we found a work around: We wrote a CRM wrapper, that encapsulates the functionality of envocing the CRM Web Service. This wrapper is published as a Web Service that receives exactly the same object BusinessEntity like the CRM Web Service does. Than it invokes the CRM Web Services and returns the GUID. BizTalk than has no problem taking this GUID and work furtheron.

Monday, October 1, 2007

HAT error: ActiveView.ColumnAxis is null or not an object

When opening the BizTalk HAT, the following error occurs, if you have not installed Office XP's Web Components.



Install it from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=982B0359-0A86-4FB2-A7EE-5F3A499515DD&displaylang=en