Dynamics AX Blog - Posts from 2014

These posts are machine-translated.
Currently, only posts from »2014« are displayed

Check/Post a picking list journal for a production order

Below is a sample of X++ code which can be used to check or post a picking list journal for a production order. Changing the value of the Enum JournalCheckPostType controls if the journal is checked or checked and posted.

static void checkPostProdJournalTablePickingList(Args _args)
{
    JournalCheckPost journalCheckPost;
    ProdJournalTable prodJournalTable = ProdJournalTable::find("00943", true);

    // Check/Post journal
    journalCheckPost = ProdJournalCheckPostBOM::newJournalCheckPost(false,
                                                                    true,
                                                                    JournalCheckPostType::Check,
                                                                    prodJournalTable.TableId,
                                                                    prodJournalTable.JournalId);
    journalCheckPost.run();
}

 
 
 

Check/Post a route card journal for a production order

Below is a sample of X++ code which can be used to check or post a route card journal for a production order. Changing the value of the Enum JournalCheckPostType controls if the journal is checked or checked and posted.

static void checkPostProdJournalTableRoute(Args _args)
{
    JournalCheckPost journalCheckPost;
    ProdJournalTable prodJournalTable = ProdJournalTable::find("00943", true);

    // Check/Post journal
    journalCheckPost = ProdJournalCheckPostRoute::newJournalCheckPost(false,
                                                                    true,
                                                                    JournalCheckPostType::Check,
                                                                    prodJournalTable.TableId,
                                                                    prodJournalTable.JournalId);
    journalCheckPost.run();
}

 
 
 

Check/Post a job card journal for a production order

Below is a sample of X++ code which can be used to check or post a job card journal for a production order. Changing the value of the Enum JournalCheckPostType controls if the journal is checked or checked and posted.

static void checkPostProdJournalTableRouteJob(Args _args)
{
    JournalCheckPost journalCheckPost;
    ProdJournalTable prodJournalTable = ProdJournalTable::find("00943", true);

    // Check/Post journal
    journalCheckPost = ProdJournalCheckPostRouteJob ::newJournalCheckPost(false,
                                                                    true,
                                                                    JournalCheckPostType::Check,
                                                                    prodJournalTable.TableId,
                                                                    prodJournalTable.JournalId);
    journalCheckPost.run();
}

 
 
 

Reporting a production order as finished

Below is a sample of X++ code which can be used to check or post a report as finished journal for a production order. Changing the value of the Enum JournalCheckPostType controls if the journal is checked or checked and posted.

static void checkPostProdJournalTablePostProd(Args _args)
{
    JournalCheckPost journalCheckPost;
    ProdJournalTable prodJournalTable = ProdJournalTable::find("00943", true);

    // Check/Post journal
    journalCheckPost = ProdJournalCheckPostProd::newJournalCheckPost(false,
                                                                    true,
                                                                    JournalCheckPostType::Check,
                                                                    prodJournalTable.TableId,
                                                                    prodJournalTable.JournalId);
    journalCheckPost.run();
}

 
 
 

Use a specific dimension as a dialogfield

If you want to use a particular dimension as a dialog field in Dynamics AX 2009 (or earlier versions), you can create your own Extended Data Type (derived from Criterias) as described below. The decisive factors are the relations of this EDT.

In the example, the cost center is to be offered as a dialog field.

Screenshot EDT

The example code was taken from a class which extends runBase.


 
 
 

AX 2012: Building a DefaultDimension/LedgerDimension

Below you'll find a code example of how to generate a RecId of type DefaultDimension for several dimensions.
Subsequently, these DefaultDimension is combined with a main account to RecId of type LedgerDimension.

static void buildDefaultAndLedgerDimension(Args _args)
{
    DimensionAttributeValueSetStorage dimensionAttributeValueSetStorage;
    DimensionAttribute dimensionAttribute;
    DimensionAttributeValue dimensionAttributeValue;
    DimensionDefault dimensionDefault;
    LedgerDimensionAccount ledgerDimensionAccount;

    dimensionAttributeValueSetStorage = new DimensionAttributeValueSetStorage();

    // BusinessUnit
    dimensionAttribute = DimensionAttribute::findByName('BusinessUnit');
    if(dimensionAttribute)
    {
        dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, '069', false, true);
        dimensionAttributeValueSetStorage.addItem(dimensionAttributeValue);
    }

    // CostCenter
    dimensionAttribute = DimensionAttribute::findByName('CostCenter');
    if(dimensionAttribute)
    {
        dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, '010', false, true);
        dimensionAttributeValueSetStorage.addItem(dimensionAttributeValue);
    }

    // Department
    dimensionAttribute = DimensionAttribute::findByName('Department');
    if(dimensionAttribute)
    {
        dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, '024', false, true);
        dimensionAttributeValueSetStorage.addItem(dimensionAttributeValue);
    }
 
    dimensionDefault = dimensionAttributeValueSetStorage.save();

    // Merge main account and source dimension values and return RecId which can be used as ledgerDimension
    ledgerDimensionAccount = DimensionDefaultingService::serviceCreateLedgerDimension(DimensionStorage::getDefaultAccountForMainAccountNum("110110"),
                                                                                      dimensionDefault);

    info(strFmt("Default dimension recId: %1", dimensionDefault));
    info(strFmt("DefaultDimension (Source RecId): %1 LedgerDimension (Merged RecId): %2", dimensionDefault, ledgerDimensionAccount));
}

 
 
 

Create a picking list-header for production order

The following job creates a "header" for a picking list for a production order.

static void createProdJournalTable_PickingList_III(Args _args)
{
    ProdJournalCreate prodJournalCreate;

    prodJournalCreate = new ProdJournalCreate();

    prodJournalCreate.parmProdId('P000188');
    prodJournalCreate.parmJournalNameId(
        ProdJournalName::standardJournalName(
            ProdJournalType::Picklist, 
            prodJournalCreate.parmProdId()));
    prodJournalCreate.initProdJournalTableData(ProdJournalType::Picklist);

    prodJournalCreate.usedProdJournalTable().insert();

    prodJournalCreate.run();
}

 
 
Pages 1 2 3 4 ... 7 » 

 

 
 
 
Posts of the actual month
April 2014
MoTuWeThFrSaSu
 123456
78910111213
14151617181920
21222324252627
282930 
 
© 2006-2025 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.