Pages

Banner 468 x 60px

 

Wednesday, November 22, 2017

Create Find Methode using x++

0 comments
Create Find Methode using x++ :
static public InventDim find(
    InventDimId _inventDimId,
    boolean     _forupdate = false)
{
    InventDim inventDim;

    if (_inventDimId)
    {
        if (_forupdate)
        {
            inventDim.selectForUpdate(_forupdate);
        }

        select firstonly inventDim
            where inventDim.InventDimId  == _inventDimId;
    }

    return inventDim;
}

static public InventLocation BIT_find_NamaGudang(
    Inventlocationid    _InventlocationId,
    boolean             _forupdate = false)
{
    InventLocation  _InventLocation;
    if(_InventlocationId)
    {
        if(_forupdate)
        {
            _InventLocation.selectForUpdate(_forupdate);
        }

        select firstOnly _InventLocation
            where _InventLocation.InventLocationId == _InventlocationId;
    }
    return _InventLocation;
}


static SalesLine findInventTransId(TradeInventTransId _transId,
                                   boolean            _update = false )
{
    SalesLine salesLine;

    if (_transId)
    {
        if (_update)
        {
            salesLine.selectForUpdate(_update);
        }

        select firstonly salesLine
            index hint TransIdIdx
            where salesLine.InventTransId == _transId;
    }

    return salesLine;
}

static RUM_MasterProjectLines findItemID(
        ItemIdInventoried _ItemIdInventoried,
        boolean             _update = false)
{
    RUM_MasterProjectLines  _RUM_MasterProjectLines;

    if(_ItemIdInventoried)
    {
        if(_update)
        {
            _RUM_MasterProjectLines.selectForUpdate(_update);
        }

        select firstOnly _RUM_MasterProjectLines
            index hint ItemNumberIdx
            where _RUM_MasterProjectLines.ItemNumber == _ItemIdInventoried;
    }

    return _RUM_MasterProjectLines;
}


Example :

Gudang      = Inventdim::find(_vendPackingSlipTrans.InventDimId).InventLocationId;
Nama_Gudang = InventLocation::BIT_find_NamaGudang(Inventdim::find(_vendPackingSlipTrans.InventDimId).InventLocationId).Name;


0 comments:

A financial dimension value is based on the LAND-00013 record and has been used on a transaction. You cannot delete the LAND-00013 record AX 2012

 A financial dimension value is based on the LAND-00013 record and has been used on a  transaction. You cannot delete the LAND-00013 record ...