Dynamics AX Blog

These posts are machine-translated.

Entry "RPC exception 1702 occurred" in the event log

Object Server 01:  RPC error: RPC exception 1702 occurred in session 4 process is Ax32Serv.exe thread is 8788(User: admin, ClientType: Worker)

This entry may indicate the use of client-side code on the server, such as calling a WinApi function from a batch job.

It can also be triggered by calling info(), Warning() or error() within a batch job, if the option "Enable global breakpoint" is enabled at the respective AOS.

Screenshot AX 2012 Server Configuration Utility


 
 
 

SQL error when synchronizing after updating from AX 2012 to CU13

During the upgrade of an AX 2012 R3 CU9 instance to CU13 (February release) I had the following error at the point Synchronize database of the upgrade checklist:

SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.LEDGERPERIODMODULEACCESSCONTROL' and the index name 'I_7375LEDGERFISCALCALENDARPERIODIDX'. The duplicate key value is (5637144576, 22565421332).

SQL statement: CREATE UNIQUE  INDEX I_7375LEDGERFISCALCALENDARPERIODIDX ON "DBO".LEDGERPERIODMODULEACCESSCONTROL (PARTITION,LEDGERFISCALCALENDARPERIOD)

The solution is to leave this error for now and start with the next step of the checklist, the data upgrade. One of the jobs to be executed cleans up the data records that lead to the error.

After the data upgrade, the database can now be synchronized without errors.

Screenshot
 


 
 
 

SysOperation-Framework: Controlling ExecutionMode and server method to be executed using the MenuItem

If you want to control the SysOperationExecutionMode and/or the server method to be executed via the MenuItem in a SysOperation construct, you can control this via the properties of the MenuItem.

Scenario: Without own controller

The following two MenuItems show how to set the properties for them:

This MenuItem calls the runService() method of a service class and sets the SysOperationExecutionMode to Synchronous:

Screenshot


 
 
 

SysOperation-Framework: Force Batch Processing

If you want to make sure that a function implemented via the SysOperation-framework is always executed via batch processing, you can set the SysOperationExecutionMode to ScheduledBatch (e.g. via the MenuItem of the controller - see here).

If this is a function that requires a user dialog, however, the problem is that the "Batch" tab is displayed by default and, for example, the "Batch" check box is not activated there.

Of course you can activate this checkbox by including a call to parmBatchExecute() in the UIBuilder:

public void build()
{
    super();

    this.controller().batchInfo().parmBatchExecute(this.controller().parmExecutionMode() == SysOperationExecutionMode::ScheduledBatch);
}

 
 
 

Creating and posting a free text invoice by code

The following job shows how to create and post a free text invoice by code.

static void createAndPostFreeTextInvoice(Args _args)
{
    CustInvoiceTable custInvoiceTable;
    CustInvoiceLine custInvoiceLine;
    DimensionDefault dimensionDefault; 
    LedgerDimensionAccount ledgerDimensionAccount;     
    CustPostInvoice custPostInvoice;
    
    try
    {
        ttsBegin;        
        
        // Create header
        custInvoiceTable.clear();
        custInvoiceTable.initValue();
        custInvoiceTable.OrderAccount = "US-004";
        custInvoiceTable.modifiedField(
            fieldNum(CustInvoiceTable, OrderAccount));
        custInvoiceTable.insert();
        
        // Create line
        custInvoiceLine.clear();
        custInvoiceLine.initValue();
        custInvoiceLine.ParentRecId = custInvoiceTable.RecId;
        custInvoiceLine.initFromCustInvoiceTable(custInvoiceTable);
        custInvoiceLine.Description = "Test";
        custInvoiceLine.Quantity = 10;
        custInvoiceLine.modifiedField(
            fieldNum(CustInvoiceLine, Quantity));
        custInvoiceLine.UnitPrice = 200;
        custInvoiceLine.modifiedField(
            fieldNum(CustInvoiceLine, UnitPrice));
        
        ledgerDimensionAccount = 
        DimensionDefaultingService::serviceCreateLedgerDimension(
            DimensionStorage::getDefaultAccountForMainAccountNum(
                "110110"), 
                dimensionDefault); 
        
        custInvoiceLine.LedgerDimension = ledgerDimensionAccount;
        custInvoiceLine.modifiedField(
            fieldNum(CustInvoiceLine, LedgerDimension));
        custInvoiceLine.insert();
        
        // Post
        custPostInvoice = new CustPostInvoice(custInvoiceTable);
        custPostInvoice.run();
        
        ttsCommit;
    }
    catch
    {
        throw error(error::wrongUseOfFunction(funcName()));
    }
}

