Skip to Content
avatar image
Former Member

INSERT statement failing

Hello Experts,

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:

pratyusha vemuluri

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 05, 2007 at 05:52 PM

    I had similar problem earlier and we debugged RFC from TIBCO and found that internal tables are not getting refreshed correctly. Before using any internal table, you need to refresh them. It is strange, i used to feel that with new instance, system will clear all earlier runtime values. But that was not the case with TIBCO RFC and when i put REFRESH statement before using each internal table and variable, it started working fine.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I already do that. The internal table is cleared and refreshed each time in the beginining of function module itself. But in debug mode, how does it work fine. This behavior happens when I test the function module internally in SAP.

      Thanks

      Pratyusha

  • avatar image
    Former Member
    Oct 08, 2007 at 08:56 PM

    I created another function module just for insertion of data of "Update" type and called this FM in the first RFC in update task. It seems to work fine.

    Add comment
    10|10000 characters needed characters exceeded