hljs.configure({cssSelector: "code"}); hljs.highlightAll();

Friday, August 4, 2023

Inclusion of Bank Details During Copying Vendor From one LE to Other

Standard functionality allows for copying vendors from one legal entity (LE) to another, but it doesn't include the transfer of bank details. To enhance this, we have customized the vendor copying process to seamlessly incorporate the bank details functionality.

Please find the below code for the same.

[ExtensionOf(classStr(CustVendCopyDataUtil))]
final static class CustVendCopyDataUtil_Extension
{
   //Copy of bank details from one LE to other when copying the vendors 
    protected static void copyVendFormDataSources(VendTable sourceVendor, FormRun vendTableForm, Set datasourceSet, boolean needCreate)
    {
        FormDataSource  vendTable_ds;
        VendTable       vendTableLoc;
        next copyVendFormDataSources(_sourceVendor,_vendTableForm,_datasourceSet,_needCreate);
        vendTable_ds = _vendTableForm.dataSource(formDataSourceStr(VendTable, VendTable)) as FormDataSource;
        vendTableLoc = vendTable_ds.cursor();
        CustVendCopyDataUtil::CopyBankDetailsofVendor(_sourceVendor,vendTableLoc.AccountNum);
    }

    protected static void copyVendTableForVendor(VendTable sourceVendor, FormRun vendTableForm, Set datasourceSet)
    {
        FormDataSource  vendTable_ds;
        VendTable       vendTableLoc;
        next copyVendTableForVendor(_sourceVendor,_vendTableForm,datasourceSet);
        vendTable_ds = _vendTableForm.dataSource(formDataSourceStr(VendTable, VendTable)) as FormDataSource;
        vendTableLoc = vendTable_ds.cursor();
        buf2Buf(_sourceVendor, vendTableLoc);
        vendTable_ds.cursor().data(vendTableLoc);
        datasourceSet.add(vendTable_ds);
    }

    static void CopyBankDetailsofVendor(VendTable vendorTable,VendAccount accountNum)
    {
        VendTable   vendtable;
        VendBankAccount vendBankAccount, vendBankAccountLoc;
        while select  crosscompany * from vendBankAccountLoc
            where vendBankAccountLoc.VendAccount == _vendorTable.AccountNum
                && vendBankAccountLoc.DataAreaId == _vendorTable.DataAreaId
        {
            select vendBankAccount
                where vendBankAccount.VendAccount == vendBankAccountLoc.VendAccount
                    && vendBankAccount.AccountID == vendBankAccountLoc.AccountID;

            if (!vendBankAccount.VendAccount)
            {
                ttsbegin;
                buf2Buf(vendBankAccountLoc, vendBankAccount);
                vendBankAccount.VendAccount = _accountNum;
                vendBankAccount.insert();
                ttscommit;
            }
        }
    }
}

Thanks for reading my blog.

Keep Learning!!

No comments:

Post a Comment