Sunday, 4 September 2016

Retrieving Legal Entity Address Based on Purpose Role

Retrieving Legal Entity Address Based on Purpose Role
-------------------------------------------------------------------------------

public  Addressing roleBasedPostalAddressOKN(DirPartyRecId _dirpartyRecid)
{
    DirPartyPostalAddressView           dirPartyPostalAddressView;
    DirPartyLocationRolesView           dirPartyLocationRolesView;
    LogisticsLocationRole               logisticsLocationRole;
    #define.APPOBOX('PurposeRole') //Business/Payment..etc
    ;

    //select firstonly Address from dirPartyPostalAddressView
    //BP Deviation documented
    select firstonly dirPartyPostalAddressView
        exists join dirPartyLocationRolesView
            where dirPartyLocationRolesView.Location == dirPartyPostalAddressView.Location
                && dirPartyLocationRolesView.Party == _dirpartyRecid
        exists join logisticsLocationRole
            where logisticsLocationRole.Name == #APPOBOX
                && logisticsLocationRole.RecId == dirPartyLocationRolesView.LocationRole
                && logisticsLocationRole.IsPostalAddress;

    return dirPartyPostalAddressView.Address;
}

No comments:

Post a Comment