Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

RFC fetching data from table which is not commited

Former Member
0 Kudos

Hi Experts,

I have a query regarding commit work.Below is the RFC that i have written


FUNCTION ZBAPI_CREATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      IT_ZABAP_RFC STRUCTURE  ZBAPI_RFC_STR OPTIONAL
*"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
*"----------------------------------------------------------------------

CALL FUNCTION 'ZBO_BAPI_CREATE' 
 TABLES
   IT_ZABAP_RFC       = IT_ZABAP_RFC
   RETURN             = return
          .

Break-point.

DATA lt TYPE TABLE OF ZBAPI_RFC_STR_MAIN.
CALL FUNCTION 'ZBAPI_SEARCH_RANGE'
* EXPORTING
*   IS_STR        =
 TABLES
   ET_TAB        = lt
*   RETURN        =
          .



ENDFUNCTION.

here in first RFC call i am creating a record in ZTABLE , and then at break-point

i check the ZTABLE where it does not create any record because data is not commited into ZTABLE upto this point, but just after it i have written code for fetching data from ZTABLE but i am able to get this new record in lt.

Can anybody please explain that from where this serach RFC is providing data because inside serach i am simply selecting data from ZTABLE.

Regards,

Abhishek Bajpai

Edited by: ABHISHEK BAJPAI on Jan 28, 2009 1:12 PM

5 REPLIES 5

tarangini_katta
Active Contributor
0 Kudos

Hi Abhishek,

After coming out of ur RFC the data is updating to the database

Thanks

0 Kudos

yes you are right but my question is that if there is no data in the table before Search then from where i am getting data in search RFC call , as in Search RFC call i am simply selecting data from ZTABLE which has no record at that point.

Is it fetching data from any local memory,this is what i want to know??Could anyone please respond.

Regards,

Abhishek

Edited by: ABHISHEK BAJPAI on Jan 29, 2009 12:38 PM

0 Kudos

Hi Abhishek,

Data is not fetching from any local memory, it is from your ztable only. before your second function module an database commit is happening, which in turn will update your Ztable, and for the next call your data will be available in ZTABLE.Waht you can do is before the breakpoint just add commit statement which will explicitly commit the operation, and at breakpoint please check your database table, data should be there.

Please let me know, if u are not getting this.

Regards,

Antony Thomas

0 Kudos

Hi Thomas,

Thanks for reply , i checked in ZTABLE ,before search RFC call data is not there but if i commit explicitly only then it is showing data in ZTABLE. Actually my requirement is different -


I have two RFCs 1. Create 2. Search , Now from web dynpro user will call first Create RFCs but at this point it should not insert record in ZTABLE and just after it user will call another search RFC and in this search he should be able to get these newly created records.

I want to have the functionality which a user gets when working with normal database front end like SQLPLus for Oracle. In these scenarios we see that whenever user does any insert or update the data sits in the table but still it is not committed. So there he fires Select query he sees the inserted data. But if he logs off from SQL PLUS and then logs in again, and fires Select query he does not see the data as it was not committed. I want a similiar functionalty in which if user inserts the data through Create RFC and fires the Select query through Search RFC then he can see the newly Created data also even though this data is not committed.

Although if i call create RFC in update task it will not update ZTABLE but in this situation , if user will call search RFC he will not be able to get newly created records.

So my requirement is that i should be able to get those records which are not commited in ZTABLE .If you have still any doubt regarding my question then please let me know.

Regards,

Abhishek

0 Kudos

>

> Hi Thomas,

> I want to have the functionality which a user gets when working with normal database front end like SQLPLus for Oracle. In these scenarios we see that whenever user does any insert or update the data sits in the table but still it is not committed. So there he fires Select query he sees the inserted data. But if he logs off from SQL PLUS and then logs in again, and fires Select query he does not see the data as it was not committed. I want a similiar functionalty in which if user inserts the data through Create RFC and fires the Select query through Search RFC then he can see the newly Created data also even though this data is not committed.

In the situation you describe, if you create a record and then logoff from SQL*PLUS in Oracle without doing a commit or a rollback, the record will be committed automatically in my experience. Though perhaps you can set the database to do a rollback on exit as a default rather than a commit.

In SQL*PLUS you can insert a record into a database table and select it again without doing a commit in a single session. You've mentioned using RFCs and I'm assuming you mean more than one RFC call. I don't think that doing multiple RFCs would count as a single session and so I don't think you can do what you want to do.