cancel
Showing results for 
Search instead for 
Did you mean: 

how to change user status

Former Member
0 Kudos

Hi

I want to change the user status from X - > Y - > Z - > X based on config... so in doing that my system status would be set to released.

I am doing the updation each time from X--> Y and calling crm_order_maintain, crm_order_save, commit work and save , wait up to 20 seconds, crm_order_initialize.

Without doing wait up to 20 seconds, i am getting an error "Order cannot be changed" when i am updating the user status from Y->Z next time for same guid object ( contract item ).

My questions are

1. How do we identify whether we can change contract, for next user status using any FM. It says contract cannot be changed as "Transferring not completed". I used FM "CRM_ORDER_CHECK_CHANGE_ALLOWED" , but it always gives message "in transferring in middleware". Is there any other way to avoid wait up to 20 seconds , instead determine whether the contract can be changeable.

2. Can we update X>Y>Z--->X in single crm_order_maintain.. can system track this changes that contract item has gone through various user status. When i checked it only keeps Y status. I am passing all user status as active. Can we pass in any other manner?..

3. When i call order initialize after each update of status , the lock is getting released and for next status chnage when i call order maintain, if some other user opens same contract in that time... lock error comes.. when i pass Keep lock in order initialize it is not working.. does that work and why does its not working....

Regards,

D

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Deepthi,

Instead of using order_save and commit multiple times , you can change the status using CRM_ORDER_MAINTAIN multiple times( may be in a loop) and when you reach the desired status , you can then use CRM_ORDER_SAVE and BAPI_TRANSACTION COMMIT only once .

There is one more alternative to avoid locking(as in your case) i.e. to use CRM_ORDER_SAVE FM with no_bdoc_send paramter flagged . Through this we can avoid WAIT statement .

Hope this helps!!

Regards,

Nithish

Former Member
0 Kudos

Thank you,

Are you saying, for all items at a time call save. for one contract one time irrespective of how many items and how many status each item would undergo.

do we need to put each status as activate or active in lp_input_fields?. i am passing three status as active, system status should be released it is not released, as its not undergone each status.

how do we pass so that item undergo each status ?.

Former Member
0 Kudos

Yes, we can use save and commit once irrespective of how many line items and different statuses for each line item are there.

You can do all the maintainance of statuses for all line items for a particular contrcat usinh CRM_ORDER_MAINTAIN and after reaching one particular user status, the system status " Released" will get trigger and then you can save and commit.

You need to pass ACTIVATE field name in input_fields and ACTIVATE = 'X' in it_status.

Regards,

Nithish

Former Member
0 Kudos

Thank you Nitish. Your answers are almost solving my question.

Like item 100 status from X->y->z. when changing from X->y i passed activate and user status.

and from y-> Z passed activate and user status. since it is a sorted table it gets sorted and the order changes like first record would be "Z" and second record would be "X".

so system is not changing the status. and order save didnt return any saved objects.

Former Member
0 Kudos

Deepthi,

Dont pass all the statuses at once to CRM_ORDER_MAINTAIN,

For eg :

To get to status Z from X->Y->Z , you can follow below procedure

take staus - X

fill it_status and it_inputfields with a record each corresponding to status X.

Call CRM_ORDER_MAINTAIN

take staus - Y

fill it_status and it_inputfields with a record each corresponding to status Y.

Call CRM_ORDER_MAINTAIN

take staus - Z

fill it_status and it_inputfields with a record each corresponding to status Z.

Call CRM_ORDER_MAINTAIN

After reching Z , call ORDER_SAVE and COMMIT.

Please use a internal table for all your status and place the order_maintain in loop , so that each status gets maintained while you navigate to next status.

Regards,

Nithish

Edited by: nithish P on May 17, 2011 8:15 AM

Former Member
0 Kudos

Great.. its working..

I have a question... i am calling crm_order_read for each contract.. and as u said.. i am calling order maintain many times and finally saving, bapi transaction commit( not explicit commit work and save)...

how do we clear the buffers.. will there be any logs and goes to dump... i may run this program for 20k contracts..

the internal table data will be refreshed for every contract.. do we need to call crm_order_initialize after bapi transaction commit?.

Former Member
0 Kudos

The FM 'CRM_ORDER_INITIALIZE ' will initialize the whole buffer . So the best practice is to use CRM_ORDER_INITIALIZE FM after using CRM_ORDER_SAVE and BAPI_TRANNSACTION_COMMIT. If there is a case where you want to maintain some details of a contract and use CRM_ORDER_SAVE and once again try to maintain other details of the same contract using CRM_ORDER_MAINTAIn and then use CRM_ORDER_SAVE , it will throw you a dump , as we are trying to save same header guid twice which will give"duplicate key in buffer exception ' . So better to use FM 'CRM_ORDER_INITIALIZE after CRM_ORDER_SAVE . If you work on different contrcats and try to save each contract once only , then this FM may not be required .

But the best practice is to use FM and clear the buffer !!

Regards,

Nithish

Former Member
0 Kudos

what happens if during one of the status change "CRM_ORDER_MAINTAIN" has thrown an error, but still we continue with other status updates using "crm_order_mantain" and finally we are saving... will save gives error ?.

this is to make sure that whole contracts doesnt get updated..will contract gets updated with any other status ?. or will save only when it give any error ?.

Former Member
0 Kudos

If there ia any error at any particular status, the following statuses will not get maintained ,i think in that case the CRM_ORDER_SAVE will save the changes(for earlier statuses ) where the maintain has worked successfully

Regards,

Nithish

Former Member
0 Kudos

In my earlier question as u said, like we can save all at a time. what does system do.. when i re-opened it should perform activities like cancel existing invoice. when we do finally at a time save, will it do those activities..

how do we determine whether can we do change to a contract , any fm .. if i use my earlier approach, my functionality meets, but not sure how do we know the status of bdoc... i need to trigger bdoc each time when a status change .. so to avoid wait.. i am looking at a fm which serves the purpose to know the contract can be changed ?

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

20 seconds for middleware is a lot to much.

In our system environment the this time is less than 1 second.

First check with your network export why this timeframe is so long.

If you do not need the contracts synchronised with ERP you could exclude this from the middleware transfer to avoid this waiting time.

Kind regards

Manfred