H:
GUID CRMT_OBJECT_GUID RAW CRM 订单对象的 GUID
BP_NUMBER BU_PARTNER CHAR 业务伙伴编号
FIRSTNAME BU_NAMEP_F CHAR 业务伙伴(人员)的名
PROCESS_TYPE CRMT_PROCESS_TYPE CHAR 业务类型
LASTNAME BU_NAMEP_L CHAR 业务伙伴(个人)的姓
STREET AD_STREET CHAR 街道
HOUSE_NO ZHOUSE_NO CHAR
POSTAL_CODE AD_PSTCD1 CHAR 城市邮政编码
CITY AD_CITY1 CHAR 城市
COUNTRY LAND1 CHAR 国家键值
STATE REGIO CHAR 地区(省/自治区/直辖市、市、县)
PHONE AD_TELNRCL CHAR 确定呼叫者的电话号码
MOBIL AD_TELNRCL CHAR 确定呼叫者的电话号码
SUG_SER_TIME ZSO_FIRST_REPAIR_TIME TIMS
SER_PRO BU_PARTNER CHAR 业务伙伴编号
NAME_ORG1 BU_NAMEOR1 CHAR 组织名称
SYM_DES CRMT_PROCESS_DESCRIPTION CHAR 事务描述
BATCH_M DUMMY CHAR 长度 中的哑元函数
ORDER_TYPE CRMT_PROCESS_TYPE CHAR 业务类型
BATCH_QUN ZACTUALQTY DEC
SALES_ORG CRMT_SALES_ORG_SHORT CHAR 销售组织:部门描述
DIS_CHANNEL CRMT_DISTRIBUTION_CHANNEL CHAR 分销渠道
SALES_OFFICE ZSO_SALES_OFFICE CHAR 销售办公室
SALES_ORG_RESP ZSO_SALES_ORG_RESP CHAR 组织单位(销售)
SERVICE_ORG ZS0_SERVICE_ORG CHAR 服务组织
SERVICE_ORG_RESP ZSO_SERVICE_ORG_RESP CHAR 组织单位(服务)
PURCHASE_PRICE ZSO_PURCHASE_PRICE CURR 购机价格
PROBLEM_DES ZSO_PROBLEM_DES CHAR 问题描述
STAT ZSO_STAT CHAR 状态
PRODUCT_ID COMT_PRODUCT_ID CHAR 产品 ID
PRODUCT_ID_DES ZSO_PRODUCT_ID_DES CHAR 产品描述
SERIALS_NUMBER ZSERIALNO CHAR 序列号
IB_IBASE IB_IBASE NUMC IBase:已安装设备清单/ IBase 编号
IB_INSTANCE IB_INSTANCE NUMC IB:组件(示例)
PURCHASE_DATE ZSO_PURCHASE_DATE DATS 购机日期
PURCHASE_TIME ZSO_PURCHASE_TIME TIMS
RE_PARTNER_NO BU_PARTNER CHAR 业务伙伴编号
OR_INVOICE CRMT_YOUR_REFERENCE_SOLD CHAR 售达方参考
CURRENCY CRMT_CURRENCY CUKY 货币
SER_DATE ZSO_PURCHASE_DATE DATS 购机日期
SCODE ZDTEL000004 CHAR 批次号
ZWARRANTYPE ZWARRANTYPE CHAR
ZREFURBISH ZREFURBISH CHAR 复检标志
ACCOUNT_NAME BU_DESCRIP CHAR 业务伙伴的短名称
ZWARRANTYPE1 ZWARRANTYPE CHAR
ZZZSYMPTOMSGROUP ZSYMPTOMSGROUP CHAR 故障现象大类
ZZZSYMPTOMSCODE ZSYMPTOMSCODE CHAR 故障现象编码
ZZZDEFECTGROUP ZDEFECTGROUP CHAR 故障原因大类
ZZZDEFECTCODE ZDEFECTCODE CHAR 故障原因编码
ZZZREPAIRGROUP ZREPAIRGROUP CHAR 维修措施大类
ZZZREPAIRCODE ZREPAIRCODE CHAR 维修措施编码
ZZSECTIONGROUP ZSECTIONGROUP CHAR 维修部件大类
ZZSECTIONCODE ZSECTIONCODE CHAR 维修部件编码
ZZCRTSRVID ZCRTSRVID CHAR 服务码
ZZIMEI ZIMEI CHAR IMEI号
ZZWARRANTY ZWARRANTY CHAR 保修类型
ZZRELATION ZZRELATION CHAR 服务订单和投诉单的关系
ZZSTATE_TXT BEZEI20 CHAR 描述
ZZMAIL_FLAG ZEMAIL_FLAG CHAR 邮件提醒
LO_PARTNER_NO BU_PARTNER CHAR 业务伙伴编号
ZEMAIL AD_SMTPADR CHAR 电子邮件地址
ZZDLYRSN ZDLYRSNID CHAR 未完成原因
ZZFLD00000N ZDTEL00003Y CHAR
ZZFLD00000O ZDTEL000042 CHAR
CATEGORY CRMT_ACTIVITY_CATEGORY CHAR 活动类别 (通讯类型)
ZZSOURCE ZADTEL00000M CHAR
ZZAFLD000008 ZADTEL000021 CHAR
RETAIL_ADDR AD_STREET CHAR 街道
REFRENCE_NO ZE_REFERENCE_NO CHAR
CONTACT_PERSON BU_NAMEOR1 CHAR 组织名称
CONTACT_MOBILE AD_MBNMBR1 CHAR 第一个移动电话号码:区号 + 电话号码
CONTACT_PHONE AD_MBNMBR1 CHAR 第一个移动电话号码:区号 + 电话号码
CONTACT_E_MAIL AD_SMTPADR CHAR 电子邮件地址
CONTACT_FAX AD_FXNMBR1 CHAR 第一个传真号: 拨号 + 编号
ZA_FLAG CHAR1 CHAR 单字符标记
LOGISTIC_NAME BU_DESCRIP CHAR 业务伙伴的短名称
SP_NAME BU_DESCRIP CHAR 业务伙伴的短名称
ZBP_TYPE ZE_ZBPCATE CHAR
STR_SUPPL1 AD_STRSPP1 CHAR 街道2
ZESCALATION ZESCALATION CHAR
ZPRIORITY ZE_PRIORITY CHAR
ZANSWER_DES ZANSWER_DES CHAR
ZSUB_CMPCAT ZSUB_CMPCAT CHAR
ZZWARR_CONFIRM ZADTEL00004U CHAR
ZZSER_TIME ZADTEL00004Y CHAR
ZZSER_NETWORK ZADTEL000052 CHAR
ZZCLIENT_TYPE ZADTEL000056 CHAR
ZZQUOTA_RTL ZADTEL00005A DEC
ZZQUOTA_USR ZADTEL00005E DEC
ZZCONS_SER_NET ZADTEL00005I CHAR
ZZRETAILER_NAME ZADTEL00005M CHAR
OTCUST_DET BU_PARTNER CHAR 业务伙伴编号
OTCUST_DET_STREET CHAR255 CHAR Char255
USER_STAT_PROC J_STSMA CHAR 状态参数文件

