转载来自SCN:
- include crm_object_names_con.
- data:
- lt_header_guids type crmt_object_guid_tab,
- ls_header_guids type crmt_object_guid,
- lt_orderadm_h type crmt_orderadm_h_wrkt,
- lt_opport_h type crmt_opport_h_wrkt,
- lt_status type crmt_status_wrkt,
- lt_text type crmt_text_wrkt,
- lt_partner type crmt_partner_external_wrkt,
- lt_service_os type crmt_srv_osset_wrkt,
- ls_orderadm_h like line of lt_orderadm_h,
- ls_opport_h like line of lt_opport_h,
- ls_status like line of lt_status,
- ls_text like line of lt_text,
- ls_partner like line of lt_partner,
- ls_service_os like line of lt_service_os,
- lt_request_objs type crmt_object_name_tab.
- * 1. First you need to choose which tables you want to get back.
- * In this example I want to read 6 tables, so I need to add them into the “request_objs” table
- insert gc_object_name-orderadm_h into table lt_request_objs.
- insert gc_object_name-opport_h into table lt_request_objs.
- insert gc_object_name-status into table lt_request_objs.
- insert gc_object_name-texts into table lt_request_objs.
- insert gc_object_name-partner into table lt_request_objs.
- insert gc_object_name-service_os into table lt_request_objs.
- * 2. Second you need to make a table “lt_header_guids” with all the guids in that you want to read
- * These GUIDs are stored as RAW16 type, in the table,
- * so you may need to convert them from CHAR32
- data: lv_guid_char type char32.
- lv_guid_char = ’#32 char long GUID#’.
- ls_header_guids = cl_ibase_service=>cl_convert_guid_32_16( lv_guid_char ).
- append ls_header_guids to lt_header_guid.
- *3. You’re now read to read! It’s that simple!
- call function 'CRM_ORDER_READ'
- exporting
- it_header_guid = lt_header_guids
- it_requested_objects = lt_request_objs
- iv_no_auth_check = 'X'
- importing
- et_orderadm_h = lt_orderadm_h
- et_opport_h = lt_opport_h
- et_text = lt_text
- et_partner = lt_partner
- et_service_os = lt_service_os
- et_status = lt_status
- exceptions
- document_not_found = 1
- error_occurred = 2
- document_locked = 3
- no_change_authority = 4
- no_display_authority = 5
- no_change_allowed = 6.
- * sy-subrc = 0 if the read was successful.
- * If the read wasn’t it can mean that the GUID you entered isn’t valid/doesn’t exist.