使用代码执行organization unit determination逻辑
生活随笔
收集整理的這篇文章主要介紹了
使用代码执行organization unit determination逻辑
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Created by Jerry Wang, last modified on May 15, 2015
執行report,輸入order id和transaction type:
打印輸出:
?
report打印的結果和ui上log里顯示的結果一致。?
?
source code:?
?
*&---------------------------------------------------------------------*?
*& Report ?ZORDER_DETERMINE_BY_ID?
*&?
*&---------------------------------------------------------------------*?
*&?
*&?
*&---------------------------------------------------------------------*?
REPORT zorder_determine_by_id.?
?
PARAMETERS: id TYPE crmd_orderadm_h-object_id OBLIGATORY DEFAULT '2145',?
otype TYPE crmd_orderadm_h-process_type OBLIGATORY DEFAULT 'OPPT'.?
?
DATA: lv_id ? ? ? ? TYPE crmd_orderadm_h-object_id VALUE '2145',?
ls_order ? ? ?TYPE crmd_orderadm_h,?
lv_profile_id TYPE crmt_org_profilid,?
ls_actor_1 ? ?TYPE swhactor,?
ls_actor_2 ? ?TYPE swhactor,?
ls_org_com ? ?TYPE crmt_orgman_com,?
lt_orgobjects TYPE crmt_orgman_swhactor_tab,?
ls_orgprof ? ?TYPE crmc_orgprof.?
?
?
START-OF-SELECTION.?
?
lv_id = id.?
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'?
EXPORTING?
input ?= lv_id?
IMPORTING?
output = lv_id.?
?
SELECT SINGLE * INTO ls_order FROM crmd_orderadm_h WHERE object_id = lv_id?
AND process_type = otype.?
IF sy-subrc <> 0.?
WRITE: / 'invalid order id: ' , lv_id.?
RETURN.?
ENDIF.?
?
ls_org_com-ref_guid = ls_order-guid.?
ls_org_com-ref_kind = 'A'.?
?
CALL FUNCTION 'CRM_ORGMAN_GET_PROFIL_ID'?
EXPORTING?
iv_ref_guid ? ? ?= ls_order-guid?
iv_ref_kind ? ? ?= 'A'?
iv_scenario ? ? ?= 'SALE'?
IMPORTING?
ev_org_profilid ?= lv_profile_id?
es_org_profile ? = ls_orgprof?
EXCEPTIONS?
no_profile_found = 1?
OTHERS ? ? ? ? ? = 2.?
ASSERT sy-subrc = 0.?
?
ls_actor_1-otype = ls_orgprof-objtyp_rol_oe.?
ls_actor_1-objid = ls_orgprof-org_rol_oe.?
ls_actor_2-otype = ls_orgprof-objtyp_rol_resp.?
ls_actor_2-objid = ls_orgprof-org_rol_resp.?
?
CALL FUNCTION 'CRM_ORGMAN_DETERMINE_ORGOBJS_E'?
EXPORTING?
iv_ref_guid ? ?= ls_order-guid?
iv_ref_kind ? ?= 'A'?
iv_scenario ? ?= 'SALE'?
is_actor_1 ? ? = ls_actor_1?
is_actor_2 ? ? = ls_actor_2?
is_orgman_com ?= ls_org_com?
iv_otype ? ? ? = 'O'?
IMPORTING?
et_actor_tab ? = lt_orgobjects?
EXCEPTIONS?
no_actor_found = 1?
OTHERS ? ? ? ? = 2.?
?
IF sy-subrc <> 0.?
WRITE: / 'no org unit determined'.?
RETURN.?
ENDIF.?
?
LOOP AT lt_orgobjects ASSIGNING FIELD-SYMBOL(<object>).?
WRITE: / <object>-objid, ' type: ' , <object>-otype.?
ENDLOOP.總結
以上是生活随笔為你收集整理的使用代码执行organization unit determination逻辑的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《红楼梦》薛蝌详解
- 下一篇: 《只狼》护命呼吸·阳技能效