INSERT statement failing
I am having trouble with insert statement in an RFC function module. I created an RFC enable function module in SAP which called by TIBCO. TIBCO calls this FM and passes data in tables format. Lets say it passed 4000 records to RFC function module. The Function module processes data and finally all the data needs to be inserted in Z table.
In debug mode the insert statement works fine everytime with expected results. But in background it behaves differently each time. In background each time different number of records are loaded. I am checking for duplicates before inserting also.
Here are the methods I tried which did not work.
INSERT z_table from table i_ztable.
Then I tried inserting one record at a time from work area.
Used MODIFY statement instead of INSERT.
After all the statements I used COMMIT WORK.
Even tried Putting a WAIT statement.
I ran the SQL trace whent the insertion happens in background, and the number of insert statements in trace differ which I understand is the cause of wrong number of records inserted. But I need to find a solution which makes the insertion stable and consistent all times.
Also the sy-dbcnt value all times comes out correctly, both in foreground as well as background.
I have had this problem for 4 days now and could not find any good solution. Please help me out. I really appreciate it.
Message was edited by: