Relation between TransTaxInformation table and PurchTable in D365

I need to get Vendor GST number, HSN code and SAC… in D365.

any solution…

Thanks.

public static void main(Args _args)
{
TransTaxInformationRelationView taxRelation;
TransTaxInformation taxInfo;
TaxInformation_IN tax;
PurchLine purchLine;

select purchLine
where purchLine.PurchId == ‘PO-005689’;

select firstonly taxRelation
where taxRelation.TransactionRefRecId == purchLine.RecId
&& taxRelation.TransactionRefTableId == tablenum(PurchLine)
join taxInfo
where taxInfo.RecId == taxRelation.TransTaxInformationRefRecId
join tax
where tax.RecId == taxInfo.VendorTaxInformation;

Info(strFmt(“GST - %1 SAC - %2 HSN - %3”,
TaxRegistrationNumbers_IN::find(tax.GSTIN).RegistrationNumber,
ServiceAccountingCodeTable_IN::find(taxInfo.ServiceAccountingCodeTable).SAC,
HSNCodeTable_IN::find(taxInfo.HSNCodeTable).code));

}

This worked on line level…