cancel
Showing results for 
Search instead for 
Did you mean: 

CRM quotations

Former Member
0 Kudos

Hello.

Do you know if there is a BAPI to create a quotation in SAP CRM? I know it exists for ERP.

Many thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I've found many things about sales orders but not about quotations. Sorry, I'm a CRM newbie

KaushalShah
Active Contributor
0 Kudos

Quotation is just another type of sales order in CRM. Standard sales order type is TA & standard quotation type is AG.

So, if you want to create / modify a quotation, you just have to work on sales orders with document type "AG".

Hope this helps.

Regards,

Kaushal

Answers (3)

Answers (3)

Former Member
0 Kudos

Find below a code sample to create a quotation,


DATA:
    t_object_to_save    TYPE crmt_object_guid_tab, 
    t_saved_objects     TYPE crmt_return_objects,
    t_objects_not_saved TYPE crmt_object_guid_tab,
    t_new_orders        TYPE crmt_orderadm_h_comt,
    s_new_order         TYPE crmt_orderadm_h_comt, 
    t_input_field       TYPE crmt_input_field_tab,
    s_input_field       TYPE crmt_input_field,
    s_fieldname         TYPE CRMT_INPUT_FIELD_NAMES.


s_new_order-handle = 1.
s_new_order-mode = 'A'.
s_new_order-process_type = 'QUOT'.

s_input_field-ref_handle  = 1.
s_input_field-ref_kind    = 'A'.
s_input_field-objectname  = 'ORDERADM_H'.
s_input_field-logical_key = space.

CLEAR s_fieldname.
s_fieldname-fieldname = 'MODE'.
APPEND s_fieldname TO s_input_field-field_names.
s_fieldname-fieldname = 'PROCESS_TYPE'.
APPEND s_fieldname TO s_input_field-field_names.

INSERT s_input_field INTO TABLE t_input_fields.

INSERT s_new_order INTO TABLE t_new_orders.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'
  CHANGING
    ct_orderadm_h     = t_new_orders
    ct_input_fields   = t_input_fields
  EXCEPTIONS
    error_occurred    = 1
    document_locked   = 2
    no_change_allowed = 3
    no_authority      = 4
    OTHERS            = 5.

if sy-subrc ne 0.

clear s_new_order.
read table t_new_orders 
into s_new_order
INDEX 1.

if sy-subrc ne 0.
l_object_to_save = s_new_order-guid.
INSERT l_object_to_save INTO TABLE t_objects_to_save.

CALL FUNCTION 'CRM_ORDER_SAVE'
  EXPORTING
    it_objects_to_save   = t_objects_to_save
  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.

Hope it helps,

David

KaushalShah
Active Contributor
0 Kudos

Check function group CRM_ORDER_API. You will find everything related to work on all types of sales documents there.

Regards,

Kaushal

Former Member
0 Kudos

Hi,

I think there're BAPIs for Activity, Opportunity, Lead and Sales Transaction.

Function group 'CRM_BUSPROCESSND_BAPI' contains the BAPIS to create general orders.

Hope it helps,

David