June 20, 2013

Creating Vendors through X++ in AX 2012- PART V

Creating Vendors through X++ in AX 2012- PART V

--Create bank details for the vendor--

private void createBankDetails(WI_VendorRequestCreate          _vendorRequestCreate,
                               VendAccount                     _vendAcc)
{
    VendBankAccount         vendBankAccount;
    LogisticsLocation       lLogisticsLocation;
    LogisticsPostalAddress  logisticsPostalAddress;
    ;
ttsBegin;
    lLogisticsLocation.Description      = _vendorRequestCreate.FirstName;
    lLogisticsLocation.insert();
    logisticsPostalAddress.Street       = _vendorRequestCreate.VendBankAddress;
    logisticsPostalAddress.Address      = _vendorRequestCreate.VendBankAddress;
    logisticsPostalAddress.Location     = lLogisticsLocation.RecId;
    logisticsPostalAddress.insert();
    vendBankAccount.AccountID           = subStr(_vendorRequestCreate.BankAccount,1,10);
    vendBankAccount.Name                = _vendorRequestCreate.BankAccount;
    vendBankAccount.AccountNum          = _vendorRequestCreate.BankAccountNum;
    vendBankAccount.VendAccount         = _vendAcc;
    vendBankAccount.CurrencyCode        = _vendorRequestCreate.CurrencyCode;
    vendBankAccount.BankGroupID         = BankAccountTable::find(vendBankAccount.AccountID).BankGroupId;
    vendBankAccount.Location            = lLogisticsLocation.RecId;
    vendBankAccount.WI_BeneficiaryName  = _vendorRequestCreate.BeneficiaryName;
    vendBankAccount.initFromBankGroup(BankGroup::find(vendBankAccount.BankGroupID));
    vendBankAccount.insert();
ttsCommit;
}

Check below posts for more details


-Harry

No comments:

Post a Comment

Thanks

Note: Only a member of this blog may post a comment.