<?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=193" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[AxInventTable: Artikel per Code anlegen]]></title>
<description><![CDATA[
<p>Sowohl unter AX3 als auch AX4 gibt es die Klasse <strong>AxInventTable</strong>, mit der sich ganz einfach per Code Artikel anlegen lassen. Leider ist die Klasse in der 3er-Version noch nicht ganz so programmiererfreundlich, deshalb also anbei zwei Code-Beispiele wie diese Klasse in den beiden AX-Version genutzt werden kann.
</p>


<p>Artikel per Code anlegen unter AX4...
</p>


<pre class="pre_blog_axcode">
static void CreateItemAX4(Args _args)
{
    axInventTable   axInventTable;
    ;
    
    axInventTable = new axInventTable();

    // Pflichtfeldverpr&uuml;fung aktivieren
    axInventTable.validateInput(true);  

    // Werte setzen
    axInventTable.parmItemId        (&#39;DL-100-D4&#39;);
    axInventTable.parmItemName      (&#39;Deckenlampe - Silber&#39;);
    axInventTable.parmItemGroupId   (&#39;Lampen&#39;);
    axInventTable.parmModelGroupId  (&#39;DEF&#39;);
    axInventTable.parmDimGroupId    (&#39;Std-Dim&#39;);

    // Datensatz speichern
    axInventTable.save();
} 
</pre>




<p>...und AX3
</p>


<pre class="pre_blog_axcode">
static void CreateItemAX3(Args _args)
{
    axInventTable   axInventTable;
    sysDictTable    sysDictTable = new sysDictTable(tableNum(InventTable));
    int             field;
    boolean         validateField = false;
    ;

    axInventTable = new axInventTable();

    // Werte setzen
    axInventTable.itemId        (&#39;DL-100-D3&#39;);
    axInventTable.ItemName      (&#39;Deckenlampe - Silber&#39;);
    axInventTable.ItemGroupId   (&#39;Lampen&#39;);
    axInventTable.ModelGroupId  (&#39;DEF&#39;);
    axInventTable.DimGroupId    (&#39;Std-Dim&#39;);

    // Pr&uuml;fung der einzelnen Felder
    for(field = 1; field &lt;= sysDictTable.fieldCnt(); field++)
    {
        validateField = axInventTable.inventTable().validateField(field);
    }

    // Datensatz speichern
    if(axInventTable.inventTable().validateWrite() &amp;&amp; validateField)
    {
        axInventTable.save();
    }
}
</pre>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Thu, 31 Jan 2008 19:55:00 +0100</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=193</link>
<comments>https://www.schweda.net/blog_ax.php?bid=193</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=193</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=193</wfw:commentRss>
</item>
<item>
<title>Kommentar von blub</title>
<description><![CDATA[Ich mach das lieber gleich auf tabellenebene (per job) ;)

InventTable inventTable;
;

inventTable.itemId = \'DL-100-D3\'
...

inventTable.insert();

kommt doch aufs gleiche hinaus^^]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Wed, 22 Apr 2009 16:11:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=193</link>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=193</guid>
<author>blub</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=193</wfw:commentRss>
</item>
</channel>
</rss>	