I结构
GUID CRMT_OBJECT_GUID RAW CRM 订单对象的 GUID
CORDER_GUID CRMT_OBJECT_GUID RAW CRM 订单对象的 GUID
PRODUCT_ID COMT_PRODUCT_ID CHAR 产品 ID
PRODUCT_ID_DES ZSO_PRODUCT_ID_DES CHAR 产品描述
SERIALS_NUMBER ZSERIALNO CHAR 序列号
IB_IBASE IB_IBASE NUMC IBase:已安装设备清单/ IBase 编号
PURCHASE_DATE ZSO_PURCHASE_DATE DATS 购机日期
PURCHASE_TIME ZSO_PURCHASE_TIME TIMS
RE_PARTNER_NO CRMT_PARTNER_NO CHAR 合作伙伴编号
OR_INVOICE CRMT_OBJECT_ID_DB CHAR 处理标识
PUR_PRICE ZPUR_PRICE CURR
QUANTITY ZACTUALQTY DEC
UNIT CRMT_PROCESS_QTY_UNIT_UI CHAR 出售产品的计量单位
HEADER CRMT_OBJECT_GUID RAW CRM 订单对象的 GUID
NUMBER_H ZSO_ITEM_NO NUMC 行项目号
NUMBER_INT ZSO_ITEM_NO NUMC 行项目号
ITEM_TYPE ZSO_ITEM_TYPE CHAR 行项目类别
ZZZSERIALNO ZSERIALNO CHAR 序列号
ZZZSERIALNO1 ZSERIALNO CHAR 序列号
ZZCRM04P ZSRVE_CRM04P CHAR
ZZZCUSTMODENO ZCUSTMODENO CHAR 客户机型
ZZSYMP_GROU ZSYMPTOMSGROUP CHAR 故障现象大类
ZZSYMP_CODE ZSYMPTOMSCODE CHAR 故障现象编码
CURRENCY CRMT_CURRENCY CUKY 货币
ZZPLANT ZADTEL000025 CHAR
ZZLGORT ZADTEL000029 CHAR
FUNCTION z_order_maintain_integration.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(ORDER_H) TYPE ZCORDER_HEADER_INFO OPTIONAL
*" REFERENCE(ORDER_I) TYPE ZCORDER_ITEM_INFOR OPTIONAL
*" EXPORTING
*" REFERENCE(ERROR_TYPE) TYPE CHAR01
*" REFERENCE(ERROR_LOG) TYPE CHAR220
*" REFERENCE(RETURN_OBJECT_ID) TYPE CRMT_RETURN_OBJECTS
*" REFERENCE(RE_ET_EXCEPTION) TYPE CRMT_EXCEPTION_T
*" TABLES
*" RETURN TYPE CRMT_ES_MSG
*"----------------------------------------------------------------------
DATA:
ls_tj30t TYPE tj30t,
ls_crmc_proc_type TYPE crmc_proc_type,
ls_zsals_sorg_otcust_det TYPE zsals_sorg_otcust_det.
DATA: wk_schedlin TYPE crmt_schedlin_wrk,
tk_schedlin TYPE crmt_schedlin_wrkt, wk_service_os TYPE crmt_srv_osset_wrk,
tk_service_os TYPE crmt_srv_osset_wrkt,
wk_osset TYPE crmt_srv_osset_wrk1,
tk_osset TYPE crmt_srv_osset_wrkt1,
wk_refobject TYPE crmt_srv_refobj_wrk,
tk_refobject TYPE crmt_srv_refobj_wrkt,
wk_srv_subject TYPE crmt_srv_subject_wrk,
tk_srv_subject TYPE crmt_srv_subject_wrkt.
* DATA: wa TYPE crmt_object_guid .
DATA: wk_header TYPE crmt_object_guid_tab. DATA: ls_activity_h TYPE crmt_activity_h_com,
lt_activity_h TYPE crmt_activity_h_comt,
ls_service_h TYPE crmt_service_h_com,
lt_service_h TYPE crmt_service_h_comt,
ls_sales TYPE crmt_sales_com,
lt_sales TYPE crmt_sales_comt,
ls_product_i TYPE crmt_product_i_com,
lt_product_i TYPE crmt_product_i_comt,
ls_schedlin_i TYPE crmt_schedlin_i_com,
lt_schedlin_i TYPE crmt_schedlin_i_comt,
ls_partner TYPE crmt_partner_com,
lt_partner TYPE crmt_partner_comt,
ls_service_os TYPE crmt_srv_osset_com,
lt_service_os TYPE crmt_srv_osset_comt,
ls_orderadm_h TYPE crmt_orderadm_h_com,
lt_orderadm_h TYPE crmt_orderadm_h_comt,
ls_orderadm_i TYPE crmt_orderadm_i_com,
lt_orderadm_i TYPE crmt_orderadm_i_comt,
ls_orgman TYPE crmt_orgman_com,
lt_orgman TYPE crmt_orgman_comt,
ls_appointment TYPE crmt_appointment_com,
lt_appointment TYPE crmt_appointment_comt,
ls_status TYPE crmt_status_com,
lt_status TYPE crmt_status_comt,
wt_status TYPE crmt_status_comt,
ls_text TYPE crmt_text_com,
lt_text TYPE crmt_text_comt,
ls_schedlin_extdt TYPE crmt_schedlin_extd,
lt_schedlin_extdt TYPE crmt_schedlin_extdt,
ls_osset TYPE crmt_srv_osset_com1,
lt_osset TYPE crmt_srv_osset_comt1,
ls_refobject TYPE crmt_srv_refobj_com,
lt_refobject TYPE crmt_srv_refobj_comt,
ls_service_i TYPE crmt_service_i_com,
lt_service_i TYPE crmt_service_i_comt,
ls_pricing TYPE crmt_pricing_com,
lt_pricing TYPE crmt_pricing_comt,
ls_subject TYPE crmt_subject_com,
lt_subject TYPE crmt_subject_comt. DATA: w_orderadm_h TYPE crmd_orderadm_h.
DATA ls_zcrmt0013 TYPE zcrmt0013.
DATA ls_zbp_sales TYPE zbp_sales. DATA: gt_ltxts TYPE STANDARD TABLE OF tline .
DATA: lw_ltxt TYPE tline . DATA: l_len TYPE i,
l_start TYPE i,
l_char_tmp() TYPE c,
l_handle TYPE crmt_handle, ls_order_i_n TYPE zservice_order_i_maintain,
l_ref_guid() TYPE c,
l_mode TYPE crmt_mode VALUE 'A',
lv_guid TYPE crmt_object_guid,
l_partner TYPE bu_partner,
sp_partner TYPE bu_partner,
l_xblck TYPE bu_xblck. DATA: ls_input_field TYPE crmt_input_field.
DATA: lt_input_field TYPE crmt_input_field_tab.
DATA: wt_input_field TYPE crmt_input_field_tab.
DATA: lt_field_names TYPE crmt_input_field_names_tab.
DATA: ls_field_names TYPE crmt_input_field_names. DATA: lt_exception TYPE crmt_exception_t,
it_objects_to_save TYPE crmt_object_guid_tab,
is_objects_to_save TYPE LINE OF crmt_object_guid_tab,
lt_saved_objects TYPE crmt_return_objects,
ls_saved_objects TYPE crmt_return_objects_struc,
lt_objects_not_saved TYPE crmt_object_guid_tab,
ls_objects_not_saved TYPE crmt_object_guid,
lt_guid_init TYPE crmt_object_guid_tab,
ls_guid_init TYPE crmt_object_guid. *////////////////////////////////////////////////////////////
DATA: ls_order_h TYPE LINE OF zcorder_header_info,
ls_order_i TYPE LINE OF zcorder_item_infor.
DATA: bapi_return TYPE bapiret2.
DATA: lv_schedual_guid TYPE crmt_object_guid.
DATA: zcount TYPE i VALUE .
DATA lv_req_deiv_date TYPE crmt_req_dlv_date. DATA: lv_header_guid TYPE crmt_object_guid,
lv_item_guid TYPE crmt_object_guid.
DATA: gt_order_h TYPE zcorder_header_info,
gt_order_i TYPE zcorder_item_infor.
DATA: zscode TYPE zdtel000004.
DATA: zerror_log TYPE string,
zerror_type TYPE char01,
zdo_not_save TYPE char01.
DATA: zline TYPE i.
DATA lv_char10 TYPE char10."10位变量
DATA lv_char6 TYPE char6."6位变量 CLEAR: ls_input_field, lt_input_field,
ls_field_names, lt_field_names.
DATA: lt_ulist TYPE TABLE OF usr02,
ls_ulist TYPE usr02,
lt_alist TYPE TABLE OF usr03,
ls_alist TYPE usr03.
DATA: lv_string TYPE string.
DATA lv_land TYPE land1."当前账号所属国家
CALL FUNCTION 'Z_GET_SALESORG_BY_USER'
EXPORTING
iv_user = sy-uname
IMPORTING
ev_country = lv_land. **//check order_h data
IF order_h IS INITIAL.
error_type = 'E'.
error_log = 'Header is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. LOOP AT order_h INTO ls_order_h.
IF ls_order_h-guid IS INITIAL.
error_type = 'E'.
error_log = 'Hearder GUID is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. **//check order_h data
*start: Add by Ivanliu 20151111
IF ls_order_h-process_type IS INITIAL. error_type = 'E'.
error_log = 'Order type is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
*end: Add by Ivanliu 20151111 ****ADD BY DQ-YUW START
IF ls_order_h-process_type EQ 'ZWO3' AND ls_order_h-zzfld00000o IS INITIAL. error_type = 'E'.
error_log = 'Complain type is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. IF ls_order_h-process_type EQ 'ZWO3' AND ls_order_h-zzsource IS INITIAL. error_type = 'E'.
error_log = 'Source is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. IF ls_order_h-country EQ 'ZA' OR lv_land EQ 'ZA'.
IF ls_order_h-serials_number IS NOT INITIAL AND strlen( ls_order_h-serials_number ) NE .
error_type = 'E'.
error_log = 'The length of the serial number is not 23 bit'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. IF ls_order_h-process_type EQ 'ZSR3' AND ls_order_h-re_partner_no IS INITIAL."南非退机申请retailer必填
error_type = 'E'.
error_log = 'Retailer is required'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. IF ls_order_h-process_type EQ 'ZSV1' AND ls_order_h-zzzsymptomsgroup EQ 'MP1'.
IF ls_order_h-zzimei IS INITIAL.
error_type = 'E'.
error_log = 'IMEI is null'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ELSE.
IF strlen( ls_order_h-zzimei ) NE .
error_type = 'E'.
error_log = 'The length of the IMEI is not 15 bit'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
****END ADD * IF ls_order_h-zwarrantype = 'Prepaid' AND ls_order_h-process_type NE 'ZSV1'.
* error_type = 'E'.
* error_log = 'You can only create HIS Standard SRO order when the vaule of Warranty type is Prepaid'.
* return-type = error_type.
* return-message = error_log.
* APPEND return.
* EXIT.
* ENDIF. IF ls_order_h-batch_m IS NOT INITIAL
AND ( ls_order_h-serials_number IS NOT INITIAL
OR ls_order_h-ib_instance IS NOT INITIAL
OR ls_order_h-ib_ibase IS NOT INITIAL ).
error_type = 'E'.
error_log = 'The ibase, component, serials number, must be kept blank in batch order creation'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. IF ls_order_h-process_type = 'ZSV1' AND ( ls_order_h-ser_date IS INITIAL OR ls_order_h-sym_des IS INITIAL ) .
error_type = 'E'.
error_log = 'Please input Suggested Service Date and Order Description'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
************************add by dq-yuw 建单平台控制:warranty type 必填,如果是单据类型=ZSV1.
IF ls_order_h-process_type = 'ZSV1' AND ls_order_h-zzwarranty IS INITIAL.
error_type = 'E'.
error_log = 'Please input warranty type'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. *************************END ADD
**begin of change DQ-SUSAN ON 2015.06.02 -采购日期不能晚于当前系统日期
IF ls_order_h-process_type = 'ZSR2' OR ls_order_h-process_type = 'ZSR3'
OR ls_order_h-process_type = 'ZSV1'.
IF NOT ls_order_h-purchase_date IS INITIAL AND ls_order_h-purchase_date > sy-datum.
error_log = 'Purchase Date before the current system date '.
error_type = 'E'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ENDIF. *end of change
IF ls_order_h-process_type = 'ZSR2' OR ls_order_h-process_type = 'ZSR3' .
IF ls_order_h-ser_date IS INITIAL.
error_type = 'E'.
error_log = 'Please input Suggested Service Date.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
IF ls_order_h-problem_des IS INITIAL.
error_type = 'E'.
error_log = 'Please input Note information.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
IF ls_order_h-purchase_date IS INITIAL.
error_type = 'E'.
error_log = 'Please input Purchase Date.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
DESCRIBE TABLE order_i LINES zline.
IF zline IS INITIAL.
error_type = 'E'.
error_log = 'Please add item information.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ENDIF.
IF ls_order_h-process_type = 'ZWO3' OR ls_order_h-process_type = 'ZWO4' .
IF ls_order_h-sym_des IS INITIAL.
error_type = 'E'.
error_log = 'Please input Symptoms Description.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ELSE.
IF ls_order_h-process_type = 'ZSR2' OR ls_order_h-process_type = 'ZSR3' OR ls_order_h-process_type = 'ZSV1' .
IF ls_order_h-product_id IS INITIAL.
error_type = 'E'.
error_log = 'Please input Product in the header'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ENDIF.
ENDIF.
IF ls_order_h-bp_number IS INITIAL.
error_type = 'E'.
error_log = 'Hearder Sold-TO Party is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
IF ls_order_h-ser_pro IS NOT INITIAL.
sp_partner = ls_order_h-ser_pro.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = sp_partner
IMPORTING
output = sp_partner.
SELECT SINGLE xblck INTO l_xblck FROM but000 WHERE partner = sp_partner.
IF l_xblck = 'X'.
error_type = 'E'.
error_log = 'Service Provider is blocked.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ENDIF.
********add by dq-yuw 20160628 start
DATA lv_sales_org TYPE crmt_sales_org.
DATA lv_country TYPE land1. IF ls_order_h-process_type = 'ZSV1' AND ls_order_h-zzfld00000n IS INITIAL.
CALL FUNCTION 'Z_GET_SALESORG_BY_USER'
EXPORTING
iv_user = sy-uname
IMPORTING
ev_sales_org = lv_sales_org. SELECT SINGLE adrc~country INTO lv_country
FROM zhscrm0002 INNER JOIN but021_fs
ON zhscrm0002~org_bp = but021_fs~partner
INNER JOIN adrc
ON but021_fs~addrnumber = adrc~addrnumber
WHERE but021_fs~adr_kind = 'XXDEFAULT'
AND zhscrm0002~org_id = lv_sales_org+(). IF lv_country EQ 'US'.
error_type = 'E'.
error_log = 'Service Type is null'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ENDIF. *************end add IF ls_order_h-batch_m IS NOT INITIAL AND ls_order_h-batch_qun IS NOT INITIAL AND ls_order_h-process_type = 'ZSV1'.
zcount = ls_order_h-batch_qun.
ENDIF.
IF zcount > .
PERFORM get_next_id CHANGING zscode.
ls_order_h-scode = zscode.
ENDIF.
* IF ls_order_h-zwarrantype = 'Prepaid' AND ls_order_h-process_type = 'ZSV1' .
* IF ls_order_h-ser_pro IS INITIAL.
* SELECT SINGLE partner INTO ls_order_h-ser_pro
* FROM zprepaidprovider
* WHERE sales_org = ls_order_h-sales_org.
* ENDIF.
* ENDIF.
**********************************************************************20170217-Begin
*开发顾问:陈国光
*业务顾问:张弛
*日本分公司-O 50000231
*HOS_CRM_JP_10_备件销售订单增强_V1.0_20170117
*B、对于日本,通过集中建单平台,创建的ZSO1(HSI Individual Sales)和ZSO5(HSI FREE Sales),
*状态默认为Z020(APPROVED)。
*C、对于日本分公司,如果客户的BP分组为Z001(End User),
*则创建ZSO1(HSI Individual Sales)和ZSO5(HSI FREE Sales)时,
*将客户BP保存到合作伙伴类型ZHSI00EU(HIS END User)中,
*将售达方、送达方、付款方、收货方设置成一次性客户,
*同时将客户的地址信息,赋值到备件销售订单的售达方、送达方、付款方、收货方。赋值时,
*将街道STREET和街道2 STR_SUPPL1的值,中间加空格拼接起来,
*保存到备件销售订单合作伙伴售达方、送达方、付款方、收货方地址中的街道2中。
*一次性客户的取值逻辑为:
*根据ZCRMT_MAINT_I-TAB_NAME = ZSORG_OTCUST_DET & ZCRMT_MAINT_I-VALUE1 =
*销售组织,一次性客户编码取ZCRMT_MAINT_I-VALUE2的值。 *共用数据
CLEAR:ls_crmc_proc_type.
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF ls_crmc_proc_type
FROM crmc_proc_type WHERE process_type = ls_order_h-process_type.
ls_order_h-user_stat_proc = ls_crmc_proc_type-user_stat_proc.
* IF sy-uname = zcl_crm_attributes=>gc_chenguoguang.
IF ls_order_h-sales_org = 'O 50000231'.
CLEAR:ls_zsals_sorg_otcust_det.
ls_zsals_sorg_otcust_det-bp_number = ls_order_h-bp_number.
ls_zsals_sorg_otcust_det-sales_org = ls_order_h-sales_org.
ls_zsals_sorg_otcust_det-process_type = ls_order_h-process_type.
* CALL FUNCTION 'ZSAL_JA_GET_ZSORG_OTCUST_DET'
* CHANGING
* cs_zsals_sorg_otcust_det = ls_zsals_sorg_otcust_det.
*OTCUST_DET 1 Types BU_PARTNER CHAR 10 0 Business Partner Number
ls_order_h-otcust_det = ls_zsals_sorg_otcust_det-otcust_det.
*OTCUST_DET_STREET 1 Types CHAR255 CHAR 255 0 Char255
ls_order_h-otcust_det_street = ls_zsals_sorg_otcust_det-otcust_det_street.
ENDIF.
* ENDIF.
**********************************************************************20170217-End
APPEND ls_order_h TO gt_order_h.
CLEAR:ls_order_h. ENDLOOP. CHECK error_type IS INITIAL. **//check order_i data
LOOP AT order_i INTO ls_order_i.
IF ls_order_i-guid IS INITIAL.
error_type = 'E'.
error_log = 'Item GUID is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF. READ TABLE order_h INTO ls_order_h WITH KEY guid = ls_order_i-corder_guid.
IF ls_order_h-process_type = 'ZSR2' OR ls_order_h-process_type = 'ZSR3'.
IF ls_order_i-product_id IS INITIAL.
error_type = 'E'.
error_log = 'Item Product is null.'.
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ELSE.
IF ls_order_i-product_id IS INITIAL.
CONTINUE.
ENDIF.
ENDIF.
APPEND ls_order_i TO gt_order_i.
ENDLOOP. CHECK error_type IS INITIAL. IF zcount > .
zcount = zcount - .
DO zcount TIMES.
READ TABLE order_h INTO ls_order_h INDEX .
CALL FUNCTION 'CRM_GUID_CREATE'
IMPORTING
ev_guid = lv_header_guid.
ls_order_h-guid = lv_header_guid.
ls_order_h-scode = zscode.
APPEND ls_order_h TO gt_order_h. LOOP AT order_i INTO ls_order_i.
IF ls_order_h-process_type NE 'ZSR2' AND ls_order_h-process_type NE 'ZSR3' AND ls_order_i-product_id IS INITIAL.
CONTINUE.
ENDIF.
CALL FUNCTION 'CRM_GUID_CREATE'
IMPORTING
ev_guid = lv_item_guid.
ls_order_i-corder_guid = lv_header_guid.
ls_order_i-guid = lv_item_guid.
APPEND ls_order_i TO gt_order_i.
ENDLOOP.
CLEAR: lv_header_guid, lv_item_guid.
ENDDO.
ENDIF.
*S*********************ORDERADM_H********************************
* ls_ORDERADM_H-HANDLE = '0000000001'.
DATA: BEGIN OF ls_category,
category TYPE zdtel000008,
group TYPE zgroup,
brand TYPE zbrand,
zzzmodeno TYPE zmodeno,
END OF ls_category.
DATA: lv_productguid TYPE comt_product_guid.
DATA: ls_hierarchy TYPE comm_hierarchy.
DATA: ls_prprdcatr TYPE comm_prprdcatr.
DATA: lt_pr_frg_rel TYPE TABLE OF comm_pr_frg_rel.
DATA: ls_addsettype TYPE zaddsettype.
DATA: lt_addsettype TYPE TABLE OF zaddsettype. READ TABLE gt_order_h INTO ls_order_h INDEX .
IF ls_order_h-process_type = 'ZSV1' AND ls_order_h-ser_pro IS NOT INITIAL.
SELECT SINGLE product_guid INTO lv_productguid
FROM comm_product
WHERE product_id = ls_order_h-product_id.
SELECT SINGLE *
FROM comm_hierarchy
INTO ls_hierarchy
WHERE hierarchy_id = 'R3PRODHIER'.
IF sy-subrc = .
CLEAR ls_prprdcatr.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_prprdcatr
FROM comm_prprdcatr
WHERE product_guid = lv_productguid
AND hierarchy_guid = ls_hierarchy-hierarchy_guid.
ls_category-group = ls_prprdcatr-category_id+().
ls_category-brand = ls_prprdcatr-category_id+().
ls_category-category = ls_prprdcatr-category_id+().
ENDIF.
SELECT *
FROM comm_pr_frg_rel
INTO CORRESPONDING FIELDS OF TABLE lt_pr_frg_rel
WHERE product_guid = lv_productguid.
IF sy-subrc = .
CLEAR ls_addsettype.
SELECT * FROM zaddsettype
INTO CORRESPONDING FIELDS OF TABLE lt_addsettype
FOR ALL ENTRIES IN lt_pr_frg_rel
WHERE frg_guid = lt_pr_frg_rel-fragment_guid.
READ TABLE lt_addsettype INTO ls_addsettype INDEX .
CONCATENATE ls_addsettype-zz0015 ls_addsettype-zz0016
INTO ls_category-zzzmodeno SEPARATED BY '.'.
* ls_category-zzzmodeno = ls_addsettype-zz0015.
ENDIF.
ENDIF.
LOOP AT gt_order_h INTO ls_order_h.
ls_orderadm_h-guid = ls_order_h-guid.
ls_orderadm_h-process_type = ls_order_h-process_type.
ls_orderadm_h-description = ls_order_h-sym_des.
ls_orderadm_h-zzzserialno = ls_order_h-serials_number.
ls_orderadm_h-zzzpurpr = ls_order_h-purchase_price.
ls_orderadm_h-zzfld000006 = ls_order_h-scode.
ls_orderadm_h-zzrefurbish = ls_order_h-zrefurbish.
ls_orderadm_h-zzzsymptomsgroup = ls_order_h-zzzsymptomsgroup.
ls_orderadm_h-zzzsymptomscode = ls_order_h-zzzsymptomscode.
ls_orderadm_h-zzzdefectgroup = ls_order_h-zzzsymptomsgroup.
ls_orderadm_h-zzzrepairgroup = ls_order_h-zzzsymptomsgroup.
ls_orderadm_h-zzsectiongroup = ls_order_h-zzzsymptomsgroup.
ls_orderadm_h-zzimei = ls_order_h-zzimei.
ls_orderadm_h-zzwarranty = ls_order_h-zzwarranty.
ls_orderadm_h-zzfld00000f = ls_order_h-zzmail_flag.
ls_orderadm_h-zzdlyrsn = ls_order_h-zzdlyrsn.
*******add by liyuan 20170210 start----
IF ls_order_h-process_type = 'ZWO3' OR ls_order_h-process_type = 'ZWO4'.
ls_orderadm_h-zzafld000012 = ls_order_h-zescalation."咨询/投诉升级
ls_orderadm_h-zzafld000015 = ls_order_h-zsub_cmpcat."咨询/投诉升级
ENDIF.
*******add by liyuan 20170210 end----
*******add by dq-yuw 20160623 start----
ls_orderadm_h-zzfld00000n = ls_order_h-zzfld00000n."In-depot Service
ls_orderadm_h-zzfld00000o = ls_order_h-zzfld00000o."Complaint type
ls_orderadm_h-zzsource = ls_order_h-zzsource."SOURCE
ls_orderadm_h-zzafld000008 = ls_order_h-zzafld000008."Collection location
ls_orderadm_h-zzwarr_confirm = ls_order_h-zzwarr_confirm.
ls_orderadm_h-zzser_time = ls_order_h-zzser_time.
ls_orderadm_h-zzser_network = ls_order_h-zzser_network.
ls_orderadm_h-zzclient_type = ls_order_h-zzclient_type.
ls_orderadm_h-zzquota_rtl = ls_order_h-zzquota_rtl.
ls_orderadm_h-zzquota_usr = ls_order_h-zzquota_usr.
ls_orderadm_h-zzretailer_name = ls_order_h-zzretailer_name. ******end add
ls_orderadm_h-mode = l_mode.
IF ls_order_h-process_type = 'ZSV1' AND ls_order_h-ser_pro IS NOT INITIAL.
ls_orderadm_h-zzzgroup = ls_category-group.
ls_orderadm_h-zzzbrand = ls_category-brand.
ls_orderadm_h-zzzmodeno = ls_category-zzzmodeno.
ls_orderadm_h-zzfld000007 = ls_category-category.
ENDIF.
IF ls_order_h-zwarrantype = '3 Year Repair' OR ls_order_h-zwarrantype = '5 Year Repair'.
ls_orderadm_h-zzprepaid = 'X'.
ENDIF.
* IF ls_order_h-zzcrtsrvid IS NOT INITIAL.
* ls_orderadm_h-zzcrtsrvid = ls_order_h-zzcrtsrvid.
* ENDIF. ls_field_names-fieldname = 'MODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PROCESS_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'DESCRIPTION'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZSERIALNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZPURPR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZFLD000006'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZAFLD000008'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZREFURBISH'.
INSERT ls_field_names INTO TABLE lt_field_names.
" add start by llh ----- mail for login
ls_field_names-fieldname = 'ZZFLD00000F'.
INSERT ls_field_names INTO TABLE lt_field_names.
" add end ----- mail for login
*******add by dq-yuw 20160623 start----
ls_field_names-fieldname = 'ZZFLD00000N'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZFLD00000O'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZSOURCE'.
INSERT ls_field_names INTO TABLE lt_field_names.
*******end add
IF ls_order_h-process_type = 'ZSV1' AND ls_order_h-ser_pro IS NOT INITIAL.
ls_field_names-fieldname = 'ZZZGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZBRAND'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZMODENO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZFLD000007'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
* IF ls_order_h-process_type = 'ZSV1' AND ls_order_h-zwarrantype = 'Prepaid'.
* IF ls_order_h-zzcrtsrvid IS NOT INITIAL.
* ls_field_names-fieldname = 'ZZCRTSRVID'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ENDIF.
ls_field_names-fieldname = 'ZZPREPAID'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZSYMPTOMSGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZSYMPTOMSCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZDEFECTGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZREPAIRGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZSECTIONGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZIMEI'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZWARRANTY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZDLYRSN'.
INSERT ls_field_names INTO TABLE lt_field_names.
IF ls_order_h-process_type = 'ZWO3' OR ls_order_h-process_type = 'ZWO4'..
ls_field_names-fieldname = 'ZZAFLD000012'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZAFLD000015'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
ls_field_names-fieldname = 'ZZWARR_CONFIRM'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZSER_TIME'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZSER_NETWORK'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZCLIENT_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZQUOTA_RTL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZQUOTA_USR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZRETAILER_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names.
* ENDIF.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ORDERADM_H'.
* IF ls_order_h-zwarrantype = 'Prepaid' AND ls_order_h-process_type = 'ZSV1'.
* ls_orderadm_h-process_type = 'ZPRE'.
* ENDIF.
INSERT ls_orderadm_h INTO TABLE lt_orderadm_h.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_orderadm_h.
ENDLOOP.
*E*********************ORDERADM_H******************************** CALL FUNCTION 'CRM_ORDER_MAINTAIN'
IMPORTING
et_exception = re_et_exception
CHANGING
ct_orderadm_h = lt_orderadm_h
ct_input_fields = lt_input_field
EXCEPTIONS
error_occurred =
document_locked =
no_change_allowed =
no_authority =
OTHERS = . IF sy-subrc <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
* INTO error_log.
error_type = 'E'.
return-type = sy-msgty.
return-id = sy-msgid.
return-log_msg_no = sy-msgno.
return-message = sy-msgv1.
return-message_v2 = sy-msgv2.
return-message_v3 = sy-msgv3.
return-message_v4 = sy-msgv4.
APPEND return.
ENDIF.
CHECK error_type IS INITIAL. CLEAR: ls_input_field, lt_input_field,
ls_field_names, lt_field_names. *S*********************ACTIVITY_H********************************
"集中建单平台投诉单和投诉单创建时,增强如下:
"将界面中的投诉等级ZPRIORITY的值,保存到结构BTADMINH的PRIORITY字段中;
* ls_activity_h-category = '202'."DELETE BY LY 20170210
* ls_activity_h-priority = '3'.
* INSERT ls_activity_h INTO TABLE lt_activity_h.
LOOP AT gt_order_h INTO ls_order_h.
ls_activity_h-category = ''.
ls_activity_h-ref_guid = ls_order_h-guid.
IF ls_order_h-process_type = 'ZWO3' OR ls_order_h-process_type = 'ZWO4'.
ls_activity_h-priority = ls_order_h-zpriority.
ELSE.
ls_activity_h-priority = ''.
ENDIF.
INSERT ls_activity_h INTO TABLE lt_activity_h.
CLEAR: lt_field_names,ls_field_names.
ls_field_names-fieldname = 'CATEGORY'.
INSERT ls_field_names INTO TABLE lt_field_names.
CLEAR: lt_field_names,ls_field_names.
ls_field_names-fieldname = 'PRIORITY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ACTIVITY_H'. INSERT ls_input_field INTO TABLE lt_input_field.
ENDLOOP. *E*********************ACTIVITY_H******************************** *S*********************SERVICE_H********************************
LOOP AT lt_orderadm_h INTO ls_orderadm_h.
READ TABLE gt_order_h INTO ls_order_h WITH KEY guid = ls_orderadm_h-guid.
IF sy-subrc EQ .
ls_service_h-ref_guid = ls_orderadm_h-guid. ls_service_h-zzcon_person = ls_order_h-contact_person.
ls_service_h-zzcon_mob = ls_order_h-contact_mobile.
ls_service_h-zzcon_phone = ls_order_h-contact_phone.
ls_service_h-zzcon_email = ls_order_h-contact_e_mail.
ls_service_h-zzcon_fax = ls_order_h-contact_fax. CLEAR: lt_field_names,ls_field_names.
ls_field_names-fieldname = 'ZZCON_PERSON'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZCON_MOB'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZCON_PHONE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZCON_EMAIL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZCON_FAX'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'SERVICE_H'. INSERT ls_input_field INTO TABLE lt_input_field.
INSERT ls_service_h INTO TABLE lt_service_h.
CLEAR:ls_service_h, ls_orderadm_h.
ENDIF. ENDLOOP.
*E*********************SERVICE_H******************************** *S*********************SALES********************************
* LOOP AT lt_orderadm_h INTO ls_orderadm_h.
LOOP AT gt_order_h INTO ls_order_h.
ls_sales-ref_guid = ls_order_h-guid.
* ls_SALES-REF_HANDLE = l_HANDLE.
ls_sales-ref_kind = 'A'.
* ls_SALES-YOUR_REF_SOLD = ORDER_H-INVOICE_NUMBER.
ls_sales-your_ref_sold = ls_order_h-or_invoice.
"add by dq-yuw 20161011
ls_sales-po_number_sold = ls_order_h-refrence_no.
"end add *-------------->add by dq-yuw HOS_CRM_JP_11 将集中建单平台抬头的建议服务日期SER_DATE,保存到退机订单的请求交货日期REQ_DLV_DATE字段中。
IF ls_order_h-country EQ 'JP'.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = ls_order_h-ser_date
i_timlo = ''
i_tzone = sy-zonlo
IMPORTING
e_timestamp = lv_req_deiv_date. ls_sales-req_dlv_date = lv_req_deiv_date.
ls_sales-req_timezone = sy-zonlo. ENDIF.
*<------------END ADD
INSERT ls_sales INTO TABLE lt_sales. ls_field_names-fieldname = 'YOUR_REF_SOLD'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PO_NUMBER_SOLD'.
INSERT ls_field_names INTO TABLE lt_field_names.
*-------------->add by dq-yuw HOS_CRM_JP_11 将集中建单平台抬头的建议服务日期SER_DATE,保存到退机订单的请求交货日期REQ_DLV_DATE字段中
ls_field_names-fieldname = 'REQ_DLV_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'REQ_TIMEZONE'.
INSERT ls_field_names INTO TABLE lt_field_names.
*<------------END ADD
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'SALES'.
l_ref_guid = ls_input_field-ref_guid.
CONCATENATE 'CRM_ORDERH' l_ref_guid INTO ls_input_field-logical_key.
INSERT ls_input_field INTO TABLE lt_input_field.
* CLEAR ls_orderadm_h.
CLEAR ls_order_h.
ENDLOOP.
*E*********************SALES******************************** *S*********************TEXT*************************************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
* if l_MODE = 'A' and ( ORDER_H-PROBLEM_DES is not initial or ORDER_H-PROBLEM_DES <> '' ).
LOOP AT gt_order_h INTO ls_order_h.
ls_text-ref_guid = ls_order_h-guid.
ls_text-ref_kind = 'A'.
IF ls_order_h-process_type = 'ZSO1'.
ls_text-tdid = 'ZH24'.
ELSE.
ls_text-tdid = 'A002'.
ENDIF.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( ls_order_h-problem_des ).
l_start = .
IF l_len > ."AND sy-langu <> 'J'."排除日本问题描述 add by ly 20170210
CLEAR lt_ulist.
CLEAR lt_alist.
CLEAR ls_alist.
CLEAR lv_string.
CALL FUNCTION 'BBP_USER_GETLIST'
EXPORTING
search_string = sy-uname
TABLES
userlist = lt_ulist
addlist = lt_alist.
READ TABLE lt_alist INDEX INTO ls_alist.
CONCATENATE sy-datum+() '/' sy-datum+() '/' sy-datum+() INTO lv_string.
CONCATENATE lv_string sy-uzeit+() ':' sy-uzeit+() INTO lv_string SEPARATED BY space.
* CONCATENATE lv_string ls_alist-name1 ls_alist-name2 ':' ls_order_h-problem_des INTO ls_order_h-problem_des SEPARATED BY space. IF sy-langu = 'J' AND ( ls_order_h-process_type = 'ZWO3' OR ls_order_h-process_type = 'ZWO4' )..
* DATA:lv_desc TYPE string.
* CLEAR:lv_desc.
CONCATENATE lv_string ls_alist-name1 ls_alist-name2 ':'
'問合せ内容:' ls_order_h-problem_des ' お客さんへの回答:' ls_order_h-zanswer_des INTO ls_order_h-problem_des SEPARATED BY space.
ELSE.
CONCATENATE lv_string ls_alist-name1 ls_alist-name2 ':' ls_order_h-problem_des INTO ls_order_h-problem_des SEPARATED BY space.
ENDIF. CLEAR l_len."MOVE FROM IF BELOW TO UP HERE
l_len = strlen( ls_order_h-problem_des ).
WHILE l_len > .
IF l_len > .
l_char_tmp = ls_order_h-problem_des+l_start().
ELSE.
l_char_tmp = ls_order_h-problem_des+l_start(l_len).
ENDIF.
lw_ltxt-tdformat = '*'.
lw_ltxt-tdline = l_char_tmp.
APPEND lw_ltxt TO gt_ltxts.
l_start = l_start + .
l_len = l_len - .
ENDWHILE.
ENDIF.
"如果登录人的国家是日本,将文本框问题说明PROBLEM_DES和回复内容ZANSWER_DES内容拼接起来,
"拼接格式为“問合せ内容:”+问题说明PROBLEM_DES+空行+“お客さんへの回答:”+回复内容ZANSWER_DES,保存到问题说明的中
* IF l_len > 0 AND sy-langu = 'J'."
* DATA:lv_desc TYPE string.
* CLEAR:lv_desc.
*
* CONCATENATE '問合せ内容:' ls_order_h-problem_des space 'お客さんへの回答:' ls_order_h-zanswer_des INTO lv_desc.
* CLEAR l_len."MOVE FROM IF BELOW TO UP HERE
* l_len = strlen( lv_desc ).
* WHILE l_len > 0.
* IF l_len > 130.
* l_char_tmp = lv_desc+l_start(130).
* ELSE.
* l_char_tmp = lv_desc+l_start(l_len).
* ENDIF.
* lw_ltxt-tdformat = '*'.
* lw_ltxt-tdline = l_char_tmp.
* APPEND lw_ltxt TO gt_ltxts.
* l_start = l_start + 130.
* l_len = l_len - 130.
* ENDWHILE.
* ENDIF. * CLEAR L_LEN.
* L_LEN = STRLEN( LS_ORDER_H-PROBLEM_DES ).
* WHILE L_LEN > 0.
* IF L_LEN > 130.
* L_CHAR_TMP = LS_ORDER_H-PROBLEM_DES+L_START(130).
* ELSE.
* L_CHAR_TMP = LS_ORDER_H-PROBLEM_DES+L_START(L_LEN).
* ENDIF.
* LW_LTXT-TDFORMAT = '*'.
* LW_LTXT-TDLINE = L_CHAR_TMP.
* APPEND LW_LTXT TO GT_LTXTS.
* L_START = L_START + 130.
* L_LEN = L_LEN - 130.
* ENDWHILE. ls_text-lines = gt_ltxts.
INSERT ls_text INTO TABLE lt_text. ls_field_names-fieldname = 'LINES'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'TEXTS'.
l_ref_guid = ls_input_field-ref_guid.
CONCATENATE 'CRM_ORDERH' l_ref_guid INTO ls_input_field-logical_key.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDLOOP. * endif.
*E*********************TEXT************************************************* *S*********************Service provider*************************************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
IF ls_order_h-ser_pro IS NOT INITIAL.
l_partner = ls_order_h-ser_pro.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner. ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI00SP'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner. ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDLOOP.
**********************Service provider************************************* **************consignor*******************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
IF ls_order_h-zzcons_ser_net IS NOT INITIAL.
l_partner = ls_order_h-zzcons_ser_net.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner. ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI0CON'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner. ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDLOOP. *************consignor**************************** *S*********************END_USER_ID************************************* CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
l_partner = ls_order_h-bp_number.
**********************************************************************20170217-Begin
*开发顾问:陈国光
*业务顾问:张弛
*日本分公司-O 50000231
*HOS_CRM_JP_10_备件销售订单增强_V1.0_20170117
*日本一次性客户替代需求
IF ls_order_h-otcust_det IS NOT INITIAL.
l_partner = ls_order_h-otcust_det.
ENDIF.
**********************************************************************20170217-End
*******add by dq-yuw 20161029 start
IF ls_order_h-country = 'ZA' OR lv_land EQ 'ZA'.
IF ls_order_h-process_type = 'ZSR3'."退机申请sold to party为retailer
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT' "新加逻辑:如果retailer为9位,则sold to、bill to、payer都截取前6位作为partner,因为9位的都是门店,只和总部结算
EXPORTING
input = ls_order_h-re_partner_no
IMPORTING
output = lv_char10.
IF strlen( lv_char10 ) >= .
lv_char6 = lv_char10+().
CLEAR lv_char10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_char6
IMPORTING
output = lv_char10.
l_partner = lv_char10. ELSE.
l_partner = ls_order_h-re_partner_no.
ENDIF. ENDIF.
ENDIF. *******end add
***add by dq-yuw 20160628 start
* SELECT SINGLE * INTO ls_zcrmt0013
* FROM zcrmt0013
* WHERE tab_name = 'ZOT_CUSTOMER'
* and VALUE1 = ls_order_h-process_type.
*
* IF ls_order_h-country = 'US' AND ( ls_order_h-process_type = 'ZSO1' OR ls_order_h-process_type = 'ZSO5' ).
* l_partner = ls_zcrmt0013-value3..
* ENDIF.
***end add
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
IF ls_order_h-process_type = 'ZWO3' OR ls_order_h-process_type = 'ZWO4'.
ls_partner-partner_fct = ''.
ELSE.
IF ls_order_h-country = 'AU' AND ls_order_h-process_type = 'ZSO1'.
ls_partner-partner_fct = ''.
ELSE.
ls_partner-partner_fct = ''.
ENDIF.
ENDIF.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
IF ls_order_h-otcust_det_street IS NOT INITIAL.
ls_partner-str_suppl1 = ls_order_h-otcust_det_street.
ls_field_names-fieldname = 'STR_SUPPL1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
***add by dq-yuw 20160628 start
* IF ls_order_h-country = 'US' AND ( ls_order_h-process_type = 'ZSO1' OR ls_order_h-process_type = 'ZSO5' ).
* ls_partner-ref_partner_handle = '0001'.
* ENDIF.
****end add
INSERT ls_partner INTO TABLE lt_partner. ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
***add by dq-yuw 20160628 start
* IF ls_order_h-country = 'US' AND ( ls_order_h-process_type = 'ZSO1' OR ls_order_h-process_type = 'ZSO5' ).
* ls_input_field-logical_key = '0001'.
* ENDIF.
****end add
INSERT ls_input_field INTO TABLE lt_input_field.
**********************************************************************20170217-Begin
*开发顾问:陈国光
*业务顾问:张弛
*日本分公司-O 50000231
*HOS_CRM_JP_10_备件销售订单增强_V1.0_20170117
*日本一次性客户替代需求 00000001 00000002 00000003 00000004
IF ls_order_h-otcust_det IS NOT INITIAL.
ls_partner-partner_fct = ''.
ls_partner-ref_partner_handle = ls_input_field-logical_key = ''.
INSERT ls_partner INTO TABLE lt_partner.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_partner-partner_fct = ''.
ls_partner-ref_partner_handle = ls_input_field-logical_key = ''.
INSERT ls_partner INTO TABLE lt_partner.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_partner-partner_fct = ''.
ls_partner-ref_partner_handle = ls_input_field-logical_key = ''.
INSERT ls_partner INTO TABLE lt_partner.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
**********************************************************************20170217-End
CLEAR ls_order_h. ENDLOOP.
*E*********************END_USER_ID************************************* ********************* *RETAILER ********************************************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
IF ls_order_h-re_partner_no IS NOT INITIAL.
l_partner = ls_order_h-re_partner_no.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI00RT'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
* ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDLOOP. ********************* *RETAILER ******************************************** ********************* *AU ZSO1 Sold to ********************************************
IF ls_order_h-country = 'AU' AND ls_order_h-process_type = 'ZSO1'.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
SELECT SINGLE cash_bp INTO l_partner FROM zinprogressrdoly.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = ''.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
* ENDIF.
ENDLOOP.
ENDIF. ********************* *AU ZSO1 Sold to ******************************************** ********************* *Logistical company start add by Ivanliu ********************************************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
IF ls_order_h-lo_partner_no IS NOT INITIAL.
l_partner = ls_order_h-lo_partner_no.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
* ls_partner-ref_partner_handle = '0000'.
ls_partner-ref_partner_handle = ''."change by dq-yuw 原先的0000与retailer的序号冲突,所以改成0006
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI0LGC'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
* ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
ls_input_field-logical_key = ''."change by dq-yuw 原先的0000与retailer的序号冲突,所以改成0006
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDLOOP. ********************* Logistical company end add by Ivanliu ******************************************************************************
***********************add by dq-yuw 20161029 start for ZA company 退机申请 redetermine sold to ship to bill to......
"ship to
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
IF ls_order_h-process_type EQ 'ZSR3'."退机申请,如果是at home,ship to就是客户,不然就是retailer
IF lv_land EQ 'ZA' OR ls_order_h-country EQ 'ZA'.
IF ls_order_h-zzafld000008 EQ 'A'."customer's home
l_partner = ls_order_h-bp_number.
ELSE.
l_partner = ls_order_h-re_partner_no.
ENDIF. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = ''."ship to
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h. ENDIF.
ENDIF.
ENDLOOP. "BILL TO
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
IF ls_order_h-process_type EQ 'ZSR3'.
IF lv_land EQ 'ZA' OR ls_order_h-country EQ 'ZA'.
****新加逻辑:如果retailer为9位,则sold to、bill to、payer都截取前6位作为partner,因为9位的都是门店,海信只和总部结算
CLEAR:lv_char6,lv_char10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_order_h-re_partner_no
IMPORTING
output = lv_char10.
IF strlen( lv_char10 ) >= .
lv_char6 = lv_char10+().
CLEAR lv_char10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_char6
IMPORTING
output = lv_char10.
l_partner = lv_char10. ELSE.
l_partner = ls_order_h-re_partner_no.
ENDIF. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = ''."BILL TO
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDIF.
ENDLOOP. "PAYER
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
IF ls_order_h-process_type EQ 'ZSR3'.
IF lv_land EQ 'ZA' OR ls_order_h-country EQ 'ZA'.
****新加逻辑:如果retailer为9位,则sold to、bill to、payer都截取前6位作为partner,因为9位的都是门店,海信只和总部结算
CLEAR:lv_char6,lv_char10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_order_h-re_partner_no
IMPORTING
output = lv_char10.
IF strlen( lv_char10 ) >= .
lv_char6 = lv_char10+().
CLEAR lv_char10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_char6
IMPORTING
output = lv_char10.
l_partner = lv_char10. ELSE.
l_partner = ls_order_h-re_partner_no.
ENDIF. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = ''."PAYER
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDIF.
ENDLOOP. "HSI END USER
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
**********************************************************************20170217-Begin
*开发顾问:陈国光
*业务顾问:张弛
*日本分公司-O 50000231
*HOS_CRM_JP_10_备件销售订单增强_V1.0_20170117
* 对于日本分公司,如果客户的BP分组为Z001(End User),
* 则创建ZSO1(HSI Individual Sales)和ZSO5(HSI FREE Sales)时,
* 将客户BP保存到合作伙伴类型ZHSI00EU(HIS END User)中,
* 将售达方、送达方、付款方、收货方设置成一次性客户,同时将客户的地址信息,
* 赋值到备件销售订单的售达方、送达方、付款方、收货方。
* 赋值时,将街道STREET和街道2 STR_SUPPL1的值,中间加空格拼接起来,
* 保存到备件销售订单合作伙伴售达方、送达方、付款方、收货方地址中的街道2中。
CLEAR: l_partner.
IF ls_order_h-sales_org = 'O 50000231' .
IF ls_order_h-process_type = 'ZSO1'
OR ls_order_h-process_type = 'ZSO5'.
IF ls_order_h-otcust_det IS NOT INITIAL.
l_partner = ls_order_h-bp_number.
ENDIF.
ENDIF.
ENDIF.
IF ls_order_h-process_type EQ 'ZSR3'.
IF lv_land EQ 'ZA' OR ls_order_h-country EQ 'ZA'.
l_partner = ls_order_h-bp_number.
ENDIF.
ENDIF.
IF l_partner IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = ls_order_h-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI00EU'."PAYER
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
INSERT ls_partner INTO TABLE lt_partner.
ls_field_names-fieldname = 'DISPLAY_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NO_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PARTNER_NO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
**********************************************************************20170217-End
CLEAR ls_order_h.
ENDLOOP.
***********************END ADD
********************add by dq-yuw 20160628 start for USA company ***************************************** * CLEAR: ls_input_field, ls_field_names, lt_field_names.
* LOOP AT gt_order_h INTO ls_order_h.
* IF ls_order_h-country = 'US' AND ( ls_order_h-process_type = 'ZSO1' OR ls_order_h-process_type = 'ZSO5' ).
* l_partner = ls_order_h-bp_number.
* CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
* EXPORTING
* input = l_partner
* IMPORTING
* output = l_partner.
* ls_partner-ref_guid = ls_order_h-guid.
* ls_partner-ref_kind = 'A'.
* ls_partner-ref_partner_handle = '0002'.
* ls_partner-kind_of_entry = 'C'.
* ls_partner-partner_fct = '00000002'.
* ls_partner-partner_no = l_partner.
* ls_partner-display_type = 'BP'.
* ls_partner-no_type = 'BP'.
** ls_partner-mainpartner = 'X'.
* INSERT ls_partner INTO TABLE lt_partner.
*
* ls_partner-partner_fct = '00000003'.
* ls_partner-ref_partner_handle = '0003'.
* INSERT ls_partner INTO TABLE lt_partner.
*
* l_partner = ls_zcrmt0013-value3.
*
* CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
* EXPORTING
* input = l_partner
* IMPORTING
* output = l_partner.
*
* ls_partner-partner_fct = '00000004'.
* ls_partner-ref_partner_handle = '0004'.
* ls_partner-partner_no = l_partner.
* INSERT ls_partner INTO TABLE lt_partner.
*
*
* ls_field_names-fieldname = 'DISPLAY_TYPE'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'KIND_OF_ENTRY'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'NO_TYPE'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'PARTNER_FCT'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'PARTNER_NO'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_input_field-field_names = lt_field_names.
* ls_input_field-ref_guid = ls_order_h-guid.
* ls_input_field-ref_kind = 'A'.
* ls_input_field-objectname = 'PARTNER'.
*
* ls_input_field-logical_key = '0002'.
* INSERT ls_input_field INTO TABLE lt_input_field.
*
* ls_input_field-logical_key = '0003'.
* INSERT ls_input_field INTO TABLE lt_input_field.
*
* ls_input_field-logical_key = '0004'.
* INSERT ls_input_field INTO TABLE lt_input_field.
*
* CLEAR ls_order_h.
* ENDIF.
* ENDLOOP. * CALL FUNCTION 'CRM_ORDER_MAINTAIN'
* EXPORTING
* it_partner = lt_partner
* IMPORTING
* et_exception = re_et_exception
* CHANGING
* ct_input_fields = lt_input_field
* EXCEPTIONS
* error_occurred = 1
* document_locked = 2
* no_change_allowed = 3
* no_authority = 4
* OTHERS = 5.
* IF sy-subrc <> 0.
* error_type = 'E'.
* return-type = sy-msgty.
* return-id = sy-msgid.
* return-log_msg_no = sy-msgno.
* return-message = sy-msgv1.
* return-message_v2 = sy-msgv2.
* return-message_v3 = sy-msgv3.
* return-message_v4 = sy-msgv4.
* APPEND return.
* ENDIF.
*********end add FOR USA COMPANY **************************************************** *S*********************PRODUCT_ID**************************************
CLEAR: ls_input_field, ls_field_names, lt_field_names. LOOP AT gt_order_h INTO ls_order_h.
SELECT SINGLE product_guid INTO ls_refobject-guid_object
FROM comm_product
WHERE product_id = ls_order_h-product_id. ls_service_os-ref_guid = ls_order_h-guid.
ls_service_os-ref_kind = 'A'.
ls_osset-ref_guid = ls_order_h-guid.
ls_osset-subject_profile = 'ZSERV'.
ls_osset-profile_type = 'A'.
ls_refobject-ref_guid = ls_order_h-guid.
ls_refobject-product_id = ls_order_h-product_id.
ls_refobject-ib_ibase = ls_order_h-ib_ibase.
ls_refobject-ib_instance = ls_order_h-ib_instance.
ls_refobject-main_object = 'X'.
* ls_refobject-mode = 'A'.
ls_refobject-mode = 'B'. " Changed by DQ-LIULH 20150820
INSERT ls_refobject INTO TABLE lt_refobject.
ls_osset-refobject = lt_refobject.
INSERT ls_osset INTO TABLE lt_osset.
ls_service_os-osset = lt_osset.
ls_service_os-ref_guid = ls_order_h-guid.
ls_service_os-ref_kind = 'A'.
INSERT ls_service_os INTO TABLE lt_service_os. ls_field_names-fieldname = 'ALTID_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'IB_IBASE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'IB_INSTANCE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ID_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ID_TO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'INST_DISM_INFO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'MAIN_OBJECT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PART_CAUS_FAIL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'PRODUCT_ID'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'SERIAL_NUMBER'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'SERVICE_OS'.
* ls_input_field-logical_key = '0001'.
INSERT ls_input_field INTO TABLE lt_input_field.
* endif.
CLEAR: ls_order_h.
CLEAR: lt_refobject,lt_osset.
ENDLOOP. *S*********************ORGMAN******************************************
***************add by dq-yuw 20160628 for usa company only*************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
SELECT SINGLE * INTO ls_zbp_sales
FROM zbp_sales
WHERE bu_group = 'Z001'
AND ( country = 'US' OR country = 'JP' ). LOOP AT gt_order_h INTO ls_order_h.
**********************************************************************20170217-Begin
*开发顾问:陈国光
*业务顾问:张弛
*日本分公司-O 50000231
*HOS_CRM_JP_10_备件销售订单增强_V1.0_20170117
*销售范围新增日本逻辑
**********************************************************************20170217-End
IF ( ls_order_h-country = 'US' OR ls_order_h-country = 'JP' ) AND ( ls_order_h-process_type = 'ZSO1' OR ls_order_h-process_type = 'ZSO5' ). ls_orgman-ref_guid = ls_order_h-guid.
ls_orgman-ref_kind = 'A'.
ls_orgman-dis_channel = ls_zbp_sales-channel.
* ls_orgman-service_org_ori = 'C'.
* ls_orgman-service_orgr_ori = 'C'.
ls_orgman-sales_org_ori = 'C'.
* ls_orgman-dis_channel_ori = 'C'.
* ls_orgman-sales_off_ori = 'C'.
* ls_orgman-sales_orgr_ori = 'C'.
ls_orgman-sales_org = ls_zbp_sales-sales_org.
ls_orgman-sales_office = ls_zbp_sales-sales_office.
* ls_orgman-sales_org_resp = ls_order_h-sales_org_resp.
* ls_orgman-service_org_resp = ls_order_h-service_org_resp.
* ls_orgman-service_org = ls_order_h-service_org.
* ls_ORGMAN-SALES_ORG_SHORT = ORDER_H-SALES_ORG_SHORT.
* ls_ORGMAN-SALES_OFFICE_SHORT = ORDER_H-SALES_OFFICE_SHORT.
* ls_ORGMAN-SALES_ORG_RESP_SHORT = ORDER_H-SALES_ORG_RESP_SHORT.
* ls_ORGMAN-SERVICE_ORG_RESP_SHORT = ORDER_H-SERVICE_ORG_RESP_SHORT.
* ls_ORGMAN-SERVICE_ORG_SHORT = ORDER_H-SERVICE_ORG_SHORT.
INSERT ls_orgman INTO TABLE lt_orgman. ls_field_names-fieldname = 'DIS_CHANNEL'.
INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'DIS_CHANNEL_ORI'.
* INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'SALES_ORG'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'SALES_OFFICE'.
INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SALES_OFFICE_SHORT'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SALES_OFF_ORI'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SALES_ORGR_ORI'.
* INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'SALES_ORG_ORI'.
INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SALES_ORG_RESP'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SALES_ORG_RESP_SHORT'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SALES_ORG_SHORT'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORG'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORG'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORGR_ORI'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORG_ORI'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORG_RESP'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORG_RESP'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORG_RESP_SHORT'.
* INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'SERVICE_ORG_SHORT'.
* INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ORGMAN'.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDLOOP.
*******end add *****************************
*E*********************ORGMAN**************************************
*******add by dq-yuw 20161029 南非退机订单 销售范围从retailer的销售范围取一条
CLEAR: ls_input_field, ls_field_names, lt_field_names.
DATA lt_frg0010 TYPE TABLE OF crmv_bp_frg0010.
DATA ls_frg0010 TYPE crmv_bp_frg0010.
LOOP AT gt_order_h INTO ls_order_h.
IF lv_land EQ 'ZA' OR ls_order_h-country EQ 'ZA'.
IF ls_order_h-process_type EQ 'ZSR3'.
****新加逻辑:如果retailer为9位,则sold to、bill to、payer都截取前6位作为partner,因为9位的都是门店,海信只和总部结算
CLEAR:lv_char6,lv_char10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_order_h-re_partner_no
IMPORTING
output = lv_char10.
IF strlen( lv_char10 ) >= .
lv_char6 = lv_char10+().
CLEAR lv_char10.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_char6
IMPORTING
output = lv_char10.
l_partner = lv_char10. ELSE.
l_partner = ls_order_h-re_partner_no.
ENDIF. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner. SELECT * INTO TABLE lt_frg0010 FROM crmv_bp_frg0010 WHERE partner = l_partner.
READ TABLE lt_frg0010 INTO ls_frg0010 WITH KEY sales_org = 'O 50000192'."先读国内的
IF sy-subrc <> .
READ TABLE lt_frg0010 INTO ls_frg0010 INDEX .
ENDIF.
IF ls_frg0010 IS NOT INITIAL.
ls_orgman-ref_guid = ls_order_h-guid.
ls_orgman-ref_kind = 'A'.
ls_orgman-dis_channel = ls_frg0010-channel.
ls_orgman-sales_org_ori = 'C'.
ls_orgman-sales_org = ls_frg0010-sales_org.
IF ls_orgman-sales_org EQ 'O 50000192'.
ls_orgman-sales_office = 'O 50000193'."默认sales office
ELSEIF ls_orgman-sales_org EQ 'O 50000194'.
ls_orgman-sales_office = 'O 50000195'."默认sales office
ENDIF. INSERT ls_orgman INTO TABLE lt_orgman. ls_field_names-fieldname = 'DIS_CHANNEL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'SALES_ORG'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'SALES_OFFICE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'SALES_ORG_ORI'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ORGMAN'.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
****** end add *S*********************APPOINTMENT-PURCHASE*********************************
CLEAR: ls_input_field, ls_field_names, lt_field_names. LOOP AT gt_order_i INTO ls_order_i.
ls_appointment-ref_guid = ls_order_i-corder_guid.
ls_appointment-ref_kind = 'A'. * CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
* EXPORTING
* I_DATLO = ls_ORDER_i-PURCHASE_DATE
* I_TIMLO = ls_ORDER_i-PURCHASE_TIME
** I_TZONE = SY-ZONLO
* IMPORTING
* E_TIMESTAMP = ls_APPOINTMENT-TIMESTAMP_FROM. * ls_APPOINTMENT-APPT_TYPE = 'ZPURCHASE'.
* INSERT ls_APPOINTMENT INTO TABLE lt_APPOINTMENT. CLEAR: ls_field_names, lt_field_names.
ls_field_names-fieldname = 'DOMINANT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'DURATION'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'RULE_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'SHOW_LOCAL'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMEZONE_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIME_UNIT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_input_field.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_i-corder_guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZPURCHASE'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_i.
ENDLOOP. *E*********************APPOINTMENT-PURCHASE********************************* *S*********************APPOINTMENT-RESERVATION*********************************
CLEAR: ls_input_field, ls_field_names, lt_field_names. LOOP AT gt_order_i INTO ls_order_i. ls_appointment-ref_guid = ls_order_i-corder_guid.
ls_appointment-ref_kind = 'A'.
CLEAR: ls_field_names, lt_field_names.
ls_field_names-fieldname = 'DOMINANT'.
INSERT ls_field_names INTO TABLE lt_field_names.
CLEAR ls_field_names.
ls_field_names-fieldname = 'DURATION'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'RULE_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'SHOW_LOCAL'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMEZONE_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIME_UNIT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_input_field.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_i-corder_guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZRESERVATION'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_i.
ENDLOOP. *E*********************APPOINTMENT-RESERVATION********************************* *S*********************APPOINTMENT-FIRST_REPAIR*********************************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_i INTO ls_order_i.
ls_appointment-ref_guid = ls_order_i-corder_guid.
ls_appointment-ref_kind = 'A'.
CLEAR: ls_field_names, lt_field_names.
ls_field_names-fieldname = 'DOMINANT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'DURATION'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'RULE_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'SHOW_LOCAL'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMEZONE_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIME_UNIT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_input_field.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = lv_guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZFIRSTREPAIR'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_i.
ENDLOOP.
*E*********************APPOINTMENT-FIRST_REPAIR********************************* *S*********************APPOINTMENT-COMPLETED********************************* CLEAR: ls_input_field, ls_field_names, lt_field_names. LOOP AT gt_order_h INTO ls_order_h.
ls_appointment-ref_guid = ls_order_h-guid.
ls_appointment-ref_kind = 'A'. CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = ls_order_h-purchase_date
i_timlo = ls_order_h-purchase_time
* I_TZONE = SY-ZONLO
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZPURCHASE'.
INSERT ls_appointment INTO TABLE lt_appointment. CLEAR ls_appointment. CLEAR: ls_field_names, lt_field_names.
ls_field_names-fieldname = 'DOMINANT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'DURATION'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'RULE_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'SHOW_LOCAL'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMEZONE_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIME_UNIT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_input_field.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = lv_guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZPURCHASE'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field. * // ls_appointment-ref_guid = ls_order_h-guid.
ls_appointment-ref_kind = 'A'.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = ls_order_h-ser_date
i_timlo = ls_order_h-sug_ser_time
* I_TZONE = SY-ZONLO
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZRESERVATION'.
INSERT ls_appointment INTO TABLE lt_appointment. CLEAR: ls_field_names, lt_field_names.
ls_field_names-fieldname = 'DOMINANT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'DURATION'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'RULE_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'SHOW_LOCAL'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIMEZONE_FROM'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_field_names.
ls_field_names-fieldname = 'TIME_UNIT'.
INSERT ls_field_names INTO TABLE lt_field_names. CLEAR ls_input_field.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = lv_guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZRESERVATION'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field. CLEAR ls_order_h.
ENDLOOP.
*E*********************APPOINTMENT-COMPLETED********************************* *S*********************status************************************** CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_h INTO ls_order_h.
ls_status-ref_guid = ls_order_h-guid.
ls_status-ref_kind = 'A'.
ls_status-status = ls_order_h-stat.
IF ls_order_h-process_type = 'ZSV1'.
ls_status-user_stat_proc = 'ZHSV_001'.
IF ls_order_h-ser_pro IS NOT INITIAL.
ls_status-status ='E0002'.
ENDIF.
ELSEIF ls_order_h-process_type = 'ZSR1'.
ls_status-user_stat_proc = 'ZHSR_001'.
ELSE.
ls_status-user_stat_proc = 'ZHSV_001'.
ENDIF.
IF ls_order_h-process_type = 'ZSV3'.."退机订单创建直接为assign
ls_status-status ='E0014'.
ls_status-user_stat_proc ='ZHSV_003'.
ENDIF.
**********************************************************************20170217-Begin
*开发顾问:陈国光
*业务顾问:张弛
*日本分公司-O 50000231
*HOS_CRM_JP_10_备件销售订单增强_V1.0_20170117
*B、对于日本,通过集中建单平台,创建的ZSO1(HSI Individual Sales)和ZSO5(HSI Free Sales),状态默认为Z020(APPROVED)。
ls_status-user_stat_proc = ls_order_h-user_stat_proc.
IF ls_order_h-sales_org = 'O 50000231'.
IF ls_order_h-process_type = 'ZSO1'
OR ls_order_h-process_type = 'ZSO5'.
ls_tj30t-stsma = ls_status-user_stat_proc.
ls_tj30t-txt04 = 'Z020'.
CALL FUNCTION 'ZCRM_READ_TJ30T'
CHANGING
cs_tj30t = ls_tj30t.
ls_status-status = ls_tj30t-estat.
ENDIF.
ENDIF.
**********************************************************************20170217-End
ls_status-activate = 'X'.
INSERT ls_status INTO TABLE lt_status.
ls_field_names-fieldname = 'ACTIVATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_h-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'STATUS'.
CONCATENATE ls_status-status ls_status-user_stat_proc INTO ls_input_field-logical_key.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR ls_order_h.
ENDLOOP. *E*********************status************************************** *---------------------------------------> begin of start price condition
DATA: ls_cond_add TYPE prct_cond_external_input,
lt_pridoc_com TYPE crmt_pridoc_comt,
ls_pridoc_com TYPE crmt_pridoc_com. DATA lv_index TYPE i. READ TABLE gt_order_h INTO ls_order_h INDEX .. IF sy-subrc EQ AND ls_order_h-country EQ 'JP'. CLEAR: ls_input_field, ls_field_names, lt_field_names.
LOOP AT gt_order_i INTO ls_order_i.
lv_index = sy-tabix.
ls_pridoc_com-ref_handle = lv_index.
ls_pridoc_com-ref_guid = ls_order_i-guid.
ls_pridoc_com-ref_kind = 'A'. ls_cond_add-kschl = 'ZGSP'.
* ls_cond_add-kschl = '9PS0'.
* ls_cond_add-kpein = 1.
* ls_cond_add-kmein = 'PC'.
ls_cond_add-waers = 'JPY'.
ls_cond_add-KBETR = ls_order_i-pur_price / .
* ls_cond_add-kwert = ls_order_i-pur_price.
IF ls_cond_add-kbetr = .
ls_cond_add-kbetr_initial = abap_true.
ENDIF. INSERT ls_cond_add INTO TABLE ls_pridoc_com-cond_add.
INSERT ls_pridoc_com INTO lt_pridoc_com INDEX . ls_input_field-ref_handle = lv_index.
* ls_input_field-ref_guid = ls_order_i-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PRIDOC'. ls_field_names-fieldname = 'KSCHL'.
INSERT ls_field_names INTO TABLE ls_input_field-field_names.
ls_field_names-fieldname = 'WAERS'.
INSERT ls_field_names INTO TABLE ls_input_field-field_names.
ls_field_names-fieldname = 'KBETR'."KBETR
INSERT ls_field_names INTO TABLE ls_input_field-field_names.
ls_field_names-fieldname = 'KPEIN'.
INSERT ls_field_names INTO TABLE ls_input_field-field_names.
ls_field_names-fieldname = 'KMEIN'.
INSERT ls_field_names INTO TABLE ls_input_field-field_names.
ls_field_names-fieldname = 'MODE'.
INSERT ls_field_names INTO TABLE ls_input_field-field_names. INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR:ls_cond_add, ls_input_field.
ENDLOOP.
*<--------------------------------------end of price condition ENDIF.
*S*********************ORDER_I************************************** CLEAR: lt_orderadm_i, lt_schedlin_i, lt_service_i, lt_product_i, lt_pricing.
DATA: ws_order_i TYPE LINE OF zcorder_item_infor.
DATA ls_crmv_bp_frg0010 TYPE crmv_bp_frg0010.
"取得客户的销售范围
READ TABLE gt_order_h INTO ls_order_h INDEX .
IF sy-subrc EQ .
IF ls_order_h-process_type EQ 'ZSO1' OR ls_order_h-process_type EQ 'ZSO2' OR ls_order_h-process_type EQ 'ZSO5'.
SELECT SINGLE * INTO ls_crmv_bp_frg0010 FROM crmv_bp_frg0010 WHERE partner = ls_order_h-bp_number.
ENDIF.
ENDIF. LOOP AT gt_order_i INTO ls_order_i.
CLEAR: ls_input_field, ls_field_names, lt_field_names,
ls_orderadm_i, ls_schedlin_extdt, wk_schedlin,
lt_schedlin_extdt. ls_service_i-ref_guid = ls_order_i-guid.
INSERT ls_service_i INTO TABLE lt_service_i.
ls_product_i-ref_guid = ls_order_i-guid.
INSERT ls_product_i INTO TABLE lt_product_i. ls_pricing-ref_guid = ls_order_i-guid.
ls_pricing-ref_kind = 'B'.
INSERT ls_pricing INTO TABLE lt_pricing.
ls_schedlin_i-ref_guid = ls_order_i-guid.
ls_schedlin_extdt-quantity = ls_order_i-quantity.
ls_schedlin_extdt-logical_key = ''. INSERT ls_schedlin_extdt INTO TABLE lt_schedlin_extdt.
ls_schedlin_i-schedlines = lt_schedlin_extdt.
INSERT ls_schedlin_i INTO TABLE lt_schedlin_i.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_i-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'SCHEDLIN_I'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_field_names-fieldname = 'LOGICAL_KEY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'QUANTITY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_i-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'SCHEDLIN'.
ls_input_field-logical_key = ''.
INSERT ls_input_field INTO TABLE lt_input_field. CLEAR: ls_input_field, ls_field_names, lt_field_names. ls_orderadm_i-guid = ls_order_i-guid.
ls_orderadm_i-header = ls_order_i-corder_guid.
ls_orderadm_i-number_int = ls_order_i-number_int.
IF ls_order_i-number_h IS NOT INITIAL.
READ TABLE gt_order_i INTO ws_order_i WITH KEY corder_guid = ls_order_i-corder_guid
number_int = ls_order_i-number_h.
IF sy-subrc = .
ls_orderadm_i-parent = ws_order_i-guid.
ENDIF.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ls_orderadm_i-number_int
IMPORTING
output = ls_orderadm_i-number_int. ls_orderadm_i-ordered_prod = ls_order_i-product_id.
ls_orderadm_i-number_parent = ls_order_i-number_h.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_orderadm_i-ordered_prod
IMPORTING
output = ls_orderadm_i-ordered_prod. ls_orderadm_i-description = ls_order_i-product_id_des.
ls_orderadm_i-zzzserialno = ls_order_i-zzzserialno.
ls_orderadm_i-zzzserialno1 = ls_order_i-zzzserialno1.
ls_orderadm_i-zzzcustmodeno = ls_order_i-zzzcustmodeno.
ls_orderadm_i-zzpurc_date = ls_order_i-purchase_date.
ls_orderadm_i-zzsymp_grou = ls_order_i-zzsymp_grou.
ls_orderadm_i-zzsymp_code = ls_order_i-zzsymp_code.
ls_orderadm_i-zzcrm04p = ls_order_i-zzcrm04p."20161205 新增字段参考FS《HOS_CRM_SA_35_退换机扫码功能CRM端修改_V1.1_20161202》
**********************************************************************20170216-Begin
*开发顾问:陈国光
*业务顾问:张弛
*日本需求-O 50000231
*HOS_CRM_JP_10_备件销售订单增强_V1.0_20170117
* 点击“STOCK”按钮之后,选择库存地点之后,自动带到此字段中
* 工厂默认8410
* ZZPLANT 1 TYPES ZADTEL000025 CHAR 4 0 Plant
ls_orderadm_i-zzplant = ls_order_i-zzplant.
* ZZLGORT 1 TYPES ZADTEL000029 CHAR 4 0 Storage location
ls_orderadm_i-zzlgort = ls_order_i-zzlgort.
IF ls_crmv_bp_frg0010-sales_org EQ 'O 50000231'.
IF ls_orderadm_i-zzplant IS INITIAL.
ls_orderadm_i-zzplant = ''.
ENDIF.
ENDIF.
**********************************************************************20170216-End "工厂
IF ls_crmv_bp_frg0010-sales_org EQ 'O 50000192'.
ls_orderadm_i-zzplant = ''.
ELSEIF ls_crmv_bp_frg0010-sales_org EQ 'O 50000194'.
ls_orderadm_i-zzplant = ''.
ENDIF.
INSERT ls_orderadm_i INTO TABLE lt_orderadm_i. ls_field_names-fieldname = 'DESCRIPTION'.
INSERT ls_field_names INTO TABLE lt_field_names.
* ls_field_names-fieldname = 'ITM_TYPE'.
* INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ORDERED_PROD'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'MODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZBRAND'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZMODENO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZSERIALNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZSERIALNO1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZSERIALNO2'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZPLANT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZCRM04P'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ITM_PROC_IDENT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NUMBER_INT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'NUMBER_PARENT'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_field_names-fieldname = 'ZZPURC_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZZCUSTMODENO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZSYMP_GROU'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZSYMP_CODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZPLANT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZLGORT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = ls_order_i-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'ORDERADM_I'.
INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR: ls_order_i,lv_schedual_guid.
ENDLOOP.
*E*********************ORDER_I************************************** DATA: l_issave() TYPE c. DATA: l_repair_dat TYPE datum,
l_repair_dat_end TYPE datum. DATA: wk_serialno TYPE zhsi_serialno,
tk_serialno TYPE TABLE OF zhsi_serialno.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_activity_h = lt_activity_h
it_sales = lt_sales
it_product_i = lt_product_i
it_service_h = lt_service_h
it_service_i = lt_service_i
it_appointment = lt_appointment
it_text = lt_text
it_schedlin_i = lt_schedlin_i
it_partner = lt_partner
it_service_os = lt_service_os
it_status = lt_status
it_orgman = lt_orgman
it_pridoc = lt_pridoc_com
IMPORTING
et_exception = re_et_exception
CHANGING
ct_orderadm_h = lt_orderadm_h
ct_orderadm_i = lt_orderadm_i
ct_input_fields = lt_input_field
EXCEPTIONS
error_occurred =
document_locked =
no_change_allowed =
no_authority =
OTHERS = .
IF sy-subrc <> .
error_type = 'E'.
return-type = sy-msgty.
return-id = sy-msgid.
return-log_msg_no = sy-msgno.
return-message = sy-msgv1.
return-message_v2 = sy-msgv2.
return-message_v3 = sy-msgv3.
return-message_v4 = sy-msgv4.
APPEND return.
ENDIF.
CHECK error_type IS INITIAL. *data lv_mesty type SYMSGTY.
*data ls_handle type BALMSGHNDL.
*CALL FUNCTION 'CRM_MESSAGE_COLLECT'
* EXPORTING
* IV_CALLER_NAME = 'ORDERADM_H'
** IV_REF_OBJECT =
** IV_REF_KIND =
** IV_LOGICAL_KEY =
** IV_MSGNO = SY-MSGNO
** IV_MSGID = SY-MSGID
** IV_MSGTY = SY-MSGTY
** IV_MSGV1 = SY-MSGV1
** IV_MSGV2 = SY-MSGV2
** IV_MSGV3 = SY-MSGV3
** IV_MSGV4 = SY-MSGV4
** IV_MSGLEVEL =
** IV_FIELDNAME =
** IV_ACTION =
** IV_LOG_HANDLE =
** IV_DOCNUMBER =
** IV_CUMULATE = FALSE
** IV_USE_FRAME_LOG = FALSE
** IT_LONGTEXT =
** IV_EXTERNAL_CALL = FALSE
* IMPORTING
* EV_MSGTY = lv_mesty
* ES_MSG_HANDLE = ls_handle
* EXCEPTIONS
* NOT_FOUND = 1
* APPL_LOG_ERROR = 2
* OTHERS = 3
* .
*IF SY-SUBRC <> 0.
** Implement suitable error handling here
*ENDIF.
DATA: lt_msg_info TYPE crmt_msg_info_tab,
ls_msg_info TYPE crmt_msg_info,
is_msgh TYPE balmsghndl,
ls_msg TYPE bal_s_msg. LOOP AT gt_order_h INTO ls_order_h.
is_objects_to_save = ls_order_h-guid.
INSERT is_objects_to_save INTO TABLE it_objects_to_save.
CLEAR ls_order_h.
ENDLOOP.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = it_objects_to_save
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = re_et_exception
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved =
OTHERS = . "ADD BY DQ-YUW 在集中建单平台创建的时候捕捉order save抛出的消息,予以提示
IF lt_objects_not_saved IS INITIAL.
COMMIT WORK.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
LOOP AT lt_objects_not_saved INTO ls_objects_not_saved.
CLEAR: lt_msg_info[].
CALL FUNCTION 'CRM_MESSAGES_SEARCH'
EXPORTING
iv_ref_object = ls_objects_not_saved
iv_ref_kind = 'A'
iv_only_errors_on_object = 'X'
IMPORTING
et_msg_info = lt_msg_info
EXCEPTIONS
appl_log_error =
error_occurred =
OTHERS = .
LOOP AT lt_msg_info INTO ls_msg_info.
CLEAR: is_msgh, ls_msg.
is_msgh-log_handle = ls_msg_info-log_handle.
is_msgh-msgnumber = ls_msg_info-msgnumber.
CALL FUNCTION 'BAL_LOG_MSG_READ'
EXPORTING
i_s_msg_handle = is_msgh
IMPORTING
e_s_msg = ls_msg
EXCEPTIONS
log_not_found =
msg_not_found =
OTHERS = .
IF sy-subrc EQ .
IF ls_msg-msgty = 'E'.
error_type = 'E'.
***20161206 消息组装错误-Begin
*陈国光
"error_log = ls_msg-msgv1.
MESSAGE ID ls_msg-msgid TYPE ls_msg-msgty
NUMBER ls_msg-msgno
WITH ls_msg-msgv1 ls_msg-msgv2
ls_msg-msgv3 ls_msg-msgv3 INTO error_log.
***20161206 消息组装错误-End
return-type = error_type.
return-message = error_log.
APPEND return.
EXIT.
ENDIF.
ENDIF.
ENDLOOP. ls_guid_init = ls_objects_not_saved.
APPEND ls_guid_init TO lt_guid_init. IF error_type = 'E'..
EXIT.
ENDIF. ENDLOOP.
ENDIF. * CHECK ERROR_TYPE IS INITIAL. ***end add return_object_id = lt_saved_objects.
LOOP AT lt_saved_objects INTO ls_saved_objects.
ls_guid_init = ls_saved_objects-guid.
APPEND ls_guid_init TO lt_guid_init.
ENDLOOP. CALL FUNCTION 'CRM_ORDER_INITIALIZE'
EXPORTING
it_guids_to_init = lt_guid_init
EXCEPTIONS
error_occurred =
OTHERS = .
IF sy-subrc <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. ***retailer and contact add by dq-yuw 20161010
DATA ls_zcrmt0023 TYPE zcrmt0023.
READ TABLE order_h INTO ls_order_h INDEX .
IF sy-subrc EQ AND NOT ls_order_h-re_partner_no IS INITIAL.
ls_zcrmt0023-retailer_id = ls_order_h-re_partner_no.
ls_zcrmt0023-contact_person = ls_order_h-contact_person.
ls_zcrmt0023-mobile = ls_order_h-contact_mobile.
ls_zcrmt0023-phone = ls_order_h-contact_phone.
ls_zcrmt0023-e_mail = ls_order_h-contact_e_mail.
ls_zcrmt0023-fax_number = ls_order_h-contact_fax. MODIFY zcrmt0023 FROM ls_zcrmt0023. ENDIF. ENDFUNCTION.