This is what a free text invoice looks like:

Screenshot Freetext invoice


 
 
 

Debugging SSRS-Dataprovider which extends SrsReportDataProviderPreProce

In Debugging SSRS-Dataprovider I have already described how to "debug" a DataProvider derived from SRSReportDataProviderBase.

The following job basically does the same, but for preprocessed reports, where the DataProvider is derived from SrsReportDataProviderPreProcess. In the example, I use the DataProvider of an invoice (SalesInvoice).

static void testSSRSDataProvider_SalesInvoice(Args _args)
{
    SalesInvoiceTmp salesInvoiceTmp;
    SalesInvoiceDP dataProvider = new SalesInvoiceDP();
    SalesInvoiceContract contract;
    CustInvoiceJour CustInvoiceJour = CustInvoiceJour::findRecId(35637191172);
    UserConnection UserConnection;

    try
    {
        ttsBegin;

        UserConnection = new UserConnection();

        contract = new SalesInvoiceContract();
        contract.parmFormLetterRecordId(CustInvoiceJour.RecId);
        contract.parmRecordId(CustInvoiceJour.RecId);

        dataProvider = new SalesInvoiceDP();
        dataProvider.parmDataContract(contract);
        dataProvider.parmUserConnection(UserConnection);
        dataProvider.processReport();

        salesInvoiceTmp = dataProvider.getSalesInvoiceTmp();
        
        while select salesInvoiceTmp
            where SalesInvoiceTmp.createdTransactionId == appl.curTransactionId()
        {
            info(strFmt("%1 %2", SalesInvoiceTmp.InvoiceId, SalesInvoiceTmp.ItemId));
        }

        ttsCommit;
    }
    catch (Exception::Break)
    {
        info("Aborted");
    }
}

 


 
 
 

Pick a reserved sales order line by code

To pick the quantities already reserved from an sales order item by code, you can use codes such as the following:

static void JobPick(Args _args)
{
    Query inventTransQuery;
    QueryRun qr;
    QueryBuildDataSource qbds;
    InventTrans inventTrans;
    InventDim inventDim;
    InventTransOrigin inventTransOrigin;
    TmpInventTransWMS tmpInventTransWMS;
    InventTransWMS_Pick inventTransWMS_Pick;
    SalesLine salesLine = SalesLine::findInventTransId('014417');
    
    inventTransQuery = new Query();
    qbds = inventTransQuery.addDataSource(tableNum(InventTrans));
    qbds.addRange(fieldNum(InventTrans, StatusIssue)).value(queryValue(StatusIssue::ReservPhysical));
    qbds = qbds.addDataSource(tableNum(InventTransOrigin));
    qbds.relations(true);
    qbds.joinMode(JoinMode::InnerJoin);
    qbds.addRange(fieldNum(InventTransOrigin, InventTransId)).value(salesLine.InventTransId);
    
    qr = new QueryRun(inventTransQuery);
    while (qr.next())
    {
        inventTrans = qr.get(tableNum(InventTrans));
        inventTransOrigin = qr.get(tableNum(InventTransOrigin));
        
        // Set inventory dimensions for picking
        inventDim = inventDim::find(inventTrans.InventDimId);
        inventDim.wmslocationId = "06A01R3S1B";   
        inventDim.LicensePlateId = "LP_61_A0001";
        inventDim = inventDim::findOrCreate(inventDim);
        
        tmpInventTransWMS.clear();
        
        inventTransWMS_Pick = InventTransWMS_Pick::newStandard(tmpInventTransWMS, inventTransQuery);
        
        tmpInventTransWMS.initFromInventTrans(InventTrans);
        tmpInventTransWMS.initFromInventTransOrigin(inventTransOrigin);
        tmpInventTransWMS.initFromInventDim(inventDim);
        
        tmpInventTransWMS.InventQty = -inventTrans.Qty;
        
        inventTransWMS_Pick.writeTmpInventTransWMS(tmpInventTransWMS);
        inventTransWMS_Pick.updateInvent();    
    }
}

 
 
Pages 1 2 3 4 ... 22 » 

 

 
 
 
Posts of the actual month
Oktober 2019
MoTuWeThFrSaSu
 123456
78910111213
14151617181920
21222324252627
28293031 
 
© 2006-2019 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.