Home > ABAP, API > CRM_ORDER_MAINTAIN

CRM_ORDER_MAINTAIN

Application Area – CRM,Solution Manager

Description

Function module CRM_ORDER_MAINTAIN is one of the most important function modules in SAP CRM and SAP Solution Manager business transactions processing. Other useful function modules are CRM_ORDER_READ and CRM_ORDER_SAVE.

The function module will call some underlying function modules to save the changes to database. The most important task of calling this function module is to maintain the input fields internal table. You can maintain every information belongs to the business transaction.

The input field structure contains several components. Field ref_guid represents the GUID of the changed structure. Ref_kind has several possible values. A for Administration Header, B for Administration Item, C for Header Extension, D for Item Extension. You also need to populate FIELD_NAMES internal tables to decide which fields in the destination structure needs to be changed.

Code Snippet

This example shows how to maintain the standard activity structure as well as the custom extention structure for a specific business transaction.

    clear: w_input_fields, w_field_name.
    w_input_fields-ref_guid   = iv_guid.
    w_input_fields-ref_kind   = c_chara.
    w_input_fields-objectname = 'ACTIVITY_H'.
    w_field_name-fieldname    = 'CATEGORY'.
    insert w_field_name into table w_input_fields-field_names.
    w_field_name-fieldname    = 'ACT_LOCATION'.
    insert w_field_name into table w_input_fields-field_names.
 
    clear: w_input_fields, w_field_name.
    w_input_fields-ref_guid   = iv_guid.
    w_input_fields-ref_kind   = c_chara.
    w_input_fields-objectname = 'CUSTOMER_H'.
    w_field_name-fieldname    = 'ZZCUSTOMER_H0202'.
    insert w_field_name into table w_input_fields-field_names.
    insert w_input_fields into table it_input_fields.
 
    check it_input_fields[] is not initial.
 
    call function 'CRM_ORDER_MAINTAIN'
    	exporting
      	    it_activity_h     = it_activity_h
            it_customer_h     = it_customer_h
   	changing
      	    ct_input_fields   = it_input_fields
    	exceptions
      	    error_occurred    = 1
      	    document_locked   = 2
      	    no_change_allowed = 3
      	    no_authority      = 4
      	    others            = 5.

Reference

My own ABAP experience :-)

  1. No comments yet.
  1. No trackbacks yet.