CRM ORDER_MAINTAIN的更多相关文章

  1. Enterprise Solution 3.1 企业应用开发框架 .NET ERP/CRM/MIS 开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

    行业:基于数据库的制造行业管理软件,包含ERP.MRP.CRM.MIS.MES等企业管理软件 数据库平台:SQL Server 2005或以上 系统架构:C/S 开发技术 序号 领域 技术 1 数据库 ...

  2. SAP CRM 性能小技巧

    导言 本页面打算收集SAP CRM实施中可以用于避免性能问题的注意事项,重要的事项会由图标标识. 如果你有其他的技巧想要说出来,别犹豫! 性能注意事项 通用 缓存读取类访问,特别是在性能关键的地方,比 ...

  3. SAP CRM 树视图(TREE VIEW)

    树视图可以用于表示数据的层次. 例如:SAP CRM中的组织结构数据可以表示为树视图. 在SAP CRM Web UI的术语当中,没有像表视图(table view)或者表单视图(form view) ...

  4. SAP CRM 用户界面对象类型和设计对象

    在CRM中的用户界面对象类型的帮助下,我们可以做这些工作: 进行不同的视图配置 创建动态导航 从设计层控制字段标签.值帮助 控制BOL对象的属性的可视性 从导航栏访问自定义组件 一个用户界面对象类型之 ...

  5. SAP CRM 显示消息/在消息中进行导航

    向用户展示消息,在任何软件中都是十分重要的. 在SAP CRM WEB UI中展示消息,不是一项很难的任务,只需要创建消息并在之后调用方法来显示它 消息类和消息号: 我在SE91中创建了如下的消息类和 ...

  6. Dynamics CRM 2015-Data Encryption激活报错

    在CRM的日常开发中,Data Encryption经常是不得不开启的一个功能.但是有时,我们可能遇到一种情况,Organization导入之后,查看Data Encryption是已激活的状态,但是 ...

  7. SAP CRM 客户控制器与数据绑定

    当用户从视图离开时,视图将失去它的数据.解决这个问题,需要引入客户控制器(Custom Controller)(译者注:SAP CRM客户端中,不同地方的Custom Controller会翻译为“客 ...

  8. SAP CRM BOL编程基础,代码+详细注释

    网络上可以找到一些使用BOL查询.维护数据的DEMO,但几乎都是单纯的代码,缺乏说明,难以理解.本文除了代码外,还给出了详细的注释,有助于理解BOL编程中的一些基本概念. 这是一篇翻译的文章,你可能会 ...

  9. SAP CRM 通过调试观察CL_CRM_BOL_ENTITY中的数据

    这个(BOL里面)最重要的类值得一看. BOL中的每条记录都会在CL_CRM_BOL_ENTIT中表示.至今,我们已经写过一些事件处理器,并且我们已经直接或间接的通过这个类工作.在业务场景中,我们也许 ...

随机推荐

  1. Neo4j 文档

    Graph Fundamentals 基础 Basic concepts to get you going. A graph database can store any kind of data u ...

  2. 使用vue做表单验证

    <template> <Form ref="formInline" :model="formInline" :rules="rule ...

  3. javascript创建函数的20种方式汇总

    http://www.jb51.net/article/68285.htm 工作中常常会创建一个函数来解决一些需求问题,以下是个人在工作中总结出来的创建函数20种方式,你知道多少? function ...

  4. Vim-编辑器之神

    几点声明: 作者只是一位小小的 \(OIer\) ,并不会什么过于神仙的东西,我这篇文章只是帮助人入门的而已. 若有人在 OI-Wiki上见过了原文章,原作者是我 \(......\) ,真不是抄 \ ...

  5. HDU 4301 Divide Chocolate(DP)

    http://acm.hdu.edu.cn/showproblem.php?pid=4301 题意: 有一块n*2大小的巧克力,现在某人要将这巧克力分成k个部分,每个部分大小随意,问有多少种分法. 思 ...

  6. 理解 Redis(7) - Set 值

    unordered collection of unique strings.set值是唯一的字符串的无序集合, 把握住两个特点: 唯一, 无序. 清空所有的数据, 并清理显示界面: 127.0.0. ...

  7. 使用JS与CSS3的翻转实现3D翻牌效果

    之前我们有讨论过使用CSS3如何实现网页水平翻转的效果,而这次我们介绍的是翻转效果更深一层的应用——3D翻牌效果. 这里我们需要使用flip中轴翻转实现,又因为是3D效果,如果希望呈现一定的3D视角, ...

  8. R语言矩阵栅格显示矩阵颜色显示

    效果如下:

  9. HDU - 1400 Mondriaan's Dream

    HDU - 1400 思路: 轮廓线dp入门题 #include<bits/stdc++.h> using namespace std; #define fi first #define ...

  10. Day1-Request/BeautifulSoup

    requests Python标准库中提供了:urllib.urllib2.httplib等模块以供Http请求,但是,它的 API 太渣了.它是为另一个时代.另一个互联网所创建的.它需要巨量的工作, ...