cancel
Showing results for 
Search instead for 
Did you mean: 

Change status profile of Service order

stefan_porges1
Participant
0 Kudos

Hi,

we like to harmonize all status profile of all incident process types  we have in our system. This means we like to create one status profile and assign this to 5 different process types. The problem is, we have in our system round about 20000 incidents and ( open and closed). This incidents have to be migrated. I think we have to change E-Status and Status profile and change documents. Are there any experiences with this task. I found nothing what really works (change status profile) in this time. I checked CRM_STATUS_PROFILE_CHANGE but dosn't work for me.

Could anyone give some hints how to handle this problem?

Kind regards Stefan

Accepted Solutions (1)

Accepted Solutions (1)

dharmakasi
Active Contributor
0 Kudos

Hi Stefan,

You can try the below code to change the status and status profile

ls_status_com-ref_guid = lv_guid."document guid

        ls_status_com
-ref_kind = 'A'.

        ls_status_com
-user_stat_proc = 'CRMACTIV'. " status profile

        ls_status_com
-activate = 'X'.

       
APPEND ls_status_com TO lt_status_com.



        ls_input_fields
-ref_guid = ls_status_com-ref_guid.

        ls_input_fields
-ref_kind = 'A'.

        ls_input_fields
-objectname = 'STATUS'.

       
CONCATENATE ls_status_com-status ls_status_com-user_stat_proc INTO ls_input_fields-logical_key.

        ls_fieldname
-fieldname = 'ACTIVATE'.

       
INSERT ls_fieldname INTO TABLE ls_input_fields-field_names.

       
INSERT ls_input_fields INTO TABLE lt_input_fields.

         

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

       
EXPORTING

          it_status        
= lt_status_com

       
CHANGING

          ct_input_fields  
= lt_input_fields

       
EXCEPTIONS

          error_occurred   
= 1

          document_locked  
= 2

          no_change_allowed
= 3

          no_authority     
= 4

         
OTHERS            = 5.

     
IF sy-subrc EQ 0.

       
INSERT lv_guid INTO TABLE lt_guids.

       
CALL FUNCTION 'CRM_ORDER_SAVE'

         
EXPORTING

            it_objects_to_save
= lt_guids

         
EXCEPTIONS

            document_not_saved
= 1

           
OTHERS             = 2.

       
IF sy-subrc IS INITIAL.

         
COMMIT WORK AND WAIT.

     endif.

Best Regards,

Dharmakasi

stefan_porges1
Participant
0 Kudos

Thank you, it works.

Kind regards Stefan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi stefan porges1,

                         change with crm_order_maintain,pass status , status profile field and logical_key in input field as status+status profile.

Padma.