cancel
Showing results for 
Search instead for 
Did you mean: 

CRM Activity Status change BAPI / BADI

Former Member
0 Kudos

Hi,

The requirement I have as of now is like this:

An Activity which has been 'Completed' needs to be changed back to the 'Open' Status for the user to make some change and then again change it back to 'Completed' status. I am looking for a BAPI to do the same. Can anyone help me if I can get a BAPI / BADI to do the same ?

Accepted Solutions (0)

Answers (3)

Answers (3)

tobias_hainke
Employee
Employee
0 Kudos

hi all,

what ive done is to create an entity. Then i was able to set the property of the attribut ACT_STATUS. everything works fine!

Former Member
0 Kudos

Hi Tobias,
Can you, please, provide more details. Thank you.
Andre Jur

Former Member
0 Kudos

Hi,

Try to implement this code in badi order_save.


DATA: gt_crmd_orderadm_h TYPE TABLE OF  crmd_orderadm_h,
        gs_crmd_orderadm_h TYPE crmd_orderadm_h.

  DATA: et_objects_to_save TYPE crmt_object_guid_tab,
        es_objects_to_save TYPE crmt_object_guid.

  DATA: it_saved_objects TYPE crmt_return_objects.

  DATA: gt_field_names TYPE crmt_input_field_names_tab,
        gs_field_names TYPE crmt_input_field_names.

  DATA: cv_log_handle TYPE  balloghndl.


  DATA: p_act TYPE crmd_orderadm_h-object_id ,
        p_guid TYPE crmd_orderadm_h-guid ,
        p_proty TYPE crmd_orderadm_h-process_type ,
        p_stat TYPE crmt_status_com-status .


        p_guid = ACTIVITY GUID
        p_stat = STATUS
        p_proty = STATUS SCHEMA 

        IF p_guid IS NOT INITIAL.
          SELECT SINGLE * FROM crmd_orderadm_h INTO gs_crmd_orderadm_h
       WHERE guid = p_guid.
        ENDIF.

        es_objects_to_save  = gs_crmd_orderadm_h-guid.
        APPEND es_objects_to_save  TO et_objects_to_save .

        es_status-ref_guid       = gs_crmd_orderadm_h-guid.
        es_status-ref_kind       = 'A'.
        es_status-status         = p_stat.
        es_status-user_stat_proc = p_proty.
        es_status-activate       = 'X'.
        APPEND es_status TO et_status.


        cs_input_fields-ref_guid    = gs_crmd_orderadm_h-guid.
        cs_input_fields-ref_kind    = 'A'.
        cs_input_fields-objectname  = 'STATUS'.


        CONCATENATE es_status-status es_status-user_stat_proc INTO  cs_input_fields-logical_key.

        gs_field_names-fieldname = 'ACTIVATE'.
        APPEND gs_field_names TO gt_field_names.

        cs_input_fields-field_names = gt_field_names[].
        APPEND cs_input_fields TO ct_input_fields.

        CALL FUNCTION 'CRM_ORDER_MAINTAIN'
          EXPORTING
            it_status         = et_status
          IMPORTING
            et_exception      = it_exception
          CHANGING
            ct_orderadm_h     = ct_orderadm_h
            ct_orderadm_i     = ct_orderadm_i
            ct_input_fields   = ct_input_fields
          EXCEPTIONS
            error_occurred    = 1
            document_locked   = 2
            no_change_allowed = 3
            no_authority      = 4
            OTHERS            = 5.

Best regards,

Caíque Escaler

Former Member
0 Kudos

HI,

Try to search on SDN.

You can find more decision.

Example:

Denis.