2016-07-23 31 views
0

我想在字段SalesTable.IntercompanyOriginalCustAccount的客戶的公司間交易中顯示直接交貨的地址。我可以得到客戶記錄,我需要顯示該客戶的地址。但是,當我更改客戶地址時,以下代碼返回的地址爲空。如何顯示公司間客戶的郵政地址?

display public LogisticsAddressing getAlamat() 
{ 
    CustTable     custTable; 
    DirPartyTable    dirPartyTable; 
    LogisticsPostalAddress  logisticsPostalAddress; 
    LogisticsAddressing   alamat; 
    CustAccount     intercompanyCust = this.InterCompanyOriginalCustAccount; 

    alamat = ""; 
    changeCompany('ma-d') 
    { 
     while select firstOnly custTable 
       order by logisticsPostalAddress.RecId desc 
       where intercompanyCust == custTable.AccountNum 
      join dirPartyTable 
       where dirPartyTable.RecId == custTable.Party 
      join logisticsPostalAddress 
       where logisticsPostalAddress.location == dirPartyTable.PrimaryAddressLocation 
        //&& logisticsPostalAddress.recVersion == 1 
     { 
      alamat=logisticsPostalAddress.Address; 
     } 
    } 
    return alamat; 
} 

回答

1

我不知道這是否符合你的要求,但看看錶CustTablepostalAddress方法。使用此代碼,您的代碼可能如下所示:

display public LogisticsAddressing getAlamat() 
{ 
    CustTable     custTable; 
    LogisticsPostalAddress  logisticsPostalAddress; 
    LogisticsAddressing   alamat; 

    changeCompany(this.InterCompanyCompanyId) 
    { 
     custTable = CustTable::find(this.InterCompanyOriginalCustAccount); 
     logisticsPostalAddress = custTable.postalAddress(); 
     alamat = logisticsPostalAddress.Address; 
    } 
    return alamat; 
} 
相關問題