<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="https://www.schweda.net/style_feed.css" ?>
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:atom="http://www.w3.org/2005/Atom"	
	xmlns:dc="http://purl.org/dc/elements/1.1/" > 
<channel>
    <title>schweda.net - Blog</title>
    <link>https://www.schweda.net/</link>
    <description>schweda.net - Blog - Blog-Beitraege</description>
    <language>de-at</language>
    <copyright>Copyright 2006-2026</copyright>
    <generator>schweda.net</generator>
    <managingEditor>heinz.schweda@schweda.net (Heinz Schweda)</managingEditor>
    <webMaster>heinz.schweda@schweda.net (Heinz Schweda)</webMaster>
    <category>Blog</category>
	<atom:link href="https://schweda.net/blog_rss.php?bid=645" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[Kostenstelle per Code anlegen]]></title>
<description><![CDATA[
<p>Wer mal in die Verlegenheit kommt, eine Kostenstelle per Code anlegen zu m&uuml;ssen, dem kann vielleicht dieser Job als Inspiration dienen:
</p>


<pre class="pre_blog_axcode">
static void createCostCenter(Args _args)
{
    str 30 _costCenter = &quot;0815&quot;; // Cost center id to create

    OMOperatingUnit omOperatingUnit;
    NumberSeqFormHandler numberSeqFormHandler;
    NumberSeq numberSeq;

    if (_costCenter)
    {
        if (!OMOperatingUnit::findName(
            _costCenter, OMOperatingUnitType::OMCostCenter))
        {
            ttsbegin;
            numberSeq = NumberSeq::newGetNumFromId(
                OMOperatingUnit::getNumberSequenceReference().NumberSequenceId);

            omOperatingUnit.clear();

            omOperatingUnit.initValue();
            omOperatingUnit.omOperatingUnitNumber = numberSeq.num();
            omOperatingUnit.Name = _costCenter;    // Id used as name
            omOperatingUnit.NameAlias = _costCenter;
            omOperatingUnit.omOperatingUnitType = OMOperatingUnitType::OMCostCenter;
            omOperatingUnit.LanguageId = CompanyInfo::languageId();

            if (omOperatingUnit.validateWrite())
            {
                omOperatingUnit.insert();
            }
            ttscommit;
        }
    }
}
</pre>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Mon, 05 Nov 2018 22:01:00 +0100</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=645</link>
<comments>https://www.schweda.net/blog_ax.php?bid=645</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=645</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=645</wfw:commentRss>
</item>
</channel>
</rss>	
