Changed Service Order Status
Upon Service Confirmation
Change Status of Preceding Document As of now we are updating the status of preceding doc by using ORDER_SAVE Badi. or The Method SET_DOCUMENT_STATUS in processing type which could be use for doing same. or I had worked on scenario where we have changed service order status upon service confirmation status gets completed. I have used a Zmethod to achieve this. Find the below code which I used. Hope it may be useful to you to create Zmethod. method IF_EX_EXEC_METHODCALL_PPF~EXECUTE . data: lv_guid_ref
type crmt_object_guid,
* get the object GUID for processing create object lc_action_execute. call method lc_action_execute->get_ref_object
* If the GUID is not present then get the information
from the object
if lv_guid_ref is initial.
* check the GUID before processing check not lv_guid_ref is initial. * Read the document flow to retrieve the service order number CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
* determine if this service confirmation has a service order describe table doc_info lines sy-tabix. check sy-tabix gt 0. read table doc_info into doc_links with key objtype_a = 'BUS2000116'. * set the user status to Complete upon save of the
move doc_links-objkey_a to header_guid. * call function 'CRM_STATUS_BUFFER_REFRESH'. * Lock the service order call function 'CRM_ORDER_ENQUEUE'
* Check if the service order is locked if sy-subrc = 1 or sy-subrc = 3.
* Change the header status move header_guid to object_no. call function 'CRM_STATUS_CHANGE_EXTERN_OW'
* Change the line item status CALL FUNCTION 'CRM_ORDERADM_I_READ_DB'
* read each item and change the status loop at order_items into order_item where itm_type ne 'SRVS'. move order_item-guid to object_no. call function 'CRM_STATUS_CHANGE_EXTERN_OW'
* Save the status if sy-subrc eq 0.
* set the return processing status if sy-subrc eq 0.
endmethod. *--- End ---
Get help for your ABAP problems
ABAP Books
More ABAP Tips
SAP Basis, ABAP Programming and Other IMG Stuff http://www.erpgreat.com All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|