on 08-06-2014 9:27 AM
Dear Experts,
In my Z program am trying to create the Service Contract with condition record for the line item. For getting this, am using 'CRM_ORDER_MAINTAIN' with the input of it_pridoc. But its not creating the condition record for the line item. Hope i missed somthing in my program. Pl find my program bellow, Guide me.
ls_pridoc_com-ref_kind = 'B'.
ls_pridoc_com-ref_handle = '0000000001'.
ls_cond-kschl = '0PSV'.
ls_cond-kbetr = '10000'.
ls_cond-KPEIN = '1'.
ls_cond-waers = 'INR'.
INSERT ls_cond INTO TABLE ls_pridoc_com-cond_add.
INSERT ls_pridoc_com INTO TABLE gt_pridoc_com.
ls_crmt_input_field-ref_handle = '0000000001'.
ls_crmt_input_field-ref_guid = lv_guid.
ls_crmt_input_field-ref_kind = 'B'.
ls_crmt_input_field-objectname = 'PRIDOC'.
INSERT ls_input_field_names INTO TABLE ls_crmt_input_field-field_names.
INSERT ls_crmt_input_field INTO TABLE it_crmt_input_field_tab.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_sales = ls_ordermaintain_if-sales
it_pridoc = gt_pridoc_com
it_schedlin_i = ls_ordermaintain_if-schedlin_i
it_partner = it_crmt_partner_comt
it_orgman = gt_orgman
it_ordprp_objl_i_d = it_ordprp_objl_i_d
it_pricing = it_pricing
* it_appointment = gt_appointment
CHANGING
ct_orderadm_h = ls_ordermaintain_if-orderadm_h
ct_orderadm_i = ls_ordermaintain_if-orderadm_i
ct_input_fields = it_crmt_input_field_tab
cv_log_handle = gv_log_handle
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ls_bad_orderadm_h-orderadm_h_guid = lv_guid.
INSERT ls_bad_orderadm_h-orderadm_h_guid INTO TABLE lt_objects_to_save.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_objects_to_save
iv_update_task_local = ''
iv_save_frame_log = 'X'
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception
CHANGING
cv_log_handle = lv_loghandle
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
Dear Experts,
Thanks for your suggestion, actually am creating the contract using my coding, now i have a task that in my excel sheet am having the customer & product. I want to generate 1 contract for one customer, but he having multiple line items, so i need to add all the items and call the crm_order_maintain, one by one customer it should work like this.
How to make the code or how to validate this.
Suggestion please, my excel looks like below,
Sold-to-party | Product Id | Quantity | start date | end date |
30002012 | GARBADAX | 1 | 12/12/2013 | 11/12/2014 |
30002012 | PARBAHAX | 10 | 12/12/2013 | 11/12/2014 |
30002012 | SLANDRAX | 12 | 12/10/2013 | 11/10/2014 |
65002014 | CLAXXAX | 1 | 31/02/2013 | 11/12/2014 |
65002014 | ZORAXHAX | 10 | 17/12/2013 | 11/12/2014 |
39002018 | MKARAXHAX | 19 | 11/10/2013 | 11/10/2014 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anandhan,
Check your code.
s_crmt_input_field-ref_handle = '0000000001'.
This ref handle should be the handle of item. And in item's ref_handle, you need to pass handle of header.
Also if you are using handles, there is no need of guid. Also check whether you passed the field names correctly or not.
See SAP delivered program - CRM_TEST_ORDER_MAINTAIN to see how to use CRM_ORDER_MAINTAIN to create order.
And yes, once you crack it, your requirement can be handled with this code.
Regards
Niraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.