X++ code for getting "BusinessUnit" Address based on "OmOperatingUnitNumber" & "OmOperatingUnitType" in D365 F&O || Ax 2012

Hi everyone, 

The blow code snippet is used to get the Business unit address based on OmOperationUnitNumber and OmOperationUnitType.

static void getBusinessUnitaddress(Args _args)
{
    OMOperatingUnit   operatingUnits;

    select firstOnly * from operatingUnits
        where operatingUnits.OMOperatingUnitNumber  == "047" && // operating unit number
        operatingUnits.OMOperatingUnitType          == OMOperatingUnitType::RetailChannel; // operating type

    info(strFmt("%1",operatingUnits.primaryAddress()));
}

Proud To Be a DAX Developer :-)