Application Development and Automation 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: 
Read only

How to commit 'API_RE_CN_CHANGE'

Former Member
0 Likes
1,320

Hi Experts

I am using API_RE_CN_CHANGE to change a real estate contract(Flexible - Realestate). while doing so i am not able to <i>Commit</i> this change to database. This happens despite the fact that I am using statement COMMIT WORK (also tried using BAPI_TRANSACTION_COMMIT).

I am able to commit these changes to database while using BAPI_RE_CN_CHANGE but not if API_RE_CN_CHANGE is used.

The reason i prefer API_RE_CN_CHANGE over BAPI_RE_CN_CHANGE is because i need values in buffer too.

So could any one suggest a way to commit changes done to a real estate contract (Transaction code - RECN) via API_RE_CN_CHANGE.

Thanks

Mukundhan KN

1 ACCEPTED SOLUTION
Read only

suresh_datti
Active Contributor
0 Likes
899

PL take a look at the source code of the method FINALIZE_OBJECT_CHG in the class CL_RECA_BAPI_SERVICES. the following piece of code in that method is what looks like storing the changes into the database.. may be you can copy the same logic..

      IF mf_update_task_local = abap_true.
        SET UPDATE TASK LOCAL.
      ENDIF.

      CALL METHOD io_busobj->store
        EXPORTING
          if_in_update_task = mf_in_update_task
        EXCEPTIONS
          error             = 1
          OTHERS            = 2.
      IF sy-subrc <> 0.
        io_msglist->add_symsg( ).
        cf_error = abap_true.
      ELSE.
        ef_stored = abap_true.
      ENDIF.

~Suresh

2 REPLIES 2
Read only

suresh_datti
Active Contributor
0 Likes
900

PL take a look at the source code of the method FINALIZE_OBJECT_CHG in the class CL_RECA_BAPI_SERVICES. the following piece of code in that method is what looks like storing the changes into the database.. may be you can copy the same logic..

      IF mf_update_task_local = abap_true.
        SET UPDATE TASK LOCAL.
      ENDIF.

      CALL METHOD io_busobj->store
        EXPORTING
          if_in_update_task = mf_in_update_task
        EXCEPTIONS
          error             = 1
          OTHERS            = 2.
      IF sy-subrc <> 0.
        io_msglist->add_symsg( ).
        cf_error = abap_true.
      ELSE.
        ef_stored = abap_true.
      ENDIF.

~Suresh

Read only

0 Likes
899

Hi Suresh

Thanks for your valuble suggestion. it worked.

To be precise, the SET UPDATE TASK LOCAL statement did not get effect in the custom code that we write. it hold credit only when called from the call that it belongs.

Hence i created an object for type IF_RECN_CONTRACT using class method CF_RECN_CONTRACT=>FIND. And after changing contracts using API_RE_CN_CHANGE, i called the method 'STORE' of interface IF_RECN_CONTRACT. and that solved the problem.

Definitely your suggestion was the trigger to enable thought process in this direction

Thanks again

Mukundhan KN