Problem in CRM_ORDER_MAINTAIN
Dear Gurus,
I am trying to create a service order using CRM_ORDER_MAINTAIN and CRM_ORDER_SAVE.
I have observed the values from debuggin the actual order creation through CRMD_ORDER and i am passing those hardcoded values to the above mentioned FMs.
But in my case,the header is not generated saying header GUID is not found and thats why it is not creating any order also.can u please look into the code and tell me where m going wrong??
CALL FUNCTION '/CEM/CREATE_GUID'
IMPORTING
EV_GUID = guid
wa_sales-ref_handle = 1.
wa_sales-ref_guid = 0.
wa_sales-ref_kind = 'B'.
append wa_sales to it_sales.
wa_pricing-ref_handle = 1.
wa_pricing-ref_guid = 0.
wa_pricing-ref_kind = 'B'.
append wa_pricing to it_pricing.
wa_shipping-ref_handle = 1.
wa_shipping-ref_guid = 0.
wa_shipping-ref_kind = 'B'.
append wa_shipping to it_shipping.
wa_product_i-ref_handle = 1.
append wa_product_i to it_product_i.
wa_schedlines-QUANTITY = 3.
append wa_schedlines to schedlines.
wa_schedlin_i-ref_handle = 1.
wa_schedlin_i-SCHEDLINES = schedlines.
append wa_schedlin_i to it_schedlin_i.
wa_partner-REF_GUID = guid.
wa_partner-ref_handle = 1.
wa_partner-ref_kind = 'A'.
wa_partner-REF_PARTNER_HANDLE = 0001.
wa_partner-KIND_OF_ENTRY = 'C'.
wa_partner-PARTNER_FCT = 00000001.
wa_partner-PARTNER_NO = 0000000171.
wa_partner-DISPLAY_TYPE = 'BP'.
wa_partner-NO_TYPE = 'BP'.
append wa_partner to it_partner.
wa_partner-REF_GUID = guid.
wa_partner-ref_handle = 2.
wa_partner-ref_kind = 'A'.
wa_partner-REF_PARTNER_HANDLE = 0002.
wa_partner-KIND_OF_ENTRY = 'C'.
wa_partner-PARTNER_FCT = 00000002.
wa_partner-PARTNER_NO = 0000000171.
wa_partner-DISPLAY_TYPE = 'BP'.
wa_partner-NO_TYPE = 'BP'.
append wa_partner to it_partner.
wa_field_name-fieldname = 'MODE'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'ORDERED_PROD'.
append wa_field_name to field_name.
wa_input_fields-ref_handle = 1.
wa_input_fields-ref_guid = 0.
wa_input_fields-objectname = 'ORDERADM_I'.
wa_input_fields-FIELD_NAMES = field_name.
append wa_input_fields to ct_input_fields.
clear field_name.
refresh field_name.
wa_field_name-fieldname = 'DISPLAY_TYPE'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'KIND_OF_ENTRY'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'NO_TYPE'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'PARTNER_FCT'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'PARTNER_NO'.
append wa_field_name to field_name.
wa_input_fields-ref_handle = 2.
wa_input_fields-ref_guid = guid.
wa_input_fields-ref_kind = 'A'.
wa_input_fields-objectname = 'PARTNER'.
wa_input_fields-FIELD_NAMES = field_name.
wa_input_fields-logical_key = 001.
append wa_input_fields to ct_input_fields.
clear field_name.
refresh field_name.
wa_field_name-fieldname = 'DISPLAY_TYPE'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'KIND_OF_ENTRY'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'NO_TYPE'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'PARTNER_FCT'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'PARTNER_NO'.
append wa_field_name to field_name.
wa_input_fields-ref_handle = 3.
wa_input_fields-ref_guid = guid.
wa_input_fields-ref_kind = 'A'.
wa_input_fields-objectname = 'PARTNER'.
wa_input_fields-FIELD_NAMES = field_name.
wa_input_fields-logical_key = 002.
append wa_input_fields to ct_input_fields.
clear field_name.
refresh field_name.
wa_field_name-fieldname = 'LOGICAL_KEY'.
append wa_field_name to field_name.
wa_field_name-fieldname = 'QUANTITY'.
append wa_field_name to field_name.
wa_input_fields-ref_handle = 4.
wa_input_fields-ref_guid = 0.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-objectname = 'SCHEDLIN'.
wa_input_fields-FIELD_NAMES = field_name.
wa_input_fields-logical_key = 0.
append wa_input_fields to ct_input_fields.
clear field_name.
refresh field_name.
wa_input_fields-ref_handle = 5.
wa_input_fields-ref_guid = 0.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-objectname = 'SCHEDLIN_I'.
wa_input_fields-FIELD_NAMES = field_name.
append wa_input_fields to ct_input_fields.
wa_orderadm_i-handle = 1.
wa_orderadm_i-header = guid.
wa_orderadm_i-ORDERED_PROD = 'ZSH_ADDON'.
wa_orderadm_i-MODE = 'A'.
append wa_orderadm_i to ct_orderadm_i.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_OPPORT_H = IT_OPPORT_H
IT_LEAD_H = IT_LEAD_H
IT_ACTIVITY_H = IT_ACTIVITY_H
IT_SALES = IT_SALES
IT_PRICING = IT_PRICING
IT_PRICING_I = IT_PRICING_I
IT_PRIDOC = IT_PRIDOC
IT_ORGMAN = IT_ORGMAN
IT_SHIPPING = IT_SHIPPING
IT_ACTIVITY_I = IT_ACTIVITY_I
IT_PRODUCT_I = IT_PRODUCT_I
IT_BATCH = IT_BATCH
IT_FINPROD_I = IT_FINPROD_I
IT_STRUCT_I = IT_STRUCT_I
IT_CONFIG = IT_CONFIG
IT_PAYPLAN = IT_PAYPLAN
IT_PAYPLAN_D = IT_PAYPLAN_D
IT_CUSTOMER_H = IT_CUSTOMER_H
IT_CUSTOMER_I = IT_CUSTOMER_I
IT_SERVICE_H = IT_SERVICE_H
IT_SERVICE_I = IT_SERVICE_I
IT_SERVICE_ASSIGN = IT_SERVICE_ASSIGN
IT_QUALIF = IT_QUALIF
IT_APPOINTMENT = IT_APPOINTMENT
IT_TEXT = IT_TEXT
IT_SCHEDLIN_I = IT_SCHEDLIN_I
IT_PARTNER = IT_PARTNER
IT_SERVICE_OS = IT_SERVICE_OS
IT_REFOBJ = IT_REFOBJ
IT_SUBJECT = IT_SUBJECT
IT_CANCEL = IT_CANCEL
IT_CANCEL_IR = IT_CANCEL_IR
IT_CANCEL_DATES = IT_CANCEL_DATES
IT_STATUS = IT_STATUS
IT_BILLPLAN = IT_BILLPLAN
IT_BILLING = IT_BILLING
IT_ORDPRP_I = IT_ORDPRP_I
IT_ORDPRP_I_D = IT_ORDPRP_I_D
IT_ORDPRP_OBJL_I_D = IT_ORDPRP_OBJL_I_D
IT_CUMULATED_I = IT_CUMULATED_I
IT_SERVICEPLAN_I = IT_SERVICEPLAN_I
IT_SERVICEPLAN_IE = IT_SERVICEPLAN_IE
IT_PRICE_AGREEMENTS_BBP = IT_PRICE_AGREEMENTS_BBP
IT_PRICE_AGREEMENTS_CRM = IT_PRICE_AGREEMENTS_CRM
IT_CONFIG_FILTER = IT_CONFIG_FILTER
IT_AC_ASSIGN = IT_AC_ASSIGN
IT_SURVEY = IT_SURVEY
IT_EXTENSION = IT_EXTENSION
IT_ACTIVE_SWITCH = IT_ACTIVE_SWITCH
IT_UBB_CTR_I = IT_UBB_CTR_I
IT_UBB_CR_I = IT_UBB_CR_I
IT_UBB_VOL_I = IT_UBB_VOL_I
IT_APO_I = IT_APO_I
IT_CHNGPROC_I = IT_CHNGPROC_I
IT_EXT_REF = IT_EXT_REF
IT_DOC_FLOW_PNT = IT_DOC_FLOW_PNT
IT_CHNGPROC_H = IT_CHNGPROC_H
IT_FUND_H = IT_FUND_H
IT_CLA_H = IT_CLA_H
IMPORTING
ET_EXCEPTION = ET_EXCEPTION
CHANGING
CT_ORDERADM_H = CT_ORDERADM_H
CT_ORDERADM_I = CT_ORDERADM_I
CT_INPUT_FIELDS = CT_INPUT_FIELDS
CV_LOG_HANDLE = CV_LOG_HANDLE
CT_PARTNER_ATTRIBUTES = CT_PARTNER_ATTRIBUTES
CT_DOC_FLOW = CT_DOC_FLOW
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.
read table ct_orderadm_i into wa_orderadm_i index 1.
guid = wa_orderadm_i-header.
wa_objects_to_save = guid.
append wa_objects_to_save to it_objects_to_save.
iv_update_task_local = 'X'.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
IT_OBJECTS_TO_SAVE = it_objects_to_save
IV_UPDATE_TASK_LOCAL = iv_update_task_local
IV_SAVE_FRAME_LOG = FALSE
IV_NO_BDOC_SEND = FALSE
IMPORTING
ET_SAVED_OBJECTS = ET_SAVED_OBJECTS
ET_EXCEPTION = ET_EXCEPTION
ET_OBJECTS_NOT_SAVED = ET_OBJECTS_NOT_SAVED
CHANGING
CV_LOG_HANDLE = CV_LOG_HANDLE
EXCEPTIONS
DOCUMENT_NOT_SAVED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
commit work.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
Hello Deepthee,
I don't have code available here, but I builted before using this strategy:
Put a session break-point to CRM_ORDER_MAINTAIN function.
Then go to CRMD_ORDER transaction and make the change you want to reflect in your code. Press enter or save it.
The session debug will be launched and you may observe the internal table associated (for example: IT_PARTNER or IT_PRODUCT_I) and the internal table for input fields.
Observing that will help you to fill the necessary fields for your new document.
If you face difficulties, write back with your code and I'll try to help you.
Regards,
Bruno
Similar Messages
-
Problem in CRM_ORDER_MAINTAIN for updating amount in line items
Hi abapers,
I have a scenario as follows: i want to update amount for line items in a transaction. i use the bapi crm_order_maintain followed by CRM_ORDER_SAVE and bapi transaction _commit . The problem is i loop the itab by passing the trnstn id , prdct code and new amount.
i applied the logic as given by rita tan (thread no 4)
link:[Re: Update Pricing Document with CRM_ORDER_MAINTAIN]
as per the logic i delete the existing value and insert the new amount . this works fine in the first loop and in second loop it deletes the existing record but does not insert the new value . It doesn't even give error too. what may be the problem.
here's a snapshot of the code i have written:
loop at itab.
SELECT SINGLE * FROM CRMD_ORDERADM_H
WHERE OBJECT_ID = WA_ZCMR_UPDATE-Z_OBJECTID
AND PROCESS_TYPE = P_TYPE.
SELECT SINGLE * FROM CRMD_ORDERADM_I
WHERE HEADER = CRMD_ORDERADM_H-GUID
AND ORDERED_PROD = WA_ZCMR_UPDATE-PRODUCT_CODE.
SELECT SINGLE * FROM CRMD_LINK
WHERE GUID_HI = CRMD_ORDERADM_H-GUID
AND OBJTYPE_SET = '18'.
SELECT * FROM PRCD_COND
INTO CORRESPONDING FIELDS OF TABLE IT_PRCD_COND
WHERE KNUMV = CRMD_LINK-GUID_SET
AND KPOSN = CRMD_ORDERADM_I-GUID
AND KSCHL = 'ZR12'.
READ TABLE IT_PRCD_COND
INTO WA_PRCD_COND INDEX 1.
DELETE FROM PRCD_COND
WHERE KNUMV = WA_PRCD_COND-KNUMV
AND KPOSN = WA_PRCD_COND-KPOSN
AND KSCHL = 'ZR12'.
COMMIT WORK.
WA_PRIDOC-REF_HANDLE = '0000000001'.
WA_PRIDOC-REF_GUID = CRMD_ORDERADM_I-GUID.
WA_PRIDOC-REF_KIND = 'B' .
WA_COND_ADD-KSCHL = 'ZR12'.
WA_COND_ADD-KBETR = WA_ZCMR_UPDATE-NET_VALUE.
WA_COND_ADD-KPEIN = '1'.
WA_COND_ADD-WAERS = 'INR'.
INSERT WA_COND_ADD INTO TABLE IT_COND_ADD.
CLEAR WA_COND_ADD.
WA_PRIDOC-COND_ADD = IT_COND_ADD.
CLEAR IT_COND_ADD[].
INSERT WA_PRIDOC INTO TABLE IT_PRIDOC .
CLEAR WA_PRIDOC .
WA_CT_INPUT_FIELDS1-REF_HANDLE = '0000000001'.
WA_CT_INPUT_FIELDS1-REF_GUID = CRMD_ORDERADM_I-GUID.
WA_CT_INPUT_FIELDS1-REF_KIND = 'B' .
WA_CT_INPUT_FIELDS1-OBJECTNAME = 'PRIDOC'.
INSERT WA_CT_INPUT_FIELDS1 INTO TABLE IT_CT_INPUT_FIELDS1.
CLEAR WA_CT_INPUT_FIELDS1.
AT END OF Z_OBJECTID.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_PRIDOC = IT_PRIDOC
CHANGING
CT_INPUT_FIELDS = IT_CT_INPUT_FIELDS1
EXCEPTIONS
ERROR_OCCURRED = 1
DOCUMENT_LOCKED = 2
NO_CHANGE_ALLOWED = 3
NO_AUTHORITY = 4
OTHERS = 5.
CALL FUNCTION 'CRM_ORDER_SAVE'
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
endat.
endloop.
Please help out.
Regards,
Navin
Edited by: navin.c on Jan 7, 2010 10:09 AMCheck the link below. This should help
Re: Change Order Quantity in CRM Sales Order -
Problem in CRM_ORDER_MAINTAIN for updating qty in more than 1 line item .
Hi abapers,
I am using BAPI CRM_ORDER_MAINTAIN to update quantity. Its updating the quantity properly if there is single line item for a transaction .If more than 1 line item is there then its throwing an exception* "Document is being distributed - changes are not possible"*.
Scenario:
I have a itab which is having 2 line items for a transaction. i run a loop pass the pass the required parameters in CRM_ORDER_MAINTAIN ,do CRM_ORDER_SAVE , BAPI_TRANSACTION_COMMIT for the 1st line item. When i run the 2nd loop, in CRM_ORDER_MAINTAIN it gives an exception saying NO_CHANGE_ALLOWED for the same transactions 2nd line item. leaving the quantity unchanged for both the line items. What may be the problem?
Note: We cannot say how many line items are there for an transaction. so no chance of grouping all items at a time and saving at a time.
Regards,
NavinHi Navin,
Why its not possible to use CRM_ORDER_SAVE only once. I think its possible. Call CRM_ORDER_MAINTAIN in loop for all the line item in transaction and after that call CRM_ORDER_SAVE once. Pls follow the below sample code.
loop at it_item.
call CRM_ORDER_MAINTAIN. (Here append data for all the line items and miantin the transaction).
emdloop.
After endloop call CRM_ORDER_SAVE. Also you can add some wait after CRM_ORDER_SAVE, In order to avoid locking issue.
PLs let me know where you are trying to use CRM_ORDER_MAINATIAN ? In any BADI or Z program ?
Regards,
Amol. -
Help: How to use 'CRM_ORDER_MAINTAIN'
Hi All,
I want to create a sales order with following requirements.
1) schedule lines having requesting dates for which vendor cannot deliver.
2) change the status from open to some other status.
i this i have to use
'CRM_ORDER_MAINTAIN". but i want to know will this API takes care of updating ERP system?
when i change the status will it also update the purchase order in ERP?
And also give me some code as how to change status and change schedule lines using 'CRM_ORDER_MAINTAIN".
Thanks in advance,
Regards,
UjwalkumarHi Robin,
I am facing problem with CRM_ORDER_MAINTAIN.
I am trying to change the status of service order from New to Shipped.
Below is my code.Please look into it and let me the issue.
Thanks.Rushikesh
REPORT ZRD1.
data:IT_STATUS TYPE CRMT_STATUS_COMT,
wa like line of it_status.
DATA : ls_input_field TYPE crmt_input_field,
ls_input_field_names TYPE crmt_input_field_names,
lt_input_fields TYPE crmt_input_field_tab,
CT_PARTNER_ATTRIBUTES TYPE CRMT_PARTNER_ATTRIBUTE_COM_TAB,
l_i_orderadm_h TYPE CRMT_ORDERADM_H_COMT,
l_i_orderadm_i TYPE CRMT_ORDERADM_I_COMT,
l_i_obj_guids TYPE CRMT_OBJECT_GUID_TAB,
ls_i_obj_guids like line of l_i_obj_guids.
wa-REF_GUID = '47FDBF975F6100E1E10080000A0630A7'.
wa-ref_kind = 'B'.
wa-status = 'E0023'.
wa-USER_STAT_PROC = 'ZRV_ST01'.
wa-activate = 'X'.
APPEND wa TO it_status.
ls_input_field-ref_guid = '47FDBF975F6100E1E10080000A0630A7'.
ls_input_field-ref_kind = 'B'.
ls_input_field_names-fieldname = 'REF_GUID'.
INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = 'REF_KIND'.
INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = 'STATUS'.
INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = 'USER_STAT_PROC'.
INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = 'ACTIVATE'.
INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.
INSERT ls_input_field INTO TABLE lt_input_fields.
*Start of solution1.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_STATUS = IT_STATUS
CHANGING
CT_INPUT_FIELDS = lt_INPUT_FIELDS
ct_orderadm_h = l_i_orderadm_h
ct_orderadm_i = l_i_orderadm_i
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_i_obj_guids = '47FDBF975F6100E1E10080000A0630A7'.
append ls_i_obj_guids to l_i_obj_guids.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = l_i_obj_guids
EXCEPTIONS
document_not_saved = 1. -
Crm_order_maintain---insert a partner
Hi guys, I've got a problem with crm_order_maintain!
I want to create a new service contract (subcontract from a master contract) but I don't know how to insert a sold-to-party because in the table et_partner there isn't the field 'MODE'.
Someone can halp me to resolve my problem?
Thanks,
Lorenzo
Message was edited by:
Lorenzo NeviHi Nevi,
Refer the following piece of code to insert the partner on the basis of partner_fct field in et_partner :
* Sold to Party
MOVE: lv_header_guid TO wa_partner-ref_guid,
'A' TO wa_partner-ref_kind,
'0001' TO wa_partner-ref_partner_handle,
lc_stp TO wa_partner-partner_fct,
"lc_stp is partner function for sold to party
gv_partner TO wa_partner-partner_no,
'BP' TO wa_partner-no_type,
'BP' TO wa_partner-display_type,
lc_true TO wa_partner-mainpartner.
APPEND wa_partner TO lit_partner.
CLEAR wa_partner.
* Fill input fields
MOVE: lv_header_guid TO wa_inputfields-ref_guid,
lc_header TO wa_inputfields-ref_kind,
'0001' TO wa_inputfields-logical_key,
lc_partner TO wa_inputfields-objectname.
MOVE lc_partner_fct TO wa_inputfields-fieldname.
APPEND wa_inputfields TO lit_inputfields.
Pass these tables to BAPI_BUSPROCESSND_CHANGEMULTI along with header and item tables. This BAPI internally calls CRM_ORDER_MAINTAIN.
<b>Reward points if it helps.</b> -
CRM_ORDER_MAINTAIN Save Function problem
Hi
We are trying to create Grantor applications in SAPM CRM 6.0 using Function Module CRM_ORDER_MAINTAIN.
From an ABAP program we are passing the parameters in order to recreate the same scenario that is used in the Standard SAP CRM Web to create this type of applications.
When the CRM_ORDER_MAINTAIN function is called the returned code is 0 (zero), we think that is no problem. Then, the CRM_ORDER_SAVE function needs to be call passing the u201CGUID of a CRM Order Objectu201D as parameter that is generated with the last order. But in this case the returned code is 1 which means u201Cdocument_not_saveu201D.
We also tried calling the CRM_ORDER_MAINTAIN function passing as parameters only the u201Cct_orderadm_hu201D table with the value u201CGAPu201D in the field u201Cprocess_typeu201D, and the table u201Cct_input_fieldsu201D with the value u201Corderadm_hu201D in the field u201Cobjectnameu201D; all this in order to create the u201CGUID of a CRM Order Objectu201D. And then use that GUID again in the CRM_ORDER_MAINTAIN function.
When calling the CRM_ORDER_MAINTAIN function a DUMP is generated because of the data contained in the table CT_DOC_FLOW. This dump has the type of message u201CCRM_DOC_FLOW No. 010u201D u201CDocument flow record could not be generatedu201D. The table result is:
4ABA4D7B372E0194E1008000AC137072 (Grantor ID in which the application will remain)
BUS2100010 (Business Transaction Type of Grantor application)
4AEA377815A301E6E1008000AC137072 (ID generated for the application)
BUS2000270 (Business Transaction Type)
If the ID is not sent, no error message is generated but also the record is not created.
We also test the CRM_TEST_ORDER_MAINTAIN function with the standard program passing the operation type u201CGAPu201D as parameter. But the execution of the program generates a DUMP. If the function is test with another type of operation as parameter, the program executes correctly generating the corresponding records.
If the u201CGUID of a CRM Order Objectu201D is generated calling the GUID_CREATE function, when calling the CRM_ORDER_SAVE function a DUMP is generated with type message X of class CRM_ORDER Nol 009 u201CIncorrect values in interface parametersu201D.
Please any idea to solve it.
Thanks in advanced,
OsmanyHi,
concerning first part of your post - "document_not_save" is usually posted if some validations were not passed by new document.
it could be for example implementation of badi order_save.
You should debug function module crm_order_save and look for message with reason for not saving.
Regards
Radek -
CRM_ORDER_MAINTAIN problems
Hello.
I'm trying to insert new partner entries to the activity in a badi ORDER_SAVE (pf 00000026). How can I add these entries without loosing other entries with different partner functions?
I have tried to call fm CRM_ORDER_MAINTAIN and I'm able to insert new entries by following logic introduced in test program CRM_TEST_ORDER_MAINTAIN. When calling this fm all other entries are deleted.
What am I missing here?
Br, Johannes
Message was edited by: Johannes MitronenHello Frederic!
Thank you for your answer. I finally managed to accomplish my goals. Other entries were deleted because I used an another fm with obviously wasn't the right one. Everything started to work when I also delete unwanted entries using fm CRM_ORDER_MAINTAIN.
Here's how I do it (if somebody else is struggling with similar kind of problems):
<b>1. Add new entries</b>
LOOP AT lt_entries INTO ls_entries.
ADD 1 TO counter.
CLEAR ls_new_partners.
ls_new_partners-ref_guid = ls_orderadm_h-guid.
ls_new_partners-ref_kind = ls_entries-ref_kind. "A
ls_new_partners-kind_of_entry = 'C'.
ls_new_partners-ref_partner_handle = counter.
ls_new_partners-partner_fct = ls_entries-partner_fct.
ls_new_partners-partner_no = ls_entries-partner.
ls_new_partners-display_type = 'BP'.
ls_new_partners-no_type = 'BP'.
INSERT ls_new_partners INTO TABLE lt_new_partners.
CLEAR ls_input_fields.
REFRESH ls_input_fields-field_names.
ls_input_fields-ref_guid = ls_new_partners-ref_guid.
ls_input_fields-ref_kind = ls_new_partners-ref_kind. "A
ls_input_fields-objectname = 'PARTNER'.
MOVE-CORRESPONDING ls_new_partners TO ls_logical_key.
ls_input_fields-logical_key = ls_logical_key.
ls_input_field_name-fieldname = 'PARTNER_FCT'.
INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
ls_input_field_name-fieldname = 'NO_TYPE'.
INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
ls_input_field_name-fieldname = 'DISPLAY_TYPE'.
INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
ls_input_field_name-fieldname = 'PARTNER_NO'.
INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
ls_input_field_name-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ENDLOOP.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_partner = lt_new_partners
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
<b>2. Delete entries</b>
LOOP AT lt_partner INTO ls_partner.
MOVE-CORRESPONDING ls_partner TO ls_new_partners.
* clear some fields for delete operation
CLEAR ls_new_partners-ref_partner_handle.
CLEAR ls_new_partners-partner_fct.
INSERT ls_new_partners INTO TABLE lt_new_partners.
CLEAR ls_input_fields.
REFRESH ls_input_fields-field_names.
ls_input_fields-ref_guid = ls_new_partners-ref_guid.
ls_input_fields-ref_kind = ls_new_partners-ref_kind.
ls_input_fields-objectname = 'PARTNER'.
* create logical key for delete operation
CONCATENATE '0000' ls_partner-partner_fct ls_partner-partner_no INTO ls_input_fields-logical_key.
CONCATENATE ls_partner-ref_no_type ls_partner-ref_no_type INTO id.
WRITE id TO ls_input_fields-logical_key+28.
ls_input_field_name-fieldname = 'PARTNER_FCT'.
INSERT ls_input_field_name INTO TABLE ls_input_fields-field_names.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ENDLOOP.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_partner = lt_new_partners
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
Enjoy!
- Johannes -
CRM_ORDER_MAINTAIN usage problem
Hi all,
I am using this function module to create a new activity. I am able to populate most of the fields, but somehow partner data is not getting populated on the first go, whereas if i write the code to edit partner data by passing "Guid" in the function module, it is getting saved.
My doubt is, is it not possible to save partner data (Owner, Activity Partner and Contact Person) in an activity without giving GUID?
I am using the following code:
wa_partner-REF_KIND = 'A'.
****wa_partner-REF_GUID = wa_l_i_orderadm_h-GUID.
wa_partner-REF_PARTNER_HANDLE = '0000000001'.
wa_partner-PARTNER_NO = '121'.
wa_partner-PARTNER_FCT = '00000022'.
wa_partner-NO_TYPE = 'BP'.
wa_partner-DISPLAY_TYPE = 'BP'.
wa_partner-KIND_OF_ENTRY = 'C'.
INSERT wa_partner INTO TABLE it_partner.
clear gs_input_fields_i_com_names.
gs_input_fields_i_com_names-FIELDNAME = 'PARTNER_NO'.
INSERT gs_input_fields_i_com_names INTO TABLE gs_input_fields_i_com-field_names.
gs_input_fields_i_com_names-FIELDNAME = 'PARTNER_FCT'.
INSERT gs_input_fields_i_com_names INTO TABLE gs_input_fields_i_com-field_names.
gs_input_fields_i_com_names-FIELDNAME = 'NO_TYPE'.
INSERT gs_input_fields_i_com_names INTO TABLE gs_input_fields_i_com-field_names.
gs_input_fields_i_com_names-FIELDNAME = 'DISPLAY_TYPE'.
INSERT gs_input_fields_i_com_names INTO TABLE gs_input_fields_i_com-field_names.
gs_input_fields_i_com_names-FIELDNAME = 'KIND_OF_ENTRY'.
INSERT gs_input_fields_i_com_names INTO TABLE gs_input_fields_i_com-field_names.
gs_input_fields_i_com-ref_handle = '0000000001'.
*****gs_input_fields_i_com-ref_guid = wa_l_i_orderadm_h-GUID.
gs_input_fields_i_com-REF_KIND = 'A'.
gs_input_fields_i_com-OBJECTNAME = 'PARTNER'.
gs_input_fields_i_com-logical_key = '0001'.
INSERT gs_input_fields_i_com INTO TABLE gt_input_fields_i_com.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_ACTIVITY_H = it_activity
IT_STATUS = it_status
it_schedlin_i = gt_schedlin_i_com
it_partner = it_partner
* IMPORTING
* ET_EXCEPTION =
CHANGING
CT_INPUT_FIELDS = gt_input_fields_i_com
ct_orderadm_h = l_i_orderadm_h
EXCEPTIONS
ERROR_OCCURRED = 1
DOCUMENT_LOCKED = 2
NO_CHANGE_ALLOWED = 3
NO_AUTHORITY = 4
OTHERS = 5
Same code works fine if i remove the commented part (that is giving guid).
Please help.
Regards,
Rohit
Edited by: Rohit Khetarpal on Aug 25, 2008 1:11 PMsolved by myself
-
CRM_ORDER_MAINTAIN probability problem
i use CRM_ORDER_MAINTAIN to create order.
In this order I have several partners, items etc.
in opport_i use following code:
ls_opport_h-ref_handle = 1.
ls_opport_h-curr_phase = lv_curr_phase.
ls_opport_h-expect_end = lv_expect_end.
ls_opport_h-probability = lv_probability.
INSERT ls_opport_h INTO TABLE lt_opport_h.
CLEAR ls_input.
ls_input-objectname = 'OPPORT_H'.
ls_input-ref_handle = 1.
ls_input-ref_kind = 'A'.
ls_input_field_name-fieldname = 'CURR_PHASE'.
INSERT ls_input_field_name INTO TABLE ls_input-field_names.
ls_input_field_name-fieldname = 'EXPECT_END'.
INSERT ls_input_field_name INTO TABLE ls_input-field_names.
ls_input_field_name-fieldname = 'PROBABILITY'.
INSERT ls_input_field_name INTO TABLE ls_input-field_names.
INSERT ls_input INTO TABLE lt_input.
order is saved without any errors.
All fields except probability are filled correctly. I tried using field sys_probability and debugging crdm_order_maintain. It seems i put the same data but still my probablity is not filled.
Can you give some tips about that?
regards,
wojciech.solved by myself
-
Problem with FM CRM_ORDER_MAINTAIN
Hi All
I am investigating the use of function module CRM_ORDER_MAINTAIN. I need to update 1000+ orders in CRM 4.0 and know I need to use this FM. I have tested it's use in SE38 using the default standard interface.
I have worked out how to amend the DESCRIPTION at ORDERADM_H, this is basic stuff.
My requirement is to do the following:
1. Add a new partner
2. Amend item level dates (APPOINTMENT, APPT_TYPE = SRV_CUST_BEG + SRV_CUST_END)
3. Add item level Service Contract data.
The first thing I notice is that for Appointment dates, using the FM GUI, I cannot input data for SRV_CUST_BEG + SRV_CUST_END.
I am struggling to add a new partner,
and I have no idea how to add the service contract data.
I am continuing to investigate by looking at underlying tables
CRMD_LINK
CRMC_OBJECTS
etc.
but I could do with some help or advice.
Thanks
MarkHi Mike,
Try searching on SDN, there are many codes that can help you achieve this functionality.
For eg. I searched and found one thread abt adding partner details:
How to create a partner and header record using CRM_ORDER_MAINTAIN?
Regards,
Saumya -
Weird problem about FM 'CRM_ORDER_MAINTAIN'
Hello ,all:
I try to modify some infomation about a sales order using FM 'CRM_ORDER_MAINTAIN'.But how strange,for instance,it can be successful for the first time in the morning (a.m)and the FM executes a long time ,then modified infomation is ok.
And modify again using FM in succession,it will fail.However,in the afternoon(p.m),execute it again and will be successful.So, i think may be after a big interval,modify will successful.
I don't know why and how to using the FM and look forward to your greate help.
Thanks.Hi,
You need to use FM 'BAPI_TRANSACTION_COMMIT' or 'CRM_ORDER_SAVE' after executing FM 'CRM_ORDER_MAINTAIN' so that your changes are not in buffer but are relected down till the Database and you can see it next time you open your transaction.
Best Regards,
Pratik Patel
<b>Reward with points!</b> -
How to use crm_order_maintain
hi Experts,
i am new to CRM .i am creating aweb dynpro application for service desk for message creation with few custom fields . for that i analysed standard transcation crmd_order , how it is creating transaaction . i found it is using crm_order_maintain in side to creating the message . i debbugged tht by putting a break-point before calling this FM . but my problem is i dont know how to populate data into the import parameters of the this FM . so can any body give idea how to populate data of import parameters of this FM . any standard prg or any link witch can help me for populating the data into the import parameters. pl suggest any links for understanding the basic CRM.
thanks in advance
setu
Edited by: setu s on Dec 22, 2008 6:24 PMHi,
The following link provides an example of function module CRM_ORDER_MAINTAIN:
https://www.sdn.sap.com/irj/scn/wiki?path=/display/crm/creation%252bof%252bquatation%252bsample%252bcode
Hope this help.
Cheers, -
No Partner details in new order : CRM_ORDER_MAINTAIN
Hi .....
I am trying to create new order in which i am getting error related to partner data though i am passing al the data into the CRM_ORDER_MAINTAIN function.
I am not able to figure out what is the problem.
Following is my code part ->
READ TABLE lt_src_partner_or INTO ls_src_partner_or
WITH KEY ref_guid = lv_guid_h
partner_fct = '00000004'.
if sy-subrc eq 0.
wa_partner-ref_guid = lv_guid_h."gs_sel_cont-guid_b.
wa_partner-ref_handle ='0000000000'.
wa_partner-ref_kind = ls_src_partner_or-ref_kind. "'A' .
wa_partner-ref_partner_handle = ls_src_partner_or-ref_partner_handle."'0000'.
wa_partner-ref_partner_fct = ls_src_partner_or-ref_partner_fct. "'00000003' .
wa_partner-ref_partner_no = ls_src_partner_or-ref_partner_no. "100040 " THIS IS THE OLD value
wa_partner-ref_no_type = ls_src_partner_or-ref_no_type.
wa_partner-ref_display_type = ls_src_partner_or-ref_display_type.
wa_partner-partner_guid = ls_src_partner_or-partner_guid .
wa_partner-kind_of_entry = ls_src_partner_or-kind_of_entry. " 'C'
wa_partner-partner_fct = ls_src_partner_or-partner_fct. " 00000003 "new value
wa_partner-partner_no = ls_src_partner_or-partner_no."'92921'p_tbill. " 0000100007 " THIS IS THE NEW VALUE
wa_partner-display_type = ls_src_partner_or-display_type. " BP
wa_partner-no_type = ls_src_partner_or-no_type . " BP
wa_partner-mainpartner = ls_src_partner_or-mainpartner. " 'X'
wa_partner-relation_partner = ls_src_partner_or-relation_partner. " '00000000000000000000000000000000'
wa_partner-addr_nr = ls_src_partner_or-addr_nr . " '0000010673'
wa_partner-addr_np = ls_src_partner_or-addr_np . " ''
wa_partner-addr_type = ls_src_partner_or-addr_type." '1'.
append ls_tb_partner_om to lt_tb_partner_om.
INSERT wa_partner INTO TABLE it_partner.
endif.
clear : wa_partner, ls_src_partner_or.
* populate field_names
REFRESH lt_field_names.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
append ls_FIELD_NAMES to lt_FIELD_NAMES.
INSERT ls_field_names INTO TABLE lt_field_names ."lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
append ls_FIELD_NAMES to lt_FIELD_NAMES.
INSERT ls_field_names INTO TABLE lt_field_names ."lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
append ls_FIELD_NAMES to lt_FIELD_NAMES.
INSERT ls_field_names INTO TABLE lt_field_names."lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
append ls_FIELD_NAMES to lt_FIELD_NAMES.
INSERT ls_field_names INTO TABLE lt_field_names."lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
append ls_FIELD_NAMES to lt_FIELD_NAMES.
INSERT ls_field_names INTO TABLE lt_field_names."lt_field_names.
ls_field_names-fieldname = 'REF_PARTNER_NO'.
append ls_FIELD_NAMES to lt_FIELD_NAMES.
INSERT ls_field_names INTO TABLE lt_field_names."lt_field_names.
ls_field_names-fieldname = 'REF_PARTNER_FCT'.
append ls_FIELD_NAMES to lt_FIELD_NAMES.
INSERT ls_field_names INTO TABLE lt_field_names."lt_field_names.
build input fields
ls_input_fields-ref_handle = '0000000000'.
ls_input_fields-ref_guid = lv_guid_h . "4733030909B64D4D92A959BA5334B6F8.
ls_input_fields-ref_kind = 'A' .
ls_input_fields-objectname = 'PARTNER' .
old partner number needs to be passed here
CONCATENATE '000000000014' ls_src_partner_or-ref_partner_no ' BPBP' INTO ls_input_fields-logical_key. "=. "000000000003100040 BPBP
ls_input_fields-field_names = lt_field_names."lt_field_names.
INSERT ls_input_fields INTO TABLE ct_input_fields.
CONCATENATE '000000000002' ls_src_partner_or-ref_partner_no ' BPBP' INTO ls_input_fields-logical_key. "=. "000000000003100040 BPBP
ls_input_fields-field_names = lt_field_names."lt_field_names.
Set the first line for 000000000003
append ls_INPUT_FIELDS to lt_INPUT_FIELDS.
INSERT ls_input_fields INTO TABLE ct_input_fields."lt_input_fields.
CONCATENATE '000000000003' ls_src_partner_or-ref_partner_no ' BPBP' INTO ls_input_fields-logical_key. "=. "000000000003100040 BPBP
ls_input_fields-field_names = lt_field_names."lt_field_names.
Set the first line for 000000000003
append ls_INPUT_FIELDS to lt_INPUT_FIELDS.
INSERT ls_input_fields INTO TABLE ct_input_fields."lt_input_fields.
set the second line for 000000000004 - the only difference is the logical_key
CONCATENATE '000000000004' ls_src_partner_or-ref_partner_no ' BPBP' INTO ls_input_fields-logical_key. "=. "000000000004100040 BPBP
ls_input_fields-field_names = lt_field_names.
INSERT ls_input_fields INTO TABLE ct_input_fields.
Please tell me where i am wrong ???
Do i need to include some more fields in input parameters of crm_order_maintain function ?
please help me experts .
Thanks and regards
Edited by: Shoaibmemon on Jun 27, 2011 2:42 PMHi,
U need to execute a BAPI for customer master change. This needs to be checked whether we can call the BAPI through the exit u mentioned or even on Save.
Regards,
Deepak -
Adding item data in Product tab for sales contract (crm_order_maintain)
Hi, can I use crm_order_maintain to add line items under the product tab for a sales contract while creating or modifying an order. Is there any sample code to add the line items, I could look at. I tried calling this FM from my custom tab and then called CRM_ORDER_SAVE but that did not add the line item. I guess I need to call it from the order_save badi and then call the crm_order_save FM as well from within the BADI. If someone could send me some sample code then I can double check if I am missing something.Am I on the right track to be using this FM for adding a line item under the product tab for the sales contract? Please help. thanks
Hi, I've encountered the same problem while I was creating a Sub-Contract from a Master Contract.
In my case the solution was:
first create the Sub-Contract,
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
CHANGING
ct_orderadm_h = i_ctorderadm_h
ct_input_fields = i_ctinput_fields
ct_doc_flow = i_ctdoc_flow
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.
READ TABLE i_ctorderadm_h INTO wa_ctorderadm_h INDEX 1.
APPEND wa_ctorderadm_h-guid TO i_objects_to_save.
in wa_ctorderadm_h-guid now we have the guid of the newly created Sub-Contract.
SELECT SINGLE it_type_to
INTO v_it_type_to " --> target item type
FROM crmc_it_copy_ma
WHERE it_type_from = wa_out_orderadm_i-itm_type.
Prepare tables
wa_ctorderadm_i-header =
wa_out_orderadm_i-header. "Retrieved from CRM_ORDER_READ
wa_ctorderadm_i-handle = '0000000001'.
wa_ctorderadm_i-number_int = '0000000001'.
wa_ctorderadm_i-product = wa_out_orderadm_i-product.
wa_ctorderadm_i-ordered_prod =
wa_out_orderadm_i-ordered_prod.
wa_ctorderadm_i-description = wa_out_orderadm_i-description.
wa_ctorderadm_i-itm_type = v_it_type_to.
wa_ctorderadm_i-order_date = sy-datum.
wa_ctorderadm_i-itm_language = sy-langu.
wa_ctorderadm_i-mode = c_a. "c_a = 'A'
wa_ctorderadm_i-header = wa_ctorderadm_h-guid.
APPEND wa_ctorderadm_i TO i_ctorderadm_i.
wa_input_fields-ref_handle = '0000000001'.
wa_input_fields-objectname = 'ORDERADM_I'.
REFRESH i_input_field_names.
wa_input_field_names-fieldname = 'DESCRIPTION'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_field_names-fieldname = 'HEADER'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_field_names-fieldname = 'ITM_TYPE'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_field_names-fieldname = 'MODE'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_field_names-fieldname = 'NUMBER_INT'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_field_names-fieldname = 'ORDERED_PROD'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_field_names-fieldname = 'ORDER_DATE'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_field_names-fieldname = 'PRODUCT'.
APPEND wa_input_field_names TO i_input_field_names.
wa_input_fields-field_names = i_input_field_names.
APPEND wa_input_fields TO i_ctinput_fields.
After that I've called function 'CRM_ORDER_MAINTAIN', to copy the Items from the Master Contract.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_sales = i_sales
it_schedlin_i = i_schedlin_i
CHANGING
ct_orderadm_i = i_ctorderadm_i
ct_input_fields = i_ctinput_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
Maybe if you're not working with Contracts, the procedure is not properly correct.
I suggest to put a break-point into crm_order_maintain and try to add the Item manually.
If you reproduce exactly the standard, I'm shure it will work.
Lorenzo -
Problem Updating fields in Service Confirmation
Hi Experts,
I have a requirement to copy the service items to the service confirmation. To do this i am making an event and copying.I am successful in copying the items from Service order to confirmation once the items are released,but due to some CO integrations it is required to also populate the service order number and its item number to the confirmation item too,which i am not able to so.
I think i am missing something during CRM_ORDER_MAINTAIN for this entry.It will be a very great if you experts can guide me.
Thanks,
SAHi Experts,
I am now successful in Updating the fields, but right now my problem is when i have not kept any restriction on the status for the event i created, I find that during event trace it fires twice the event, once with the My user name Say 'X' and at the same time it fires with User name 'Y', which we have used for middle ware purposes.
Anybody has any idea why is tht so..and how can i correct it.
thanks,
SA
Maybe you are looking for
-
Why does the gmail page look different in windows than linux e.g. no stars available
gmail looks like a more "bare bones" page with no column to add stars. Also the boxes across the top: Archive, Report Spam, Delete, etc. do not work
-
Cannot connect to remote computer
Hi all, I've spent a lot of time trying to figure this out, would appreciate any help as I'm new to ARD, (3.3.2 version). Here goes... I have 5 Macs on my home network, and have had very little problem connecting and controlling them from ARD. My pro
-
How can i get a activation code sent to my email again for my apple id?
How can i get a activation code sent to my email again for my apple id?
-
Hi, I am using .Net PDK 1.0. I am often getting the error [NullReferenceException: Object reference not set to an instance of an object.] SAP.Portal.Framework.Core.PortalWorkerRequest.ReadEntityBody(Byte[] buffer, Int32 size) +119 System.Web.
-
How to display " %some string% " in JSP
In the following code the value of Parameter "greeting" is "<%some string%>" How do I escape it so that I can print it as it is. out.println("Greeting: " + request.getParameter("greeting")); thanks in advance. -a.