Inserting Data into same table

baha

Active Member
Here is my scenerio
I have a custom table with over 50 columns
I am using this table via business view in a application
one of the fields (index) on this table is RP01 (Legal entity)
Promary Key on this table is UKID
on this application I have a form where it has two FC fields
Copy From (This is a FC value of legal Entity)
Copy To (This is also the FC value )
so when user select from Legal Entity , and select To Legel Entity) and then click OK then the follwing needs to be done
1) all the rows associated with From Legal Entity should be selected (there could be multiple rows )
2)Call to business function to get the next unique key ID
3)Copy the all the rows from step 1 and insert as new row with new unique key from step2 and "To Legal Entity)

One way that I can do this would be to do a fetch and get the values of all the columns and put them in variables and then insert them back into the table with new UKID and legal Entity, but I would prefer not to create over 50 variables and then put them the values of those columns retrieved from table into those variables and then insert the variables back , I am looking for some quick and more effeciant solution
Any advice will be appreaciated
 
Two other choices I can think of.
1. Load the from values into a grid first, which also lets the user see exactly what they are copying. Have a form exit or the OK button then add the new rows based on the grid variables. You would have to make sure that all of the rows are loaded to the grid. You could perhaps hide the grid itself, and manually load the grid first then add the new rows, essentially using the grid as a cache. Not good if there are a large number of rows, either way, as you will be holding the whole set in memory while you're copying.
2. Write a C BSFN, in which case you can use the table.h and copy the row data as a structure and update the values you need to and insert the new row, row at a time.
 
Does the solution have to be an interactive application? You could use a UBE to accomplish this without creating 50 variables.
 
Back
Top