Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create a production order with x++

1,331 views
Skip to first unread message

jos

unread,
Apr 8, 2008, 2:18:00 AM4/8/08
to
Hi,
is there an easy way to create production orders with x++?
For example: Is there any class with function createProd(itemId _itemId, Qty
_qty)?
How do you create productions?
--
Regards
Joerg

Axel Kühn

unread,
Apr 8, 2008, 5:09:06 AM4/8/08
to
Hi,

you can create production order in a way like this:

static void CreateProd(Args _args)
{
ProdTable prodTable;
InventTable inventTable;
;
inventTable = InventTable::find("YourItemId");

prodTable.initValue();

prodTable.ItemId = inventTable.ItemId;
prodTable.initFromInventTable(inventTable);

prodTable.QtySched = <YourQty>;
prodTable.insert();
}

Hope that hepls you.

--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)

Stefan Ebert

unread,
Apr 11, 2008, 8:21:08 AM4/11/08
to
Hi,

please pay attention, mentioned solution lacks on following:

1) no BOM and route:
User has explicitely to pass it by using:

prodTable.RouteId = inventTable.routeId (dateNull(), myQty);
prodTable.BOMId = inventTable.BOMId (dateNull(), myQty);


2) missing trans data:

I tried prodTable.insert() approach some time ago, but recovered that no
record in InventTrans table will be created.
So I had a look on Form "ProdTableCreate" which uses
"prodTable.insertFromForm(...)" method instead. Unfortunately, those form
contains mixture of methods, event handlers and data sources methods (and
... of course, a gui).


Jörg, did you meantime resolve the problem?

Axel, do you know a "better" encapsulation of the po creation process? I'm
very interested.

--
Ciao,
Stefan Ebert

Axel Kühn

unread,
Apr 11, 2008, 12:05:01 PM4/11/08
to
Hi Stefan,

thank you for the information. This I still do not have noticed. :-(
Sorry for that.

Yes, i think i have a "better" or let my say working solution for creating
production oderers with x++. :-)

I played a litte bit and found this way:

static void CreateProductionOrder(Args _args)
{
ProdQtySched productionQty = 1;
ItemId productionItem = "AKU-1000";

ProdTable prodTable;
InventTable inventTable;
;
inventTable = InventTable::find(productionItem);

//Initialise the base values


prodTable.initValue();
prodTable.ItemId = inventTable.ItemId;
prodTable.initFromInventTable(inventTable);

prodTable.DlvDate = today();

prodTable.QtySched = productionQty;
prodTable.RemainInventPhysical = prodTable.QtySched;

//Set the active bom and route
prodTable.BOMId = BOMVersion::findActive(prodTable.ItemId,
prodTable.BOMDate,
prodTable.QtySched).BOMId;
prodTable.RouteId = RouteVersion::findActive(prodTable.ItemId,
prodTable.BOMDate,
prodTable.QtySched).RouteId;

prodTable.initRouteVersion();
prodTable.initBOMVersion();

//Use ProdTableType class to create the production order
prodTable.type().insert();
}

The code above set the active BOM / Route and also creates the InventTrans
data.

--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)


"Stefan Ebert" wrote:

> Hi,
>
> please pay attention, mentioned solution lacks on following:
>
> 1) no BOM and route:
> User has explicitely to pass it by using:
>
> prodTable.RouteId = inventTable.routeId (dateNull(), myQty);
> prodTable.BOMId = inventTable.BOMId (dateNull(), myQty);
>
>
> 2) missing trans data:
>
> I tried prodTable.insert() approach some time ago, but recovered that no
> record in InventTrans table will be created.
> So I had a look on Form "ProdTableCreate" which uses
> "prodTable.insertFromForm(...)" method instead. Unfortunately, those form
> contains mixture of methods, event handlers and data sources methods (and

> .... of course, a gui).

Stefan Ebert

unread,
Apr 14, 2008, 12:39:21 PM4/14/08
to
Dear Axel,

Respect! Works perfect.

Nicola Garbinato

unread,
Nov 15, 2010, 5:48:58 AM11/15/10
to
Test


>> On Tuesday, April 08, 2008 5:09 AM AxelKh wrote:

>> Hi,
>>
>> you can create production order in a way like this:
>>
>> static void CreateProd(Args _args)
>> {
>> ProdTable prodTable;
>> InventTable inventTable;
>> ;
>> inventTable = InventTable::find("YourItemId");
>>
>> prodTable.initValue();
>>
>> prodTable.ItemId = inventTable.ItemId;
>> prodTable.initFromInventTable(inventTable);
>>
>> prodTable.QtySched = <YourQty>;
>> prodTable.insert();
>> }
>>
>> Hope that hepls you.
>>
>> --
>> Sincerely yours

>> Axel K??hn (visit my Dynamics AX blog at: http://blog.ak-home.net)
>>
>>
>> "jos" wrote:


>>> On Friday, April 11, 2008 8:21 AM Stefan Ebert wrote:

>>> Hi,
>>>
>>> please pay attention, mentioned solution lacks on following:
>>>
>>> 1) no BOM and route:
>>> User has explicitely to pass it by using:
>>>
>>> prodTable.RouteId = inventTable.routeId (dateNull(), myQty);
>>> prodTable.BOMId = inventTable.BOMId (dateNull(), myQty);
>>>
>>>
>>> 2) missing trans data:
>>>
>>> I tried prodTable.insert() approach some time ago, but recovered that no
>>> record in InventTrans table will be created.
>>> So I had a look on Form "ProdTableCreate" which uses
>>> "prodTable.insertFromForm(...)" method instead. Unfortunately, those form
>>> contains mixture of methods, event handlers and data sources methods (and

>>> ... of course, a gui).
>>>
>>>

>>> J?rg, did you meantime resolve the problem?


>>>
>>> Axel, do you know a "better" encapsulation of the po creation process? I'm
>>> very interested.
>>>
>>> --
>>> Ciao,
>>> Stefan Ebert
>>>
>>>

>>> "Axel K?hn" wrote:

>>>> Axel K??hn (visit my Dynamics AX blog at: http://blog.ak-home.net)
>>>>
>>>>
>>>> "Stefan Ebert" wrote:


>>>>> On Monday, April 14, 2008 12:39 PM Stefan Ebert wrote:

>>>>> Dear Axel,
>>>>>
>>>>> Respect! Works perfect.
>>>>>
>>>>> Ciao,
>>>>> Stefan Ebert
>>>>>
>>>>>
>>>>>

>>>>> "Axel K?hn" wrote:


>>>>> Submitted via EggHeadCafe
>>>>> Microsoft .NET DataBase Access For Beginners
>>>>> http://www.eggheadcafe.com/training-topic-area/Microsoft-NET-DataBase-Access/1/SQL-Server-Oracle-DB2-Informix-Query-Samples.aspx

Nicola Garbinato

unread,
Nov 15, 2010, 5:49:56 AM11/15/10
to
TEST

> On Tuesday, April 08, 2008 2:18 AM jo wrote:


>>>>>> On Monday, November 15, 2010 5:48 AM Nicola Garbinato wrote:

>>>>>> Test

Nicola Garbinato

unread,
Nov 15, 2010, 5:50:23 AM11/15/10
to
test

> On Tuesday, April 08, 2008 2:18 AM jo wrote:

>>>>>> Test


>>>>>>> On Monday, November 15, 2010 5:49 AM Nicola Garbinato wrote:

>>>>>>> TEST

0 new messages