Skip to Content
0
Former Member
Jul 02, 2009 at 04:50 PM

examples of t_extension usage in CRM_ORDER_MAINTAIN

481 Views

Hi there,

I'm having some trouble with the t_extension parameter of the CRM_ORDER_MAINTAIN function module.

Do you guys have examples of its usage?

Basically, I just need to add a technical resource (License Plate) to a Contract (TCCO type).

I have the following code, all seems ok when I debugg it, but somehow it is not saving anything (t_saved_objects is always empty).

Any advice?

TC_TECH_RES-REF_GUID = 'DE61B27AA8C3F7F1BCD000237DA3260A'. "GUID of my Contract
TC_TECH_RES-REF_KIND = 'B'.
TC_TECH_RES-record = '00000000000000000000000000000999'. "create the GUID of the Techn Object with this GUID
TC_TECH_RES-tr_line_type = '1'.
TC_TECH_RES-MODE = 'B'.
TC_TECH_RES-tr_type = 'LP'.
tc_tech_res-tr_obj_id = 'LICENCEPLATE'.
tc_tech_res-tr_valid_from = '28062009220000'.
append TC_TECH_RES to wa_extension-TC_TECH_RES.
wa_extension-ref_guid = 'DE61B27AA8C3F7F1BCD000237DA3260A'.
wa_extension-ref_kind = 'B'.
wa_extension-object = 'TC_TECH_RES'.


append wa_extension to t_extension .
*-------


CALL FUNCTION 'CRM_ORDER_MAINTAIN'
  exPORTING
    it_extension      = t_extension
*        CHANGING
*          ct_orderadm_h     = t_new_orders
*          ct_input_fields   = t_input_field
  EXCEPTIONS
    error_occurred    = 1
    document_locked   = 2
    no_change_allowed = 3
    no_authority      = 4
    OTHERS            = 5.

if sy-subrc = 0.

  l_object_to_save = TC_TECH_RES-REF_GUID. 
  INSERT l_object_to_save INTO TABLE t_object_to_save.

  CALL FUNCTION 'CRM_ORDER_SAVE'
    EXPORTING
      it_objects_to_save   = t_object_to_save
*      IV_UPDATE_TASK_LOCAL = 'X' " 'TRUE
    IMPORTING
      et_saved_objects     = t_saved_objects
      et_exception         = t_exceptions
      et_objects_not_saved = t_objects_not_saved
    EXCEPTIONS
      document_not_saved   = 1
      OTHERS               = 2.

  if sy-subrc eq 0.

    call function 'BAPI_TRANSACTION_COMMIT'.
  endif.


endif.

Thanks in advance.

Edited by: Rui Machado on Jul 2, 2009 6:52 PM