CRM_ORDER_READ 订单查询简单示例

转载来自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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值