Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on 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 a 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.



  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.