Skip to Content
0
Former Member
Jan 24, 2011 at 11:04 AM

Creating UserTables usind DI API on MSSQL 2008.

21 Views

Hey experts,

I already searched almost the whole forums, but I did not find any solution for my problem.

I want to create a user table from the DI API, but for some reason SAP does not execute my request. Basicly I am creating this user table from a transaction. Everytime I call an operation over the user table instance it returns

Error -1121: MetaData operations are not supported when a user transaction is active

My code looks something like this:

oCompany.StartTransaction();
UserTablesMD oUserTables = oCompany.GetBusinessObject(BoObjectTypes.oUserTables) as UserTablesMD;
int iRet = 0;

// Check, if the table already exists
if (!oUserTables.GetByKey(m_strName))
{
	// In case the table does not yet exist add it
	oUserTables.TableName = m_strName;
	oUserTables.TableType = m_oType;
	oUserTables.TableDescription = m_strDescription;

	// Add the table
	iRet = oUserTables.Add();
}
else
{
	// In case it exists do only update it
	oUserTables.TableType = m_oType;
	oUserTables.TableDescription = m_strDescription;

	// Update the table
	iRet = oUserTables.Update();
}

if (iRet != 0)
{
	// Log things, exception handling, ...
	// Note: iRet is -1121 for both cases!
}
else if (oCompany.InTransaction)
{
	oCompany.EndTransaction(BoWfTransOpt.wf_Commit);
}

The problem apparently is not caused by some specific patch-level, but it only occured on MSSQL 2008 servers.

I hope you have got any suggestions! Thank you all,

- Carsten.