ABL Conversion (BPM)

I’m sure this is going to be very easy for those of you who have converted ABL to C#. I have a snippet that is challenging me due to my relative lack of C# chops. This was written by others and looks a bit inefficient, but it works in E9. I need to convert this so I can keep my migration to 10.2.2 moving. Help, please!

Basically, when saving/updating an open Quote:

  1. Erase QuoteQty tbl
  2. Erase ttQuoteQty tbl. The converted code failed syntax check. Perhaps ttQuoteQty.Clear() is correct?
  3. Recreate both tables using data from the UD20 tbl (previously populated).

The converted code fails the syntax check at 2 points. Here’s the snippet in brief:

//  So, For the given quote, empty both the ttQuoteQty AND the QuoteQty (DB) tables.  This will be rebuilt later in the routine.
for each ttQuoteHed:
	for each QuoteQty WHERE ... 
		DELETE QuoteQty.
	for each ttQuoteQty:
		DELETE ttQuoteQty.
	for each UD20 WHERE ...
	     Create QuoteQty.
	     ASSIGN QuoteQty.Company=ttQuoteHed.Company  // recreate QuoteQty
	     QuoteQty.QuoteNum = INTEGER(UD20.Key2)
	     Create ttQuoteQty.
	     ASSIGN ttQuoteQty.Company=ttQuoteHed.Company   //  recreate ttQuoteQty

And now the relevant snippets from the converted code…

foreach (var ttQuoteHed_xRow in ttQuoteHed)
	var ttQuoteHedRow = ttQuoteHed_xRow;
	foreach (var QuoteQty_iterator in (from QuoteQty_Row in Db.QuoteQty     where ...      select QuoteQty_Row))
		QuoteQty = QuoteQty_iterator;
	ttQuoteQty_xRow.RemoveAll(ttQuoteQty_xRow);   *ERROR*  "The name ttQuoteQty_xRow does not exist.  Changed to ttQuoteQty.Clear()

	foreach (var UD20_iterator in (from UD20_Row in Db.UD20     where...      select UD20_Row))
		UD20 = UD20_iterator;
		QuoteQty = new Erp.Tables.QuoteQty();			// Here we rebuild the Db.QuoteQty table
		QuoteQty.Company = ttQuoteHed_xRow.Company;		// and populate it with info previously saved to UD20

		var ttQuoteQtyRow = new QuoteQty();			// And, here we rebuild the tt table
		ttQuoteQty_xRow.Add(ttQuoteQtyRow);   *ERROR*  The name ttQuoteQty_xRow dows not exist.  

		ttQuoteQtyRow.Company = ttQuoteHed_xRow.Company;	// And do exactly the same thing

a LOT of red flags on this… can I ask for use case?

1 Like

Uh oh. This is why I included the disclaimer “made by others”.
I saw an earlier post/response of yours, Jose, where you suggested to the original poster that he/we probably should not rely on the online converter, and I am in full agreement. I’ve had to make loads of changes - but time is of the essence on this one.

Use case. My Sales Mgmt decided they want to use the quote form for a lot of what if scenarios, however, when certain items change, like the shipto if I remember correctly, everything on the quote gets lost (due to the possibility of a price list coming into play automatically).

A consulting firm suggested they could save the current contents, allow the refresh to occur when significant changes are made, and then copy the info back.

Yeah I’m just concerned about the way the QuoteQty records are being removed, it’s not using the BO’s, not a huge fan of that… I’ll poke at it a bit when I get some time tomorrow

1 Like

Much appreciated! Once I get it working and complete the migration, I will certainly be making good use of the new Code Review section!

1 Like

Agree with @josecgomez on this one…

  1. this will NOT convert easily from ABL to C#
  2. this should NOT be done!
  3. IF you are going to modify… and Especially Add or Delete anything, it should always be done with Business Objects that are specifically create to do such things.

ABL had some real “Flexibility” that made this “look” easy, but in reality you could really screw up your database by directly modifying the database.


Hey @josecgomez, were you able to identify any of the BOs that need to become part of this solution?
Thanks again.

Looks like you just need to use the Quote BO for the deleting and inserting (adding) records.

1 Like

Thanks @tkoch, I was thinking the same - this really doesn’t have to be complicated.
As long as I have access to the tables in question - both the in memory ‘tt’ table as well as the actual table, it shouldn’t be too difficult to write new values to the records - either adding and deleting as necessary.

Thanks for the response - truly appreciated.