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

Problems with function STATUS_CHANGE_INTERN

Former Member
0 Likes
4,594

Hello guys,

I'm trying to update some REFX objects (contracts) by removing the master data lock (stat I0065). In 2012 I used function STATUS_CHANGE_INTERN for it and everything worked fine. Now I have the same coding like then, but the update does not work anymore, it just did not remove the master lock data.

The function was updated by SAP in 07/2013. Is there anything new what does not work anymore or where is the problem?

My coding is:


*         Aufheben der Sperre
           gs_status_int-stat  = 'I0065'.
           gs_status_int-inact = 'X'.
           APPEND gs_status_int TO gt_status_int.

*         Sperre löschen
           CALL FUNCTION 'STATUS_CHANGE_INTERN'
             EXPORTING
               check_only          = p_test
               objnr               = gs_contract-objnr
             TABLES
               status              = gt_status_int
             EXCEPTIONS
               object_not_found    = 1
               status_inconsistent = 2
               status_not_allowed  = 3
               OTHERS              = 4.

*         Im Echtlauf Update der DB
           IF p_test EQ space.
             CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               EXPORTING
                 wait   = 'X'
               IMPORTING
                 return = gs_return.
           ENDIF.

btw with function STATUS_CHANGE_INTERN_VB everything works!

Where is the problem?

Thanks a lot.

Regards

Michael

6 REPLIES 6
Read only

former_member197622
Participant
0 Likes
2,073

Hi Michael

what is the result of sy-subrc after 'STATUS_CHANGE_INTERN' ??

Regards

MC

Read only

0 Likes
2,073

The problem ist that returncode is 0. Everything looks fine, just the status did not change 😕

Read only

0 Likes
2,073

just do a

commit work.

after the fm and you're set.

Read only

ceedee666
SAP Champion
SAP Champion
0 Likes
2,073

Hi Michael,

on the first look I don't see an issues with your code.

Maybe you can check the blog post I wrote recently. It contains some code examples. Maybe this is helpful to solve your problem.

Christian

Read only

Canet_1976
Explorer
0 Likes
2,073

Dear Michael.

I'm doing some equal than you, modifying status at WBS elements.

I've tryied to use STATUS_CHANGE_INTERN FM with the same result.

Debugging the SAP standard system, I've found that doesn't modify anything.

The error is here at LBSVAF13 include.

*---------------------------------------------------------------------*

*       FORM CALL_STATUS_UPDATE                                       *

*---------------------------------------------------------------------*

*       ggf. Verbuchung anstoßen                                      *

*---------------------------------------------------------------------*

FORM CALL_STATUS_UPDATE.

   IF SY-ONCOM = 'P'.

* For performance reasons do not update status immediately

* if status changes are performed ON COMMIT

*   PERFORM STATUS_UPDATE.

   ELSEIF COMMIT_FORCED = OFF.

     PERFORM STATUS_UPDATE ON COMMIT.

     PERFORM STATUS_ROLLBACK ON ROLLBACK.                   "note966213

* instead update status later on lowest possible COMMIT level.

*

* basically the same routine as STATUS_UPDATE, but as routine

* can be registered only once for processing even on different

* levels, it has to be encapsulated in a dummy routine

* STATUS_UPDATE_REST here.

     PERFORM STATUS_UPDATE_REST ON COMMIT LEVEL 999.

     COMMIT_FORCED = ON.

   ENDIF.

ENDFORM.



Never execute anything, so finally I've just decided execute STATUS_CHANGE_INTERN_VB or  STATUS_UPDATE which one is execute just inside the first one.


May be it should be posted like a OSS note.



King regards.

Read only

Former Member
0 Likes
2,073

Hi Michael,

For the similar requirement in REFX, I have used BAPI 'BAPI_RE_CN_CHANGE'

you need to pass 'TRANS' with respective status value.

You can try by passing 'PSEM'(Unlock master data)

Regards,

Greeshma.