I have the task today of copying a SOP Order. The user supplies the order that needs to be copied, I need to make a complete copy.
I have the standard SOP code documented here but I know that there is going to be a ton of manual typing to get all the 150 or so fields in each of the SOP header and lines eConnect documents populated. So, in order to avoid that hour of work, I spend a day working on .NET Reflection. <smiles>
My initial foray into reflection is here. The code is simpler and easier to understand if all you're looking for is Reflection.
The resulting code is below. Basically, we get a query of the SOP Header and then (using Reflection) loop through the eConnect taSOPHdrIvcInsert object and populate all the fields with the data from the order to be copied.
Then we repeat that with all the lines, and create the order.