<?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://www.schweda.net/blog_rss.php?bid=342" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[Erstellen und Buchen eines Umlagerungsjournal in AX 2009]]></title>
<description><![CDATA[
<p>Nachstehend ein Codebeispiel, wie man in Dynamics AX 2009 per X++ ein Umlagerungsjournal erstellen und buchen kann.
</p>


<pre class="pre_blog_axcode">
static void createAndPostInventJournalTransfer(Args _args)
{
    inventJournalTable  inventJournalTable;
    inventJournalTrans  inventJournalTrans;
    journalCheckPost    journalCheckPost;
    
    itemId              _itemId             = &quot;1000&quot;;
    qty                 _qty                = 1;
    inventDimId         _fromInventDimId    = &quot;00000070_069&quot;;
    inventDimId         _toInventDimId      = &quot;00000063_069&quot;;
    ;

    try
    {
        ttsbegin;

        // Create header
        inventJournalTable.clear();
        inventJournalTable.initValue();

        inventJournalTable.initFromInventJournalName(
            InventJournalName::find(InventJournalName::standardJournalName(InventJournalType::Transfer)));

        inventJournalTable.SystemBlocked    = NoYes::Yes;
        inventJournalTable.BlockUserId      = curUserId();

        inventJournalTable.insert();

        // Create lines
        inventJournalTrans.clear();

        inventJournalTrans.initValue();
        inventJournalTrans.initFromInventJournalTable(inventJournalTable);

        inventJournalTrans.ItemId           = _itemId;
        inventJournalTrans.initFromInventTable(inventTable::find(inventJournalTrans.ItemId));

        inventJournalTrans.Qty              = _qty;

        inventJournalTrans.inventMovement().journalSetCostPrice();

        inventJournalTrans.inventDimId      = _fromInventDimId;
        inventJournalTrans.toinventDimId    = _toInventDimId;

        inventJournalTrans.voucher          = numberSeq::newGetVoucherFromCode(
                                                    InventJournalName::find(inventJournalTable.JournalNameId).VoucherSeqId).voucher();

        inventJournalTrans.insert();

        // Post journal
        journalCheckPost = InventJournalCheckPost::newJournalCheckPost(JournalCheckPostType::Post, inventJournalTable);
        journalCheckPost.run();

        ttscommit;
    }
    catch (Exception::Error)
    {
        throw exception::Error;
    }
}

</pre>


<p>Mit der einen oder anderen Anpassung sollte es auch m&ouml;glich sein, Journale anderer Typen auf &auml;hnliche Art &amp; Weise zu erstellen.
</p>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Fri, 25 Sep 2009 08:50:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=342</link>
<comments>https://www.schweda.net/blog_ax.php?bid=342</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=342</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=342</wfw:commentRss>
</item>
</channel>
</rss>	
