Vendor Bank Address in X++ Code and save it in CSV in AX

Hi,

Vendor Bank Address in X++ Code and Save it in CSV in AX

static void Jobs56(Args _args)
{
    VendBankAccount _BankAccount;   
    LogisticsPostalAddress _postalAddress;
    LogisticsLocation  _location;
    Commaio file;
    container line;
    InventTable inventTable;
    #define.filename("C:\\BankAddress.csv")
    #File

    ;
    file = new Commaio(#filename , #io_write); //or  file = new Commaio(#filename , 'W');
    //file.outFieldDelimiter(';');
    if( !file || file.status() != IO_Status::Ok)
    {
        throw error("File Cannot be opened");
    }
    while select * from _BankAccount
       join * from _location
       join _postalAddress
       where _postalAddress.Location == _location.RecId
       && _BankAccount.Location == _location.RecId
     //  && _BankAccount.AccountID=='2'
     //  && _BankAccount.VENDACCOUNT =='TEST0024'
   {
        line = ['Vendor Account - ' + _BankAccount.VENDACCOUNT  + ' Bank Account - ' + _BankAccount.AccountID + " address "+ _postalAddress.Address];
        file.writeExp(line);

    }
 
}

Comments

Post a Comment