Create Record using Progress 4GL in Epicor Vantage BPM

NathanB

New Member
Hi,

This is my first post to ProgressTalk. I am a mechanical engineer recently turned novice-developer out of necessity and need some help with a software-specific problem.

Business Case: My company has both inside and outside sales reps assigned to most customer accounts and stored on the SalesRep table and related to the Customer table. We would like both reps to appear on the QSalesRP table related to the QuoteHed table. The Inside Sales Rep is brought over through the base processing of the Business Object Method from the customer record. I am looking for a way to create a second record on the QSalesRP table for the Outside Sales Rep information.

Technical Approach: Epicor's Vantage ERP has a tool that allows developers to add functionality to Business Object Methods either before, during or after the method is called. I am using the following script attached to the related methods to attempt to create the new QSalesRP record related to the QuoteHed:
For Each ttQuoteHed where (ttQuoteHed.RowMod = 'A' or ttQuoteHed.RowMod = 'U' or ttQuoteHed.RowMod = ''), each Customer where (ttQuoteHed.Company = Customer.Company and ttQuoteHed.CustNum = Customer.CustNum) no-lock.
Find SalesRep where (Customer.Company = SalesRep.Company and Customer.ShortChar03 = SalesRep.SalesRepCode) No-lock.
If available SalesRep then do:
/*Create ttQSalesRp where (ttQSalesRP.Company = ttQuoteHed.Company and ttQSalesRP.QuoteNum = ttQuoteHed.QuoteNum) no-lock.*/
/*Create ttQSalesRP no-lock.*/
/*Assign ttQSalesRP.SalesRepCode = SalesRep.SalesRepCode. */
/*Assign ttQSalesRP.Name = SalesRep.Name.*/
/*End.*/
Def var wkhandle as handle no-undo.
def var wktable as char no-undo.
/*create buffer for table - provided at runtime*/
create buffer wkhandle for table(wktable).
/*create buffer wkhandle for table(ttQSalesRP).*/
do transaction:
/*create record*/
wkhandle:buffer-create().
/* assign value to a field*/
wkhandle:buffer-field(ttQSalesRP.Company):buffer-value = CUR-COMP.
Assign ttQSalesRP.ChangeDate = TODAY.
Assign ttQSalesRP.ChangedBy = DCD-USERID.
Assign ttQSalesRP.Name = SalesRep.Name.
Assign ttQSalesRP.PrimeRep = FALSE.
Assign ttQSalesRP.QuoteNum = ttQuoteHed.QuoteNum.
Assign ttQSalesRP.RepRate = 0.
Assign ttQSalesRP.RepSplit = 0.
Assign ttQSalesRP.RoleCode = SalesRep.RoleCode.
Assign ttQSalesRP.SalesRepCode = SalesRep.SalesRepCode.
end.
End.
If not available SalesRep then return.
End.

Current Problem: Server log is indicating "Could not create buffer object for table". Suspect that this may be the result of a licensing constraint with our software which may not support the creation of new records via this method. If this is the case, is there some sort of workaround?

Thanks,

NB
 

GregTomkins

Active Member
I think the immediate problem is that the 'wktable' field needs a value, it is never assigned and therefore blank. It believe has to be the value of a table in the DB, or, a temp-table known to the procedure.

I don't know a thing about Epicor, though, so at best this will probably just move you a tiny bit forward in your quest.
 

NathanB

New Member
Greg,

Where do I do this?

When I try: wkhandle:buffer-create(ttQSalesRP).

I get: "The following application error was encountered:
** Unknown Field or Variable name - ttQSalesRP. (201)
** Could not understand line 47. (196)
"

When I try: wkhandle:buffer-create(ttQSalesRP.Company).

I get: "The following application error was encountered:
Invalid number of arguments for attribute buffer-create. (3407)
** Could not understand line 47. (196)
"

Thanks,

NB
 

GregTomkins

Active Member
You'd need to put it (the table name) in quotes.

Dynamic buffers etc. are tricky until you get used to them, so like I said before, I would expect getting this to work to be a long process.
 
Top