static void
SK_CreateVendorandupdateVendorAddres(Args _args)
{
VendTable
vendtable;
AccountNum
accountNum = 'Alex10';
VendGroupId
vendGroupId = '10';
Name
name = 'ABC';
DirParty
dirParty;
DirPartyPostalAddressView
dirPartyPostalAddressView;
CustTable
CustTable;
DirPartyType partytype;
DirPartyTable
dirpartytable;
DirPersonName
dirpersonname;
Vendtable =
Vendtable::find(accountNum);
if(!vendtable) // if vendor
not exits
{
ttsBegin;
vendtable.clear();
vendtable.initValue();
vendtable.AccountNum = accountNum;
vendtable.VendGroup = vendGroupId;
vendtable.insert();
dirParty = DirParty::constructFromCommon(vendtable);
dirPartyPostalAddressView.LocationName = 'ABC-AUTO';
dirPartyPostalAddressView.City = 'London';
dirPartyPostalAddressView.Street = 'Dover
Street';
dirPartyPostalAddressView.StreetNumber = '123';
dirPartyPostalAddressView.CountryRegionId = 'GBR';
dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
ttsCommit;
}
else //
if vendor exits updates the address of the Vendor
{
ttsBegin;
dirParty = DirParty::constructFromCommon(vendtable);
dirPartyPostalAddressView.LocationName = 'ABC-AUTO';
dirPartyPostalAddressView.City = 'Germany';
dirPartyPostalAddressView.Street = 'Germany
Street';
dirPartyPostalAddressView.StreetNumber = '123';
dirPartyPostalAddressView.CountryRegionId = 'GBR';
dirPartyPostalAddressView.IsPrimary=1;
dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);
ttsCommit;
}
}
No comments:
Post a Comment