cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module to change the user status of a business transaction

Former Member
0 Kudos

Hi,

I want to change the user status of a business transaction. Plz let me know if there is a function module to change the user status.I found some FMs.

- CRM_STATUS_MAINTAIN_OW

- BBP_PROCDOC_STATUS_CHANGE_DIRE

- CRM_ORDER_CHANGE_STATUS

But these FM says that it has to be used for changing system status.

Thanx,

Sivagami.R

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184067
Active Contributor
0 Kudos

hi Siva,

based on experience, inorder to change user status of a business transaction you can use several function module

usually i used function module 'CRM_STATUS_MAINTAIN' and 'CRM_ORDER_MAINTAIN' to change user status of a transaction document.

but basically both fm will called 'CRM_STATUS_MAINTAIN_OW' so technically you can directly used it.

don't forget to execute fm 'CRM_ORDER_SAVE' after that.

please award points if helps

cheers

Former Member
0 Kudos

Hi,

Canu you plz give me some sample code???

Thanx,

Sivagami.R

former_member184067
Active Contributor
0 Kudos

hi Siva,

here is some sample code :

data :

ip_guid type crmt_object_guid,

ls_status type crmt_status_com,

lt_status type crmt_status_comt,

ls_input_field type crmt_input_field,

ls_input_field_names type crmt_input_field_names,

lt_input_fields type crmt_input_field_tab,

lt_obj_guids type crmt_object_guid_tab,

ip_guid = <your guid>.

ls_status-ref_guid = IP_GUID.

ls_status-ref_kind = 'A'.

ls_status-status = lv_newstat.

ls_status-user_stat_proc = 'ZCRMCOM1'.

ls_status-activate = 'X'.

INSERT ls_status INTO TABLE lt_status.

ls_input_field-ref_guid = IP_GUID.

ls_input_field-ref_kind = 'A'.

ls_input_field-objectname = 'STATUS'.

ls_input_field_names-fieldname = 'ACTIVATE'.

INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_fields.

ls_input_field_names-fieldname = 'STATUS'.

INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_fields.

insert IP_GUID into table lt_obj_guids.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

it_status = lt_status

CHANGING

ct_input_fields = lt_input_fields.

CALL FUNCTION 'CRM_ORDER_SAVE'

EXPORTING

it_objects_to_save = lt_obj_guids

EXCEPTIONS

OTHERS = 2.

COMMIT WORK.

please award points if helps

cheers

Former Member
0 Kudos

Hi Shiva,

Rather than using statement 'COMMIT WORK' use FM call

'BAPI_TRANSACTION_COMMIT'.

Best Regards,

Pratik Patel

<b>Reward with Points!</b>

former_member184067
Active Contributor
0 Kudos

hi Pratik,

could please tell me what the different between 'COMMIT WORK' and 'BAPI_TRANSACTION_COMMIT' ?

please advice.

cheers

Former Member
0 Kudos

Thanx yaar ... Now I am able to proceed..

The scenario is as follows:

The order is created in CRM and it is replicated in R/3 when the status is set to 'Released for approval'.

when the order is approved in R/3, the status in CRM should also change to 'Approved'.

I tried ur code... But it is giving the Error 'No changes possible in document'.

When checked the error msg.. it is giving the following..

<b>No changes possible in document

Message no. CRM_ORDER008

Diagnosis

Changes in the document are forbidden, due to the status of the document. Use the Business transaction analysis in order to determine which status forbids the transaction 'Change'.

System Response

The input availability for the document is reset.

Procedure

The main reason for this message is that the document already has the status 'transferred'. It can no longer be changed in the CRM system. If you still need to perform changes, you can only do so in the target system of the transfer.</b>

Can u plz help me in this????

thanx,

sivagami

former_member184067
Active Contributor
0 Kudos

hi Siva,

based on the experience you need to check the status profile for the document. check wheather the status that you want to update to is allowed or not. if it is not allowed, then you need to change it based on your business requirement.

check it in the configuration screen via t-code CRMBS02.

please awards points if helps

cheers

Former Member
0 Kudos

Hi,

Based on the error message, what I can see is that the order status in CRM is not allowing any changes. This is because of the replication scenario that you have used in the middleware settings. As per this scenario, once the CRM order successfully uploaded into R/3 then it becomes R/3 document and no more changes are allowed in the CRM system.

You have couple of options. 1. Change the replication scenario to A, where order changes are allowed on both the systems. Again you have look into the current business requirement. 2. Programatically control the allowable statuses through some code changes (may be via a BAdI).

I am not good at technical person, so you have to tap other technical members for second approach

<b>Do not forget to reward, if it helps,</b>

Regards,

Paul Kondaveeti