Thursday, October 4, 2018

How to write OData Action Method?

[SysODataActionAttribute('updateShipmentDate', false)]
    public static void updateShipmentDate(DataAreaId _company, WHSShipmentId _ShipmentId, WHSShipConfirmUTCDateTime _ShipmentDate)
    {
        #OCCRetryCount;
        WHSShipmentTable whsShipmentTable;

        try
        {
        changecompany(_company)
            {
                select firstonly forupdate whsShipmentTable
                where whsShipmentTable.ShipmentId == _ShipmentId;
     
                if (whsShipmentTable.RecId)
                {
                    ttsbegin;
                    whsShipmentTable.ShipConfirmUTCDateTime =_ShipmentDate;
                    if(WHSShipmentTable.validateWrite())
                    {
                        whsShipmentTable.update();
                    }
                    ttscommit;
                }
            }
        }
        catch (Exception::UpdateConflict)
        {
            if (appl.ttsLevel() == 0)
            {
                if (xSession::currentRetryCount() >= #RetryNum)
                {
                    throw Exception::UpdateConflictNotRecovered;
                }
                else
                {
                    retry;
                }
            }
            else
            {
                throw Exception::UpdateConflict;
            }
        }
     
    }

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// ...