CRM_ORDER_READ 订单查询简单示例

来源:互联网 发布:php公众号自定义菜单 编辑:程序博客网 时间:2024/06/02 13:24

转载来自SCN:

  1. include crm_object_names_con.   
  2. data:   
  3.           lt_header_guids type crmt_object_guid_tab,   
  4.           ls_header_guids type crmt_object_guid,   
  5.           lt_orderadm_h type crmt_orderadm_h_wrkt,   
  6.           lt_opport_h type crmt_opport_h_wrkt,   
  7.           lt_status type crmt_status_wrkt,   
  8.           lt_text type crmt_text_wrkt,   
  9.           lt_partner type crmt_partner_external_wrkt,   
  10.           lt_service_os type crmt_srv_osset_wrkt,   
  11.           ls_orderadm_h like line of lt_orderadm_h,   
  12.           ls_opport_h like line of lt_opport_h,   
  13.           ls_status like line of lt_status,   
  14.           ls_text like line of lt_text,   
  15.           ls_partner like line of lt_partner,   
  16.           ls_service_os like line of lt_service_os,   
  17.           lt_request_objs type crmt_object_name_tab.   
  18. 1. First you need to choose which tables you want to get back.    
  19. * In this example I want to read 6 tables, so I need to add them into the “request_objs” table   
  20.   insert gc_object_name-orderadm_h into table lt_request_objs.   
  21.   insert gc_object_name-opport_h into table lt_request_objs.   
  22.   insert gc_object_name-status into table lt_request_objs.   
  23.   insert gc_object_name-texts into table lt_request_objs.   
  24.   insert gc_object_name-partner into table lt_request_objs.   
  25.   insert gc_object_name-service_os into table lt_request_objs.   
  26. 2. Second you need to make a table “lt_header_guids” with all the guids in that you want to read   
  27. * These GUIDs are stored as RAW16 type, in the table,    
  28. * so you may need to convert them from CHAR32   
  29. data: lv_guid_char type char32.   
  30. lv_guid_char = ’#32 char long GUID#’.   
  31. ls_header_guids = cl_ibase_service=>cl_convert_guid_32_16( lv_guid_char ).   
  32. append ls_header_guids to lt_header_guid.   
  33. *3. You’re now read to read! It’s that simple!   
  34. call function 'CRM_ORDER_READ'  
  35.     exporting   
  36.       it_header_guid       = lt_header_guids   
  37.       it_requested_objects = lt_request_objs   
  38.       iv_no_auth_check     = 'X'  
  39.     importing   
  40.       et_orderadm_h        = lt_orderadm_h   
  41.       et_opport_h             = lt_opport_h   
  42.       et_text                     = lt_text   
  43.       et_partner                = lt_partner   
  44.       et_service_os          = lt_service_os   
  45.       et_status                  = lt_status   
  46.     exceptions   
  47.       document_not_found   = 1  
  48.       error_occurred       = 2  
  49.       document_locked      = 3  
  50.       no_change_authority  = 4  
  51.       no_display_authority = 5  
  52.       no_change_allowed    = 6.   
  53. * sy-subrc = 0 if the read was successful.    
  54. * If the read wasn’t it can mean that the GUID you entered isn’t valid/doesn’t exist.  
0 0
原创粉丝点击