Getting Vendor addresses based on Address type in AX 2012 R2/R3

The following query gets the vendor addresses

 select ROW_NUMBER() over (partition by v.accountNum order by dpl.isprimary desc, lpa.recid) as AddressNumber,v.ACCOUNTNUM,lpa.ADDRESS,llr.NAME from VENDTABLE V
 join DIRPARTYLOCATION Dpl on v.party=dpl.party  and dpl.ISPOSTALADDRESS=1
 join LOGISTICSPOSTALADDRESS lpa on dpl.LOCATION=lpa.LOCATION  
 join DIRPARTYLOCATIONROLE dplr on dplr.PARTYLOCATION=Dpl.RECID
 join LOGISTICSLOCATIONROLE llr on dplr.LOCATIONROLE=llr.RECID
 where llr.TYPE=10 — Can be any type as per requirement

Advertisements
This entry was posted in Microsoft Dynamics AX. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s