抬头结构:ZCRM_MAINTAIN_H
flag header:
项目表:ZCRM_MAINTAIN_I
合作伙伴:ZCRM_MAINTAIN_P
price:ZCRM_MAINTAIN_PR
FUNCTION zcrm_order_maintain_bk.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(HEAD) TYPE ZCRM_MAINTAIN_H OPTIONAL
*" VALUE(HEADX) TYPE ZCRM_MAINTAIN_HX OPTIONAL
*" EXPORTING
*" REFERENCE(ERROR_TYPE) TYPE STRING
*" REFERENCE(ERROR_LOG) TYPE STRING
*" REFERENCE(OBJECT_O) TYPE CRMT_OBJECT_ID
*" TABLES
*" ITEM STRUCTURE ZCRM_MAINTAIN_I OPTIONAL
*" ITEMX STRUCTURE ZCRM_MAINTAIN_IX OPTIONAL
*" PARTNER STRUCTURE ZCRM_MAINTAIN_P OPTIONAL
*" PARTNERX STRUCTURE ZCRM_MAINTAIN_PX OPTIONAL
*" PRICE STRUCTURE ZCRM_MAINTAIN_PR OPTIONAL
*" PRICEX STRUCTURE ZCRM_MAINTAIN_PRX OPTIONAL
*"---------------------------------------------------------------------- DATA : lv_text() TYPE c.
DATA:
wk_orderadm_h TYPE crmt_orderadm_h_wrk,
tk_orderadm_h TYPE crmt_orderadm_h_wrkt,
wk_schedlin TYPE crmt_schedlin_wrk,
tk_schedlin TYPE crmt_schedlin_wrkt,
wk_status TYPE crmt_status_wrk,
tk_status TYPE crmt_status_wrkt,
ls_service_os TYPE crmt_srv_osset_com,
lt_service_os TYPE crmt_srv_osset_comt,
wk_osset TYPE crmt_srv_osset_wrk1,
tk_osset TYPE crmt_srv_osset_wrkt1,
ls_text TYPE crmt_text_com,
lt_text TYPE crmt_text_comt,
ls_sales TYPE crmt_sales_com,
lt_sales TYPE crmt_sales_comt,
ls_partner TYPE crmt_partner_com,
lt_partner TYPE crmt_partner_comt,
gt_partner TYPE crmt_partner_comt,
ls_appointment TYPE crmt_appointment_com,
lt_appointment TYPE crmt_appointment_comt,
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,
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_h TYPE crmt_service_h_com,
lt_service_h TYPE crmt_service_h_comt,
ls_customer_h TYPE crmt_customer_h_com,
lt_customer_h TYPE crmt_customer_h_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_schedlin_extdt TYPE crmt_schedlin_extd,
lt_schedlin_extdt TYPE crmt_schedlin_extdt,
ls_orderadm_i TYPE crmt_orderadm_i_com,
lt_orderadm_i TYPE crmt_orderadm_i_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_pric_cond TYPE prct_cond_external_input,
lt_pric_cond TYPE prct_cond_external_input_t,
lt_pric_chag TYPE prct_cond_external_change_t, "add by ly 20180124
ls_pric_chag TYPE prct_cond_external_change,
ls_pridoc TYPE crmt_pridoc_com,
lt_pridoc TYPE crmt_pridoc_comt.
DATA: wk_header TYPE crmt_object_guid_tab.
DATA: ls_orderadm_h TYPE crmt_orderadm_h_com,
lt_orderadm_h TYPE crmt_orderadm_h_comt,
vs_orderadm_h TYPE crmt_orderadm_h_com,
vt_orderadm_h TYPE crmt_orderadm_h_comt,
ls_doc_flow TYPE crmt_doc_flow_com,
lt_doc_flow TYPE crmt_doc_flow_comt,
ls_orgman TYPE crmt_orgman_com,
lt_orgman TYPE crmt_orgman_comt,
ls_status TYPE crmt_status_com,
lt_status TYPE crmt_status_comt,
lt_error_log TYPE zerror_log_tab,
ls_error_log TYPE zerror_log.
DATA: w_orderadm_h TYPE crmd_orderadm_h.
"定义全局时区,根据销售组织来判断
DATA:gv_zonlo TYPE syst_zonlo.
DATA:gv_date TYPE datum,
gv_time TYPE uzeit,
gv_timez TYPE comt_created_at_usr. DATA: l_len TYPE i,
l_start TYPE i,
l_char_tmp() TYPE c,
l_handle TYPE crmt_handle,
ls_ztakg_num_upload TYPE ztakg_num_upload,
l_ref_guid() TYPE c,
l_mode TYPE crmt_mode,
l_partner TYPE bu_partner. DATA: ls_input_field TYPE crmt_input_field.
DATA: lt_input_field TYPE crmt_input_field_tab.
DATA: gt_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.
DATA: gt_ltxts TYPE STANDARD TABLE OF tline .
DATA: lw_ltxt TYPE tline . CLEAR: ls_input_field, lt_input_field,
ls_field_names, lt_field_names. DATA:gt_tj30t TYPE TABLE OF tj30t,
gw_tj30t LIKE LINE OF gt_tj30t,
gw_profile TYPE crmc_proc_type,
gw_index TYPE zhsb_order_index,
gw_sale TYPE zhsb_sales_index.
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.
DATA:gw_zbp_sales TYPE zbp_sales,
gw_item TYPE zcrm_maintain_i,
gv_item TYPE zcrm_maintain_i,
gw_itemx TYPE zcrm_maintain_ix,
gw_partner TYPE zcrm_maintain_p,
gw_partnerx TYPE zcrm_maintain_px,
gw_price TYPE zcrm_maintain_pr,
gw_pricex TYPE zcrm_maintain_prx,
gt_dd03l TYPE TABLE OF dd03l,
gw_dd03l LIKE LINE OF gt_dd03l.
DATA:lt_guid_init TYPE crmt_object_guid_tab,
ls_guid_init LIKE LINE OF lt_guid_init.
DATA:
lv_sum_crmt_schedlin_quan TYPE crmt_schedlin_quan,
lv_sum_prct_cond_rate TYPE prct_cond_rate,
lv_zsrv_mileage_fee TYPE flag,
lt_zsrvt_mil_rule02 TYPE TABLE OF zsrvt_mil_rule02,
ls_zsrvt_mil_rule02 TYPE zsrvt_mil_rule02,
ls_zsrvt_mil_rule01 TYPE zsrvt_mil_rule01. "取order数据定义
DATA:ot_header TYPE crmt_object_guid_tab,
ow_header TYPE crmt_object_guid,
ot_order_h TYPE crmt_orderadm_h_wrkt,
ot_schedlin TYPE crmt_schedlin_wrkt,
ow_schedlin TYPE crmt_schedlin_wrk,
ot_cond TYPE crmt_pric_cond_t,
ow_cond TYPE crmt_pric_cond,
ot_price TYPE prct_cond_du_tab,
ow_price TYPE prct_cond_du,
ot_partner TYPE crmt_partner_external_wrkt,
ow_partner TYPE crmt_partner_external_wrk,
ow_text TYPE crmt_text_wrk,
ot_text TYPE crmt_text_wrkt.
FIELD-SYMBOLS:<fs> TYPE any,
<fsx> TYPE any,
<partner> TYPE any. CHECK head-guid IS NOT INITIAL.
REFRESH:lt_guid_init.
ls_guid_init = head-guid.
APPEND ls_guid_init TO lt_guid_init. SELECT SINGLE * INTO gw_index FROM zhsb_order_index WHERE guid = head-guid.
IF sy-subrc = .
SELECT SINGLE * INTO gw_profile FROM crmc_proc_type WHERE process_type = gw_index-process_type.
ELSE.
SELECT SINGLE * INTO gw_sale FROM zhsb_sales_index WHERE guid = head-guid.
IF sy-subrc = .
SELECT SINGLE * INTO gw_profile FROM crmc_proc_type WHERE process_type = gw_sale-process_type.
ELSE.
SELECT SINGLE * INTO gw_profile FROM crmc_proc_type WHERE process_type = head-order_type.
ENDIF.
ENDIF. SELECT * INTO TABLE gt_tj30t FROM tj30t WHERE stsma = gw_profile-user_stat_proc AND spras = 'E'. ls_orderadm_h-guid = head-guid.
"******************************HEAD*************************BEGIN
"CUSTOMER_MODEL
IF headx-customer_model = 'X'.
* CONCATENATE head-factory_model head-customer_model INTO ls_orderadm_h-zzzmodeno SEPARATED BY '.'.
ls_orderadm_h-zzzmodeno = head-customer_model.
ls_field_names-fieldname = 'ZZZMODENO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"FACTORY_MODEL
IF headx-factory_model = 'X'.
ls_orderadm_h-zzfld00000h = head-factory_model.
ls_field_names-fieldname = 'ZZFLD00000H'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"DELAYREASONCODE
IF headx-delayreasoncode = 'X'.
ls_orderadm_h-zzafld000002 = head-delayreasoncode.
ls_field_names-fieldname = 'ZZAFLD000002'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"UNSOLVEDCODE
IF headx-unsolvedcode = 'X'.
ls_orderadm_h-zzafld000003 = head-unsolvedcode.
ls_field_names-fieldname = 'ZZAFLD000003'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"WARRANTY
IF headx-warrantype = 'X'.
ls_orderadm_h-zzwarranty = head-warrantype.
ls_field_names-fieldname = 'ZZWARRANTY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SERIALNO
IF headx-serialno = 'X'.
ls_orderadm_h-zzzserialno = head-serialno.
ls_field_names-fieldname = 'ZZZSERIALNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SERIALNO1
IF headx-zzzserialno1 = 'X'.
ls_orderadm_h-zzzserialno1 = head-zzzserialno1.
ls_field_names-fieldname = 'ZZZSERIALNO1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SERIALNO2
IF headx-zzzserialno2 = 'X'.
ls_orderadm_h-zzzserialno2 = head-zzzserialno2.
ls_field_names-fieldname = 'ZZZSERIALNO2'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SYMPTOMS_CODE
IF headx-symptoms_code = 'X'.
ls_orderadm_h-zzzsymptomscode = head-symptoms_code.
ls_field_names-fieldname = 'ZZZSYMPTOMSCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SYMPTOMS_CODE_G
IF headx-symptoms_code_g = 'X'.
ls_orderadm_h-zzzsymptomsgroup = head-symptoms_code_g.
ls_field_names-fieldname = 'ZZZSYMPTOMSGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"DEFECT_CODE
IF headx-defect_code = 'X'.
ls_orderadm_h-zzzdefectcode = head-defect_code.
ls_field_names-fieldname = 'ZZZDEFECTCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"DEFECT_CODE_G
IF headx-defect_code_g = 'X'.
ls_orderadm_h-zzzdefectgroup = head-defect_code_g.
ls_field_names-fieldname = 'ZZZDEFECTGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"REPAIR_CODE
IF headx-repair_code = 'X'.
ls_orderadm_h-zzzrepaircode = head-repair_code.
ls_field_names-fieldname = 'ZZZREPAIRCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"REPAIR_CODE_G
IF headx-repair_code_g = 'X'.
ls_orderadm_h-zzzrepairgroup = head-repair_code_g.
ls_field_names-fieldname = 'ZZZREPAIRGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"HEAD DESCRIPTION
IF headx-problem_des = 'X'.
ls_orderadm_h-description = head-problem_des.
ls_field_names-fieldname = 'DESCRIPTION'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ORDER TYPE
IF headx-order_type = 'X'.
ls_orderadm_h-process_type = head-order_type.
ls_field_names-fieldname = 'PROCESS_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"CREATE USER
IF headx-create_user = 'X'.
ls_orderadm_h-created_by = head-create_user.
ls_field_names-fieldname = 'CREATED_BY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"POSTING DATE
IF headx-create_date = 'X'.
ls_orderadm_h-posting_date = sy-datum.
ls_field_names-fieldname = 'POSTING_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
IF headx-posting_date = 'X'.
ls_orderadm_h-posting_date = head-posting_date.
ls_field_names-fieldname = 'POSTING_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
ENDIF. "PRODUCT ID->group brand
IF headx-product_id = 'X'.
SELECT SINGLE product_guid INTO lv_productguid
FROM comm_product
WHERE product_id = head-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_orderadm_h-zzzgroup = ls_prprdcatr-category_id+().
ls_orderadm_h-zzzbrand = ls_prprdcatr-category_id+().
ENDIF. 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.
ENDIF.
IF headx-zzzgroup = 'X'.
DELETE lt_field_names WHERE fieldname = 'ZZZGROUP'.
ls_orderadm_h-zzzgroup = head-zzzgroup.
ls_field_names-fieldname = 'ZZZGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-zzzbrand = 'X'.
DELETE lt_field_names WHERE fieldname = 'ZZZBRAND'.
ls_orderadm_h-zzzbrand = head-zzzbrand.
ls_field_names-fieldname = 'ZZZBRAND'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "SERVICE_TYPE
IF headx-service_type = 'X'.
ls_orderadm_h-zzfld00000n = head-service_type.
ls_field_names-fieldname = 'ZZFLD00000N'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"IN_PROGRESS
IF headx-in_progress = 'X'.
ls_orderadm_h-zzdlyrsn = head-in_progress.
ls_field_names-fieldname = 'ZZDLYRSN'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZIMEI
IF headx-zzimei = 'X'.
ls_orderadm_h-zzimei = head-zzimei.
ls_field_names-fieldname = 'ZZIMEI'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZIMEI1
IF headx-zzimei1 = 'X'.
ls_orderadm_h-zzimei1 = head-zzimei1.
ls_field_names-fieldname = 'ZZIMEI1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"COLLECT_POINT
IF headx-collect_point = 'X'.
ls_orderadm_h-zzafld000008 = head-collect_point.
ls_field_names-fieldname = 'ZZAFLD000008'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_FR_COM
IF headx-tracking_no_fr_com = 'X'.
ls_orderadm_h-zzafld000000 = head-tracking_no_fr_com.
ls_field_names-fieldname = 'ZZAFLD000000'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_FR
IF headx-tracking_no_fr = 'X'.
ls_orderadm_h-zzztracksent = head-tracking_no_fr.
ls_field_names-fieldname = 'ZZZTRACKSENT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_TO_COM
IF headx-tracking_no_to_com = 'X'.
ls_orderadm_h-zzafld000001 = head-tracking_no_to_com.
ls_field_names-fieldname = 'ZZAFLD000001'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_TO
IF headx-tracking_no_to = 'X'.
ls_orderadm_h-zzztrackreturn = head-tracking_no_to.
ls_field_names-fieldname = 'ZZZTRACKRETURN'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZCON_TYPE
IF headx-ztype = 'X'.
ls_orderadm_h-zzcon_type = head-ztype.
ls_field_names-fieldname = 'ZZCON_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Old object id
IF headx-zzafld000004 = 'X'.
ls_orderadm_h-zzafld000004 = head-zzafld000004.
ls_field_names-fieldname = 'ZZAFLD000004'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Agent Invoice
IF headx-zzagentinovice = 'X'.
ls_orderadm_h-zzagentinovice = head-zzagentinovice.
ls_field_names-fieldname = 'ZZAGENTINOVICE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Mobile Client Type
IF headx-mbl_clt_type = 'X'.
ls_orderadm_h-zzclient_type = head-mbl_clt_type.
ls_field_names-fieldname = 'ZZCLIENT_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Packaging
IF headx-pacakging = 'X'.
ls_orderadm_h-zzontime = head-pacakging.
ls_field_names-fieldname = 'ZZONTIME'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Customer Order Number
IF headx-zzzcusordno = 'X'.
ls_orderadm_h-zzzcusordno = head-zzzcusordno.
ls_field_names-fieldname = 'ZZZCUSORDNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Transaction ID
IF headx-zzztransaid = 'X'.
ls_orderadm_h-zzztransaid = head-zzztransaid.
ls_field_names-fieldname = 'ZZZTRANSAID'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Second level name code
IF headx-zzlevelcode = 'X'.
ls_orderadm_h-zzlevelcode = head-zzlevelcode.
ls_field_names-fieldname = 'ZZLEVELCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Second level name code
IF headx-store_name1 = 'X'.
ls_orderadm_h-zzretailer_name = head-store_name1.
ls_field_names-fieldname = 'ZZRETAILER_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Questionnaires
IF headx-zzzquestnairid = 'X'.
ls_orderadm_h-zzzquestnairid = head-zzzquestnairid.
ls_field_names-fieldname = 'ZZZQUESTNAIRID'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"Sales Order Header Product ID
IF headx-zzfld000003 = 'X'.
ls_orderadm_h-zzfld000003 = head-zzfld000003.
ls_field_names-fieldname = 'ZZFLD000003'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "complain type
IF headx-zzafld000015 = 'X'.
ls_orderadm_h-zzafld000015 = head-zzafld000015.
ls_field_names-fieldname = 'ZZAFLD000015'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzfld00000o = 'X'.
ls_orderadm_h-zzfld00000o = head-zzfld00000o.
ls_field_names-fieldname = 'ZZFLD00000O'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "ZZSOURCE
IF headx-zzsource = 'X'.
ls_orderadm_h-zzsource = head-zzsource.
ls_field_names-fieldname = 'ZZSOURCE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZLOGI_STATUS
IF headx-zzlogi_status = 'X'.
ls_orderadm_h-zzlogi_status = head-zzlogi_status.
ls_field_names-fieldname = 'ZZLOGI_STATUS'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzrepchg_type = 'X'.
ls_orderadm_h-zzrepchg_type = head-zzrepchg_type.
ls_field_names-fieldname = 'ZZREPCHG_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzrprepair = 'X'.
ls_orderadm_h-zzzrprepair = head-zzzrprepair.
ls_field_names-fieldname = 'ZZZRPREPAIR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "DISTANCE
IF headx-distance = 'X'.
ls_orderadm_h-zzdistance = head-distance.
ls_field_names-fieldname = 'ZZDISTANCE'.
INSERT ls_field_names INTO TABLE lt_field_names.
**********************************************************************20161101-Begin
*开发顾问:陈国光
*业务顾问:龚慧文
*里程费规则时 清除里程费
REFRESH:lt_zsrvt_mil_rule02.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE lt_zsrvt_mil_rule02
FROM zsrvt_mil_rule02
WHERE sales_org = head-sales_org
AND process_type = head-order_type.
IF lt_zsrvt_mil_rule02[] IS NOT INITIAL.
CLEAR:ls_orderadm_h-zzzoutother.
lv_zsrv_mileage_fee = abap_true.
*里程费中[里程]字段数字有效性校验 20161202-Begin
TRY .
lv_sum_crmt_schedlin_quan = head-distance.
CATCH cx_sy_conversion_no_number.
error_type = 'E'.
CONCATENATE 'Distance[' head-distance '] is not Number!' INTO error_log.
ENDTRY.
***计算里程费
*判断是是否需要行项目-Begin
CLEAR:ls_zsrvt_mil_rule02.
READ TABLE lt_zsrvt_mil_rule02 INTO ls_zsrvt_mil_rule02 INDEX .
IF ls_zsrvt_mil_rule02-zrule02 = 'A1'.
CLEAR:ls_zsrvt_mil_rule01.
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF ls_zsrvt_mil_rule01
FROM zsrvt_mil_rule01
WHERE sales_org = head-sales_org
AND process_type = head-order_type.
CALL FUNCTION 'ZCRM_COUNT_ZSRVT_MIL_RULE02'
EXPORTING
is_zsrvt_mil_rule01 = ls_zsrvt_mil_rule01
is_zsrvt_mil_rule02 = ls_zsrvt_mil_rule02
TABLES
it_zsrvt_mil_rule02 = lt_zsrvt_mil_rule02
CHANGING
cv_sum_crmt_schedlin_quan = lv_sum_crmt_schedlin_quan
cv_sum_prct_cond_rate = lv_sum_prct_cond_rate.
ls_orderadm_h-zzzoutother = lv_sum_prct_cond_rate.
ls_field_names-fieldname = 'ZZZOUTOTHER'.
INSERT ls_field_names INTO TABLE lt_field_names.
lv_zsrv_mileage_fee = abap_false.
ENDIF.
*判断是是否需要行项目-End
ENDIF.
ENDIF. IF head-object_id IS INITIAL."工单创建
ls_orderadm_h-mode = 'A'.
ELSE.
ow_header = head-guid.
INSERT ow_header INTO TABLE ot_header.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = ot_header
* IT_ITEM_GUID =
* IV_MODE =
* IV_ONLY_SPEC_ITEMS =
* IT_REQUESTED_OBJECTS =
* IV_NO_AUTH_CHECK =
* IT_ITEM_USAGE_RANGE =
* IV_SUBITEM_DEPTH = -1
* IT_OBJECT_FILTER =
* IV_ONLY_CHANGED_OBJ = FALSE
* IV_STATUS_H_CHECK_RELEVANCE = FALSE
* IV_TEXT_LOG_SINGLE = FALSE
IMPORTING
et_orderadm_h = ot_order_h
* ET_OPPORT_H =
* ET_LEAD_H =
* ET_ACTIVITY_H =
* ET_LAWREF_H =
* ET_ORDERADM_I =
* ET_OPPORT_I =
* ET_ACTIVITY_I =
* ET_PRODUCT_I =
* ET_FINPROD_I =
* ET_BATCH =
* ET_CONFIG =
* ET_STRUCT_I =
* ET_SALES =
* ET_PRICING =
* ET_PRICING_I =
* ET_ORGMAN =
* ET_SHIPPING =
* ET_CUSTOMER_H =
* ET_CUSTOMER_I =
* ET_SERVICE_H =
* ET_SERVICE_I =
* ET_SERVICE_ASSIGN =
* ET_QUALIF =
* ET_PAYPLAN =
* ET_PAYPLAN_D =
* ET_APPOINTMENT =
et_text = ot_text
et_schedlin = ot_schedlin
et_partner = ot_partner
* ET_SERVICE_OS =
* ET_REFOBJ =
* ET_SUBJECT =
* ET_CUMULAT_H =
* ET_STATUS =
* ET_STATUS_H =
* ET_SCHEDLIN_I =
* ET_CANCEL =
* ET_CANCEL_IR =
* ET_CANCEL_CR =
* ET_BILLPLAN =
* ET_BILLING =
* ET_ORDPRP_I =
* ET_ORDPRP_I_D =
* ET_ORDPRP_OBJL_I_D =
* ET_CUMULATED_I =
* ET_DOC_FLOW =
* ET_EXCEPTION =
et_pridoc = ot_cond
* ET_PRICE_AGREEMENTS_CRM =
* ET_PRICE_AGREEMENTS_BBP =
* ET_CONFIG_FILTER =
* ET_SERVICEPLAN_I =
* ET_SERVICEPLAN_IE =
* ET_EXTENSION =
* ET_CREDITVALUES =
* ET_SURVEY =
* ET_AC_ASSIGN =
* ET_APO_I =
* ET_EXT_REF =
* ET_UBB_CTR_I =
* ET_UBB_CR_I =
* ET_UBB_VOL_I =
* ET_CHNGPROC_H =
* ET_CHNGPROC_I =
* ET_DOC_FLOW_PNT =
* ET_FUND_H =
* ET_CLA_H =
* ET_SRV_REQ_H =
* ET_APPROVAL =
* ET_EXTENSION2 =
* ET_CLA_I =
* CHANGING
* CV_LOG_HANDLE =
EXCEPTIONS
document_not_found =
error_occurred =
document_locked =
no_change_authority =
no_display_authority =
no_change_allowed =
OTHERS = .
IF sy-subrc <> .
ENDIF. ENDIF. INSERT ls_orderadm_h INTO TABLE lt_orderadm_h. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ORDERADM_H'.
INSERT ls_input_field INTO TABLE lt_input_field.
"******************************HEAD*************************END "******************************sales org********************begin
IF headx-sales_org = 'X'.
SELECT SINGLE * INTO gw_zbp_sales FROM zbp_sales WHERE sales_org = head-sales_org.
ls_orgman-ref_guid = head-guid.
ls_orgman-ref_kind = 'A'.
ls_orgman-dis_channel = gw_zbp_sales-channel.
ls_orgman-sales_org_ori = 'C'.
ls_orgman-sales_org = gw_zbp_sales-sales_org.
ls_orgman-sales_office = gw_zbp_sales-sales_office."默认sales office 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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ORGMAN'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
"******************************sales org********************end "******************************SERVICE_H********************BEGIN
IF headx-store_contact_person IS NOT INITIAL OR
headx-store_contact_cellphone IS NOT INITIAL OR
headx-store_contact_phone IS NOT INITIAL OR
headx-store_contact_email IS NOT INITIAL.
ls_service_h-ref_guid = head-guid.
IF headx-store_contact_person IS NOT INITIAL.
ls_service_h-zzcon_person = head-store_contact_person.
ls_field_names-fieldname = 'ZZCON_PERSON'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-store_contact_cellphone IS NOT INITIAL.
ls_service_h-zzcon_mob = head-store_contact_cellphone.
ls_field_names-fieldname = 'ZZCON_MOB'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-store_contact_phone IS NOT INITIAL.
ls_service_h-zzcon_phone = head-store_contact_phone.
ls_field_names-fieldname = 'ZZCON_PHONE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-store_contact_email IS NOT INITIAL.
ls_service_h-zzcon_email = head-store_contact_email.
ls_field_names-fieldname = 'ZZCON_EMAIL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
"******************************SERVICE_H********************end
"******************************CUSTOMER_H********************BEGIN
IF headx-zzord_origin IS NOT INITIAL.
ls_customer_h-ref_guid = head-guid.
ls_customer_h-zzord_origin = head-zzord_origin.
ls_field_names-fieldname = 'ZZORD_ORIGIN'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'CUSTOMER_H'. INSERT ls_input_field INTO TABLE lt_input_field.
INSERT ls_customer_h INTO TABLE lt_customer_h.
CLEAR:ls_customer_h.
ENDIF.
"******************************CUSTOMER_H********************end "******************************SERVICE_OS*************************BEGIN
IF headx-product_id = 'X'.
SELECT SINGLE product_guid INTO ls_refobject-guid_object
FROM comm_product
WHERE product_id = head-product_id.
IF sy-subrc = .
ls_service_os-ref_guid = head-guid.
ls_service_os-ref_kind = 'A'.
ls_osset-ref_guid = head-guid.
ls_osset-subject_profile = 'ZSERV'.
ls_osset-profile_type = 'A'.
ls_refobject-ref_guid = head-guid.
ls_refobject-product_id = head-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 = 'B'.
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 = head-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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'SERVICE_OS'.
INSERT ls_input_field INTO TABLE lt_input_field.
* endif.
CLEAR: lt_refobject,lt_osset.
ENDIF.
ENDIF. "*S*********************SALES********************************
IF headx-sp_order = 'X' OR headx-store_reference_no = 'X'..
REFRESH:lt_sales.
CLEAR:ls_sales.
ls_sales-ref_guid = head-guid.
ls_sales-ref_kind = 'A'. IF headx-store_reference_no = 'X'.
ls_sales-po_number_ship = head-store_reference_no.
ls_field_names-fieldname = 'PO_NUMBER_SHIP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-sp_order = 'X'.
ls_sales-po_number_sold = head-sp_order.
ls_field_names-fieldname = 'PO_NUMBER_SOLD'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-create_date = 'X'.
ls_sales-po_date_sold = head-create_date.
ls_field_names-fieldname = 'PO_DATE_SOLD'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
INSERT ls_sales INTO TABLE lt_sales.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
ENDIF. "*E*********************SALES******************************** "*S*********************TEXT*************************************
"SET DEFAULT TIME ZONE
IF head-sales_org = 'O 50000297'."法国
gv_zonlo = 'WAT'.
ELSEIF head-sales_org = 'O 50000005'."西班牙
gv_zonlo = 'CAT'.
ELSEIF head-sales_org = 'O 50000231'."日本
gv_zonlo = 'UTC+9'.
ELSEIF head-sales_org = 'O 50000362'."英国
gv_zonlo = 'UK'.
ELSE."其他以中国记
gv_zonlo = 'UTC+8'.
ENDIF.
CONVERT DATE sy-datum TIME sy-uzeit INTO TIME STAMP gv_timez TIME ZONE 'UTC+8'.
CONVERT TIME STAMP gv_timez TIME ZONE gv_zonlo INTO DATE gv_date TIME gv_time.
IF headx-repair_note = 'X'.
CONCATENATE gv_date+() '/' gv_date+() '/' gv_date+()
' RFC ' gv_time+() ':' gv_time+() ':' gv_time+() ' '
head-repair_note INTO head-repair_note.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'A002'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'U'.
READ TABLE ot_text INTO ow_text WITH KEY ref_guid = head-guid.
IF sy-subrc = .
IF ow_text-stxh-tdid = 'A002'.
APPEND LINES OF ow_text-lines TO gt_ltxts.
ENDIF.
ENDIF.
l_len = strlen( head-repair_note ).
WHILE strlen( head-repair_note ) > .
IF strlen( head-repair_note ) > .
lw_ltxt-tdline = head-repair_note+().
l_len = l_len - .
head-repair_note = head-repair_note+(l_len).
ELSE.
lw_ltxt-tdline = head-repair_note.
CLEAR:head-repair_note.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF.
IF headx-unsolvedreason = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH16'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-unsolvedreason ).
WHILE strlen( head-unsolvedreason ) > .
IF strlen( head-unsolvedreason ) > .
lw_ltxt-tdline = head-unsolvedreason+().
l_len = l_len - .
head-repair_note = head-unsolvedreason+(l_len).
ELSE.
lw_ltxt-tdline = head-unsolvedreason.
CLEAR:head-unsolvedreason.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF.
IF headx-can_reason = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH14'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-can_reason ).
WHILE strlen( head-can_reason ) > .
IF strlen( head-can_reason ) > .
lw_ltxt-tdline = head-can_reason+().
l_len = l_len - .
head-can_reason = head-can_reason+(l_len).
ELSE.
lw_ltxt-tdline = head-can_reason.
CLEAR:head-can_reason.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-zh28 = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH28'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-zh28 ).
WHILE strlen( head-zh28 ) > .
IF strlen( head-zh28 ) > .
lw_ltxt-tdline = head-zh28+().
l_len = l_len - .
head-zh28 = head-zh28+(l_len).
ELSE.
lw_ltxt-tdline = head-zh28.
CLEAR:head-zh28.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-zh30 = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH30'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-zh30 ).
WHILE strlen( head-zh30 ) > .
IF strlen( head-zh30 ) > .
lw_ltxt-tdline = head-zh30+().
l_len = l_len - .
head-zh30 = head-zh30+(l_len).
ELSE.
lw_ltxt-tdline = head-zh30.
CLEAR:head-zh30.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-problem_note = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH30'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-problem_note ).
WHILE strlen( head-problem_note ) > .
IF strlen( head-problem_note ) > .
lw_ltxt-tdline = head-problem_note+().
l_len = l_len - .
head-problem_note = head-problem_note+(l_len).
ELSE.
lw_ltxt-tdline = head-problem_note.
CLEAR:head-problem_note.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF.
"*E*********************TEXT************************************* "******************************SERVICE_OS*************************END *S*********************status**************************************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-order_status = 'X'.
ls_status-ref_guid = head-guid.
ls_status-ref_kind = 'A'.
READ TABLE gt_tj30t INTO gw_tj30t WITH KEY estat = head-order_status.
IF sy-subrc = .
ls_status-status = head-order_status.
ELSE.
READ TABLE gt_tj30t INTO gw_tj30t WITH KEY txt04 = head-order_status.
IF sy-subrc = .
ls_status-status = gw_tj30t-estat.
ENDIF.
ENDIF.
ls_status-user_stat_proc = gw_profile-user_stat_proc.
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 = head-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.
ENDIF. *E*********************status************************************** *S*********************APPOINTMENT-DATE********************************* CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-ack_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-ack_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZACKNOWLEG'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZACKNOWLEG'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-repair_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-repair_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZREPAIR'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZREPAIR'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-assign_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-assign_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZASSIGNMENT'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZASSIGNMENT'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-in_depot_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-in_depot_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZDELIVER'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZDELIVER'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-zfeedback = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-zfeedback
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZFEEDBACK'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZFEEDBACK'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-purchase_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-purchase_date
i_timlo = sy-uzeit
i_tzone = gv_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 = head-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.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-reservation_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-reservation_date
i_timlo = sy-uzeit
i_tzone = gv_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 = head-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.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-zrefund = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-zrefund
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZREFUND'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZREFUND'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. IF headx-zexchange = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-zexchange
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZEXCHANGE'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZEXCHANGE'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
*E*********************APPOINTMENT-DATE********************************* *S********************* *partnr ********************************************
IF headx-sp_partner = 'X'."服务商
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
CLEAR:ls_partner,ow_partner.
l_partner = head-sp_partner.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI00SP'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI00SP'.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI00SP' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0001'.
INSERT ls_input_field INTO TABLE lt_input_field. "bill to pay to 都是服务商
"bill
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
INSERT ls_partner INTO TABLE lt_partner.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
"payer
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
INSERT ls_partner INTO TABLE lt_partner.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
IF headx-end_user_id = 'X'."终端用户
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-end_user_id.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI00EU'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI00EU'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI00EU'.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI00EU'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI00EU'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI00EU' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
IF headx-sold_to = 'X'."售达方
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-sold_to.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = ''.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0005'.
INSERT ls_input_field INTO TABLE lt_input_field. IF head-order_type+() = 'ZSO' OR zcl_otr=>sold_as_bill = 'X'."销售的bill to payer都是sold to
zcl_otr=>sold_as_bill = ''.
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
CLEAR:ow_partner.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_partner_fct = ''.
ENDIF.
INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
"payer
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
CLEAR:ow_partner.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_partner_fct = ''.
ENDIF.
INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0003'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
ENDIF.
IF headx-ship_to = 'X'."售达方
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-ship_to.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = ''.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0006'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
IF headx-store_id = 'X'."Reatiler
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-store_id.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI00RT'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI00RT'.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI00RT'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI00RT'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI00RT' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. IF headx-bp09 = 'X'."Activity Partner
CLEAR:ls_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-bp09.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. 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 = head-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.
*E********************* *partnr ******************************************** *S**************************ITEM ********************************************
READ TABLE ot_cond INTO ow_cond INDEX .
LOOP AT item INTO gw_item.
CLEAR:ow_schedlin."读取历史记录
READ TABLE ot_schedlin INTO ow_schedlin WITH KEY item_guid = gw_item-guid.
IF sy-subrc = .
* gw_item-guid = ow_schedlin-guid.
ELSE.
IF gw_item-guid IS INITIAL.
CALL FUNCTION 'CRM_GUID_CREATE'
IMPORTING
ev_guid = gw_item-guid.
ENDIF.
ENDIF. 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 = gw_item-guid.
INSERT ls_service_i INTO TABLE lt_service_i. ls_product_i-ref_guid = gw_item-guid.
INSERT ls_product_i INTO TABLE lt_product_i. ls_pricing-ref_guid = gw_item-guid.
ls_pricing-ref_kind = 'B'.
INSERT ls_pricing INTO TABLE lt_pricing. ls_schedlin_i-ref_guid = gw_item-guid.
ls_schedlin_extdt-quantity = gw_item-item_quantity.
IF ow_schedlin IS NOT INITIAL.
ls_schedlin_extdt-guid = ow_schedlin-guid.
ls_schedlin_extdt-logical_key = ow_schedlin-guid.
ELSE.
ls_schedlin_extdt-logical_key = ''.
ENDIF.
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. CLEAR: ls_input_field, ls_field_names, lt_field_names.
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 = gw_item-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'SCHEDLIN'.
IF ow_schedlin IS NOT INITIAL..
ls_input_field-logical_key = ow_schedlin-guid.
ELSE.
ls_input_field-logical_key = ''.
ENDIF. INSERT ls_input_field INTO TABLE lt_input_field. CLEAR: ls_input_field, ls_field_names, lt_field_names. ls_orderadm_i-guid = gw_item-guid.
ls_orderadm_i-header = gw_item-head_guid.
ls_orderadm_i-number_int = gw_item-item_number.
ls_orderadm_i-itm_type = gw_item-item_category. 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 = gw_item-item_product_id.
ls_orderadm_i-number_parent = gw_item-item_high_level.
IF gw_item-item_high_level IS NOT INITIAL.
READ TABLE item INTO gv_item WITH KEY guid = gw_item-guid
item_number = gw_item-item_high_level.
IF sy-subrc = .
ls_orderadm_i-parent = gv_item-guid.
ENDIF.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_orderadm_i-ordered_prod
IMPORTING
output = ls_orderadm_i-ordered_prod. ls_orderadm_i-description = gw_item-item_product_des.
ls_orderadm_i-zzzserialno = gw_item-item_serial_no.
ls_orderadm_i-zzzserialno1 = gw_item-item_serial_no_1.
ls_orderadm_i-zzzserialno2 = gw_item-item_serial_no_2.
ls_orderadm_i-zzorderadm_i0403 = gw_item-zzorderadm_i0403.
ls_orderadm_i-zzorderadm_i0404 = gw_item-zzorderadm_i0404.
ls_orderadm_i-zzorderadm_i0405 = gw_item-item_imei_1.
ls_orderadm_i-zzorderadm_i0406 = gw_item-item_imei_1.
ls_orderadm_i-zzzcustmodeno = gw_item-zzzmodeno.
ls_orderadm_i-zzplant = gw_item-item_plant.
ls_orderadm_i-zzlgort = gw_item-item_storage_loc.
ls_orderadm_i-zzcrm04p = gw_item-exre_reason.
ls_orderadm_i-zzpurc_date = gw_item-purchase_date.
ls_orderadm_i-zzreturn_process = gw_item-zzreturn_process.
ls_orderadm_i-zzzgroup = gw_item-zzzgroup.
ls_orderadm_i-zzsymp_grou = gw_item-zzsymp_grou.
ls_orderadm_i-zzsymp_code = gw_item-zzsymp_code.
ls_orderadm_i-zzzremark = gw_item-zzzremark.
ls_orderadm_i-zzorderadm_i0407 = gw_item-item_zzorderadm_i0407.
ls_orderadm_i-zzref_exh_date = gw_item-item_zzref_exh_date.
ls_orderadm_i-zzsymp_text = gw_item-item_zzsymp_text.
IF gw_item-mode = 'D'.
ls_orderadm_i-mode = 'D'.
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 = '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. READ TABLE itemx INTO gw_itemx WITH KEY guid = gw_item-guid.
IF sy-subrc = .
IF gw_itemx-item_high_level = 'X'.
ls_field_names-fieldname = 'NUMBER_PARENT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_serial_no = 'X'.
ls_field_names-fieldname = 'ZZZSERIALNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_serial_no_1 = 'X'.
ls_field_names-fieldname = 'ZZZSERIALNO1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_serial_no_2 = 'X'.
ls_field_names-fieldname = 'ZZZSERIALNO2'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzmodeno = 'X'.
ls_field_names-fieldname = 'ZZZCUSTMODENO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_plant = 'X'.
ls_field_names-fieldname = 'ZZPLANT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_storage_loc = 'X'.
ls_field_names-fieldname = 'ZZLGORT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-exre_reason = 'X'.
ls_field_names-fieldname = 'ZZCRM04P'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-purchase_date = 'X'.
ls_field_names-fieldname = 'ZZPURC_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzorderadm_i0403 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0403'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzorderadm_i0404 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0404'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_imei_1 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0405'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_imei_2 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0406'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzreturn_process = 'X'.
ls_field_names-fieldname = 'ZZRETURN_PROCESS'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzgroup = 'X'.
ls_field_names-fieldname = 'ZZZGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzsymp_grou = 'X'.
ls_field_names-fieldname = 'ZZSYMP_GROU'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzsymp_code = 'X'.
ls_field_names-fieldname = 'ZZSYMP_CODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzremark = 'X'.
ls_field_names-fieldname = 'ZZZREMARK'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_zzorderadm_i0407 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0407'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_zzref_exh_date = 'X'.
ls_field_names-fieldname = 'ZZREF_EXH_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_zzsymp_text = 'X'.
ls_field_names-fieldname = 'ZZSYMP_TEXT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
ENDIF. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = gw_item-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'ORDERADM_I'.
INSERT ls_input_field INTO TABLE lt_input_field.
REFRESH:lt_pric_cond,lt_pric_chag.
CLEAR:ls_pridoc.
LOOP AT price INTO gw_price WHERE ref_guid = gw_item-guid.
ot_price[] = ow_cond-pric_cond[]."add by ly 20180124
SORT ot_price[] BY kposn kschl stunr zaehk DESCENDING.
READ TABLE ot_price INTO ow_price WITH KEY kposn = gw_item-guid kschl = gw_price-kschl.
IF sy-subrc = .
ls_pric_chag-stunr = ow_price-stunr.
ls_pric_chag-zaehk = ow_price-zaehk.
ls_pric_chag-kbetr = gw_price-kbetr.
ls_pric_chag-kpein = .
ls_pric_chag-kmein = ow_price-kmein.
INSERT ls_pric_chag INTO TABLE lt_pric_chag.
ls_pridoc-cond_change[] = lt_pric_chag[].
ELSE.
ls_pric_cond-kschl = gw_price-kschl.
ls_pric_cond-kbetr = gw_price-kbetr.
ls_pric_cond-kwert = gw_price-kwert.
INSERT ls_pric_cond INTO TABLE lt_pric_cond.
ls_pridoc-cond_add[] = lt_pric_cond[].
ENDIF. ls_pridoc-ref_guid = gw_item-guid.
ls_pridoc-ref_kind = 'B'.
INSERT ls_pridoc INTO TABLE lt_pridoc. CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_field_names-fieldname = 'KSCHL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KBETR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KWERT'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-ref_guid = gw_item-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'PRIDOC'.
ls_input_field-field_names = lt_field_names.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDLOOP. ENDLOOP.
*E**************************ITEM ******************************************** CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_sales = lt_sales
it_text = lt_text
it_status = lt_status
it_service_os = lt_service_os
it_service_h = lt_service_h
it_customer_h = lt_customer_h
it_service_i = lt_service_i
it_appointment = lt_appointment
it_schedlin_i = lt_schedlin_i
it_product_i = lt_product_i
it_orgman = lt_orgman
it_partner = lt_partner
it_pridoc = lt_pridoc
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 <> .
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'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF. CHECK error_type <> 'E'. CLEAR:lt_exception.
is_objects_to_save = head-guid.
INSERT is_objects_to_save INTO TABLE it_objects_to_save.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = it_objects_to_save
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved =
OTHERS = . IF lt_objects_not_saved IS NOT INITIAL.
error_type = 'E'.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO error_log.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. CALL FUNCTION 'CRM_ORDER_DEQUEUE'
EXPORTING
iv_guid = head-guid. READ TABLE lt_saved_objects INTO ls_saved_objects INDEX .
error_type = 'S'.
MESSAGE s322(zcrm_msg) WITH ls_saved_objects-object_id INTO error_log.
* error_log = 'Create Order:' && ls_saved_objects-object_id && ' successful'.
object_o = ls_saved_objects-object_id. REFRESH: tk_orderadm_h,
lt_orderadm_h,
lt_input_field,
it_objects_to_save,
lt_saved_objects.
CLEAR: tk_orderadm_h,
wk_orderadm_h,
lt_orderadm_h,
ls_orderadm_h,
lt_input_field,
it_objects_to_save,
lt_saved_objects.
ENDIF. 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 INTO error_log.
* error_type = sy-msgty.
ENDIF. IF head-prov_guid IS NOT INITIAL."关联前序订单
CALL FUNCTION 'ZCRM_CREATE_DOC_FLOW'
IN BACKGROUND TASK
EXPORTING
iv_guid_a = head-prov_guid
iv_guid_b = head-guid
iv_order_guid = head-guid.
COMMIT WORK.
ENDIF. IF error_type = 'S'.
"add by ly 20170908 增加里程费项目
IF lv_zsrv_mileage_fee = abap_true.
CALL FUNCTION 'ZSRV_MILEAGE_FEE' " IN BACKGROUND TASK
EXPORTING
iv_guid = head-guid.
ENDIF.
ENDIF.
ENDFUNCTION.
"20181217封板:
FUNCTION zcrm_order_maintain_bk.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(HEAD) TYPE ZCRM_MAINTAIN_H OPTIONAL
*" VALUE(HEADX) TYPE ZCRM_MAINTAIN_HX OPTIONAL
*" EXPORTING
*" REFERENCE(ERROR_TYPE) TYPE STRING
*" REFERENCE(ERROR_LOG) TYPE STRING
*" REFERENCE(OBJECT_O) TYPE CRMT_OBJECT_ID
*" TABLES
*" ITEM STRUCTURE ZCRM_MAINTAIN_I OPTIONAL
*" ITEMX STRUCTURE ZCRM_MAINTAIN_IX OPTIONAL
*" PARTNER STRUCTURE ZCRM_MAINTAIN_P OPTIONAL
*" PARTNERX STRUCTURE ZCRM_MAINTAIN_PX OPTIONAL
*" PRICE STRUCTURE ZCRM_MAINTAIN_PR OPTIONAL
*" PRICEX STRUCTURE ZCRM_MAINTAIN_PRX OPTIONAL
*"---------------------------------------------------------------------- DATA : lv_text() TYPE c.
DATA:
wk_orderadm_h TYPE crmt_orderadm_h_wrk,
tk_orderadm_h TYPE crmt_orderadm_h_wrkt,
wk_schedlin TYPE crmt_schedlin_wrk,
tk_schedlin TYPE crmt_schedlin_wrkt,
wk_status TYPE crmt_status_wrk,
tk_status TYPE crmt_status_wrkt,
ls_service_os TYPE crmt_srv_osset_com,
lt_service_os TYPE crmt_srv_osset_comt,
wk_osset TYPE crmt_srv_osset_wrk1,
tk_osset TYPE crmt_srv_osset_wrkt1,
ls_text TYPE crmt_text_com,
lt_text TYPE crmt_text_comt,
ls_sales TYPE crmt_sales_com,
lt_sales TYPE crmt_sales_comt,
ls_partner TYPE crmt_partner_com,
lt_partner TYPE crmt_partner_comt,
gt_partner TYPE crmt_partner_comt,
ls_appointment TYPE crmt_appointment_com,
lt_appointment TYPE crmt_appointment_comt,
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,
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_h TYPE crmt_service_h_com,
lt_service_h TYPE crmt_service_h_comt,
ls_activity_h TYPE crmt_activity_h_com,
lt_activity_h TYPE crmt_activity_h_comt,
ls_customer_h TYPE crmt_customer_h_com,
lt_customer_h TYPE crmt_customer_h_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_schedlin_extdt TYPE crmt_schedlin_extd,
lt_schedlin_extdt TYPE crmt_schedlin_extdt,
ls_orderadm_i TYPE crmt_orderadm_i_com,
lt_orderadm_i TYPE crmt_orderadm_i_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_pric_cond TYPE prct_cond_external_input,
lt_pric_cond TYPE prct_cond_external_input_t,
lt_pric_chag TYPE prct_cond_external_change_t, "add by ly 20180124
ls_pric_chag TYPE prct_cond_external_change,
ls_pridoc TYPE crmt_pridoc_com,
lt_pridoc TYPE crmt_pridoc_comt.
DATA: wk_header TYPE crmt_object_guid_tab.
DATA: ls_orderadm_h TYPE crmt_orderadm_h_com,
lt_orderadm_h TYPE crmt_orderadm_h_comt,
vs_orderadm_h TYPE crmt_orderadm_h_com,
vt_orderadm_h TYPE crmt_orderadm_h_comt,
ls_doc_flow TYPE crmt_doc_flow_com,
lt_doc_flow TYPE crmt_doc_flow_comt,
ls_orgman TYPE crmt_orgman_com,
lt_orgman TYPE crmt_orgman_comt,
ls_status TYPE crmt_status_com,
lt_status TYPE crmt_status_comt,
lt_error_log TYPE zerror_log_tab,
ls_error_log TYPE zerror_log.
DATA: w_orderadm_h TYPE crmd_orderadm_h.
"定义全局时区,根据销售组织来判断
DATA:gv_zonlo TYPE syst_zonlo.
DATA:gv_date TYPE datum,
gv_time TYPE uzeit,
gv_timez TYPE comt_created_at_usr. DATA: l_len TYPE i,
l_start TYPE i,
l_char_tmp() TYPE c,
l_handle TYPE crmt_handle,
ls_ztakg_num_upload TYPE ztakg_num_upload,
l_ref_guid() TYPE c,
l_mode TYPE crmt_mode,
l_partner TYPE bu_partner. DATA: ls_input_field TYPE crmt_input_field.
DATA: lt_input_field TYPE crmt_input_field_tab.
DATA: gt_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.
DATA: gt_ltxts TYPE STANDARD TABLE OF tline .
DATA: lw_ltxt TYPE tline . CLEAR: ls_input_field, lt_input_field,
ls_field_names, lt_field_names. DATA:gt_tj30t TYPE TABLE OF tj30t,
gw_tj30t LIKE LINE OF gt_tj30t,
gw_profile TYPE crmc_proc_type,
gw_index TYPE zhsb_order_index,
gw_sale TYPE zhsb_sales_index.
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.
DATA:gw_zbp_sales TYPE zbp_sales,
gw_item TYPE zcrm_maintain_i,
gv_item TYPE zcrm_maintain_i,
gw_itemx TYPE zcrm_maintain_ix,
gw_partner TYPE zcrm_maintain_p,
gw_partnerx TYPE zcrm_maintain_px,
gw_price TYPE zcrm_maintain_pr,
gw_pricex TYPE zcrm_maintain_prx,
gt_dd03l TYPE TABLE OF dd03l,
gw_dd03l LIKE LINE OF gt_dd03l.
DATA:lt_guid_init TYPE crmt_object_guid_tab,
ls_guid_init LIKE LINE OF lt_guid_init.
DATA:
lv_sum_crmt_schedlin_quan TYPE crmt_schedlin_quan,
lv_sum_prct_cond_rate TYPE prct_cond_rate,
lv_zsrv_mileage_fee TYPE flag,
lt_zsrvt_mil_rule02 TYPE TABLE OF zsrvt_mil_rule02,
ls_zsrvt_mil_rule02 TYPE zsrvt_mil_rule02,
ls_zsrvt_mil_rule01 TYPE zsrvt_mil_rule01. "取order数据定义
DATA:ot_header TYPE crmt_object_guid_tab,
ow_header TYPE crmt_object_guid,
ot_order_h TYPE crmt_orderadm_h_wrkt,
ot_schedlin TYPE crmt_schedlin_wrkt,
ow_schedlin TYPE crmt_schedlin_wrk,
ot_cond TYPE crmt_pric_cond_t,
ow_cond TYPE crmt_pric_cond,
ot_price TYPE prct_cond_du_tab,
ow_price TYPE prct_cond_du,
ot_partner TYPE crmt_partner_external_wrkt,
ow_partner TYPE crmt_partner_external_wrk,
ow_text TYPE crmt_text_wrk,
ot_text TYPE crmt_text_wrkt.
FIELD-SYMBOLS:<fs> TYPE any,
<fsx> TYPE any,
<partner> TYPE any. CHECK head-guid IS NOT INITIAL.
REFRESH:lt_guid_init.
ls_guid_init = head-guid.
APPEND ls_guid_init TO lt_guid_init. SELECT SINGLE * INTO gw_index FROM zhsb_order_index WHERE guid = head-guid.
IF sy-subrc = .
SELECT SINGLE * INTO gw_profile FROM crmc_proc_type WHERE process_type = gw_index-process_type.
ELSE.
SELECT SINGLE * INTO gw_sale FROM zhsb_sales_index WHERE guid = head-guid.
IF sy-subrc = .
SELECT SINGLE * INTO gw_profile FROM crmc_proc_type WHERE process_type = gw_sale-process_type.
ELSE.
SELECT SINGLE * INTO gw_profile FROM crmc_proc_type WHERE process_type = head-order_type.
ENDIF.
ENDIF. SELECT * INTO TABLE gt_tj30t FROM tj30t WHERE stsma = gw_profile-user_stat_proc AND spras = 'E'. ls_orderadm_h-guid = head-guid.
"******************************HEAD*************************BEGIN
"CUSTOMER_MODEL
IF headx-customer_model = 'X'.
* CONCATENATE head-factory_model head-customer_model INTO ls_orderadm_h-zzzmodeno SEPARATED BY '.'.
ls_orderadm_h-zzzmodeno = head-customer_model.
ls_field_names-fieldname = 'ZZZMODENO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"FACTORY_MODEL
IF headx-factory_model = 'X'.
ls_orderadm_h-zzfld00000h = head-factory_model.
ls_field_names-fieldname = 'ZZFLD00000H'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"DELAYREASONCODE
IF headx-delayreasoncode = 'X'.
ls_orderadm_h-zzafld000002 = head-delayreasoncode.
ls_field_names-fieldname = 'ZZAFLD000002'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"UNSOLVEDCODE
IF headx-unsolvedcode = 'X'.
ls_orderadm_h-zzafld000003 = head-unsolvedcode.
ls_field_names-fieldname = 'ZZAFLD000003'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"WARRANTY
IF headx-warrantype = 'X'.
ls_orderadm_h-zzwarranty = head-warrantype.
ls_field_names-fieldname = 'ZZWARRANTY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SERIALNO
IF headx-serialno = 'X'.
ls_orderadm_h-zzzserialno = head-serialno.
ls_field_names-fieldname = 'ZZZSERIALNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SERIALNO1
IF headx-zzzserialno1 = 'X'.
ls_orderadm_h-zzzserialno1 = head-zzzserialno1.
ls_field_names-fieldname = 'ZZZSERIALNO1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SERIALNO2
IF headx-zzzserialno2 = 'X'.
ls_orderadm_h-zzzserialno2 = head-zzzserialno2.
ls_field_names-fieldname = 'ZZZSERIALNO2'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SYMPTOMS_CODE
IF headx-symptoms_code = 'X'.
ls_orderadm_h-zzzsymptomscode = head-symptoms_code.
ls_field_names-fieldname = 'ZZZSYMPTOMSCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"SYMPTOMS_CODE_G
IF headx-symptoms_code_g = 'X'.
ls_orderadm_h-zzzsymptomsgroup = head-symptoms_code_g.
ls_field_names-fieldname = 'ZZZSYMPTOMSGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"DEFECT_CODE
IF headx-defect_code = 'X'.
ls_orderadm_h-zzzdefectcode = head-defect_code.
ls_field_names-fieldname = 'ZZZDEFECTCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"DEFECT_CODE_G
IF headx-defect_code_g = 'X'.
ls_orderadm_h-zzzdefectgroup = head-defect_code_g.
ls_field_names-fieldname = 'ZZZDEFECTGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"REPAIR_CODE
IF headx-repair_code = 'X'.
ls_orderadm_h-zzzrepaircode = head-repair_code.
ls_field_names-fieldname = 'ZZZREPAIRCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"REPAIR_CODE_G
IF headx-repair_code_g = 'X'.
ls_orderadm_h-zzzrepairgroup = head-repair_code_g.
ls_field_names-fieldname = 'ZZZREPAIRGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"HEAD DESCRIPTION
IF headx-problem_des = 'X'.
ls_orderadm_h-description = head-problem_des.
ls_field_names-fieldname = 'DESCRIPTION'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ORDER TYPE
IF headx-order_type = 'X'.
ls_orderadm_h-process_type = head-order_type.
ls_field_names-fieldname = 'PROCESS_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"CREATE USER
IF headx-create_user = 'X'.
ls_orderadm_h-created_by = head-create_user.
ls_field_names-fieldname = 'CREATED_BY'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"POSTING DATE
IF headx-create_date = 'X'.
ls_orderadm_h-posting_date = sy-datum.
ls_field_names-fieldname = 'POSTING_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
IF headx-posting_date = 'X'.
ls_orderadm_h-posting_date = head-posting_date.
ls_field_names-fieldname = 'POSTING_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
ENDIF. "PRODUCT ID->group brand
IF headx-product_id = 'X'.
SELECT SINGLE product_guid INTO lv_productguid
FROM comm_product
WHERE product_id = head-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_orderadm_h-zzzgroup = ls_prprdcatr-category_id+().
ls_orderadm_h-zzzbrand = ls_prprdcatr-category_id+().
ls_orderadm_h-zzzsymptomsgroup = ls_prprdcatr-category_id+().
ENDIF. 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.
ENDIF.
IF headx-zzzgroup = 'X'.
DELETE lt_field_names WHERE fieldname = 'ZZZGROUP'.
ls_orderadm_h-zzzgroup = head-zzzgroup.
ls_field_names-fieldname = 'ZZZGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-zzzbrand = 'X'.
DELETE lt_field_names WHERE fieldname = 'ZZZBRAND'.
ls_orderadm_h-zzzbrand = head-zzzbrand.
ls_field_names-fieldname = 'ZZZBRAND'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "SERVICE_TYPE
IF headx-service_type = 'X'.
ls_orderadm_h-zzfld00000n = head-service_type.
ls_field_names-fieldname = 'ZZFLD00000N'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"IN_PROGRESS
IF headx-in_progress = 'X'.
ls_orderadm_h-zzdlyrsn = head-in_progress.
ls_field_names-fieldname = 'ZZDLYRSN'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZIMEI
IF headx-zzimei = 'X'.
ls_orderadm_h-zzimei = head-zzimei.
ls_field_names-fieldname = 'ZZIMEI'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZIMEI1
IF headx-zzimei1 = 'X'.
ls_orderadm_h-zzimei1 = head-zzimei1.
ls_field_names-fieldname = 'ZZIMEI1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"COLLECT_POINT
IF headx-collect_point = 'X'.
ls_orderadm_h-zzafld000008 = head-collect_point.
ls_field_names-fieldname = 'ZZAFLD000008'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_FR_COM
IF headx-tracking_no_fr_com = 'X'.
ls_orderadm_h-zzafld000000 = head-tracking_no_fr_com.
ls_field_names-fieldname = 'ZZAFLD000000'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_FR
IF headx-tracking_no_fr = 'X'.
ls_orderadm_h-zzztracksent = head-tracking_no_fr.
ls_field_names-fieldname = 'ZZZTRACKSENT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_TO_COM
IF headx-tracking_no_to_com = 'X'.
ls_orderadm_h-zzafld000001 = head-tracking_no_to_com.
ls_field_names-fieldname = 'ZZAFLD000001'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"TRACKING_NO_TO
IF headx-tracking_no_to = 'X'.
ls_orderadm_h-zzztrackreturn = head-tracking_no_to.
ls_field_names-fieldname = 'ZZZTRACKRETURN'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZCON_TYPE
IF headx-ztype = 'X'.
ls_orderadm_h-zzcon_type = head-ztype.
ls_field_names-fieldname = 'ZZCON_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Old object id
IF headx-zzafld000004 = 'X'.
ls_orderadm_h-zzafld000004 = head-zzafld000004.
ls_field_names-fieldname = 'ZZAFLD000004'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Agent Invoice
IF headx-zzagentinovice = 'X'.
ls_orderadm_h-zzagentinovice = head-zzagentinovice.
ls_field_names-fieldname = 'ZZAGENTINOVICE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Mobile Client Type
IF headx-mbl_clt_type = 'X'.
ls_orderadm_h-zzclient_type = head-mbl_clt_type.
ls_field_names-fieldname = 'ZZCLIENT_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Packaging
IF headx-pacakging = 'X'.
ls_orderadm_h-zzontime = head-pacakging.
ls_field_names-fieldname = 'ZZONTIME'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Customer Order Number
IF headx-zzzcusordno = 'X'.
ls_orderadm_h-zzzcusordno = head-zzzcusordno.
ls_field_names-fieldname = 'ZZZCUSORDNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Transaction ID
IF headx-zzztransaid = 'X'.
ls_orderadm_h-zzztransaid = head-zzztransaid.
ls_field_names-fieldname = 'ZZZTRANSAID'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Second level name code
IF headx-zzlevelcode = 'X'.
ls_orderadm_h-zzlevelcode = head-zzlevelcode.
ls_field_names-fieldname = 'ZZLEVELCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Second level name code
IF headx-store_name1 = 'X'.
ls_orderadm_h-zzretailer_name = head-store_name1.
ls_field_names-fieldname = 'ZZRETAILER_NAME'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "Questionnaires
IF headx-zzzquestnairid = 'X'.
ls_orderadm_h-zzzquestnairid = head-zzzquestnairid.
ls_field_names-fieldname = 'ZZZQUESTNAIRID'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"Sales Order Header Product ID
IF headx-zzfld000003 = 'X'.
ls_orderadm_h-zzfld000003 = head-zzfld000003.
ls_field_names-fieldname = 'ZZFLD000003'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "complain type
IF headx-zzafld000015 = 'X'.
ls_orderadm_h-zzafld000015 = head-zzafld000015.
ls_field_names-fieldname = 'ZZAFLD000015'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzfld00000o = 'X'.
ls_orderadm_h-zzfld00000o = head-zzfld00000o.
ls_field_names-fieldname = 'ZZFLD00000O'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "ZZSOURCE
IF headx-zzsource = 'X'.
ls_orderadm_h-zzsource = head-zzsource.
ls_field_names-fieldname = 'ZZSOURCE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
"ZZLOGI_STATUS
IF headx-zzlogi_status = 'X'.
ls_orderadm_h-zzlogi_status = head-zzlogi_status.
ls_field_names-fieldname = 'ZZLOGI_STATUS'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzrepchg_type = 'X'.
ls_orderadm_h-zzrepchg_type = head-zzrepchg_type.
ls_field_names-fieldname = 'ZZREPCHG_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzrprepair = 'X'.
ls_orderadm_h-zzzrprepair = head-zzzrprepair.
ls_field_names-fieldname = 'ZZZRPREPAIR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzfld00000i = 'X'.
ls_orderadm_h-zzfld00000i = head-zzfld00000i.
ls_field_names-fieldname = 'ZZFLD00000I'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzpre_conct = 'X'.
ls_orderadm_h-zzpre_conct = head-zzpre_conct.
ls_field_names-fieldname = 'ZZPRE_CONCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzafld000005 = 'X'.
ls_orderadm_h-zzafld000005 = head-zzafld000005.
ls_field_names-fieldname = 'ZZAFLD000005'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzcharg_type = 'X'.
ls_orderadm_h-zzcharg_type = head-zzcharg_type.
ls_field_names-fieldname = 'ZZCHARG_TYPE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzis_charged = 'X'.
ls_orderadm_h-zzis_charged = head-zzis_charged.
ls_field_names-fieldname = 'ZZIS_CHARGED'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzafld000017 = 'X'.
ls_orderadm_h-zzafld000017 = head-zzafld000017.
ls_field_names-fieldname = 'ZZAFLD000017'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzpurpr = 'X'.
ls_orderadm_h-zzzpurpr = head-zzzpurpr / .
ls_field_names-fieldname = 'ZZZPURPR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzafld00001p = 'X'.
ls_orderadm_h-zzafld00001p = head-zzafld00001p.
ls_field_names-fieldname = 'ZZAFLD00001P'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzafld00002v = 'X'.
ls_orderadm_h-zzafld00002v = head-zzafld00002v.
ls_field_names-fieldname = 'ZZAFLD00002V'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzsectioncode = 'X'.
ls_orderadm_h-zzsectioncode = head-zzsectioncode.
ls_field_names-fieldname = 'ZZSECTIONCODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzfld00000p = 'X'.
ls_orderadm_h-zzfld00000p = head-zzfld00000p.
ls_field_names-fieldname = 'ZZFLD00000P'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zoutother = 'X'.
ls_orderadm_h-zzzoutother = head-zoutother / .
ls_field_names-fieldname = 'ZZZOUTOTHER'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzoutparts = 'X'.
ls_orderadm_h-zzzoutparts = head-zzzoutparts.
IF head-sales_org = 'O 50000231'.
ls_orderadm_h-zzzoutparts = ls_orderadm_h-zzzoutparts / .
ENDIF.
ls_field_names-fieldname = 'ZZZOUTPARTS'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzoutlabor = 'X'.
ls_orderadm_h-zzzoutlabor = head-zzzoutlabor / .
ls_field_names-fieldname = 'ZZZOUTLABOR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzfld00000j = 'X'.
ls_orderadm_h-zzfld00000j = head-zzfld00000j / .
ls_field_names-fieldname = 'ZZFLD00000J'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzfld00000k = 'JPY'.
ls_field_names-fieldname = 'ZZFLD00000K'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzafld000018 = 'X'.
ls_orderadm_h-zzafld000018 = head-zzafld000018.
ls_field_names-fieldname = 'ZZAFLD000018'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzafld000019 = 'X'.
ls_orderadm_h-zzzafld000019 = head-zzzafld000019 / .
ls_field_names-fieldname = 'ZZZAFLD000019'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzafld00001j = 'JPY'.
ls_field_names-fieldname = 'ZZAFLD00001J'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzafld00001a = 'X'.
ls_orderadm_h-zzzafld00001a = head-zzzafld00001a / .
ls_field_names-fieldname = 'ZZZAFLD00001A'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzafld00001k = 'JPY'.
ls_field_names-fieldname = 'ZZAFLD00001K'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzafld00001b = 'X'.
ls_orderadm_h-zzzafld00001b = head-zzzafld00001b / .
ls_field_names-fieldname = 'ZZZAFLD00001B'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzafld00001l = 'JPY'.
ls_field_names-fieldname = 'ZZAFLD00001L'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzafld00001c = 'X'.
ls_orderadm_h-zzzafld00001c = head-zzzafld00001c / .
ls_field_names-fieldname = 'ZZZAFLD00001C'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzafld00001m = 'JPY'.
ls_field_names-fieldname = 'ZZAFLD00001M'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzzsettleamt = 'X'.
ls_orderadm_h-zzzsettleamt = head-zzzsettleamt.
IF head-sales_org = 'O 50000231'.
ls_orderadm_h-zzzsettleamt = ls_orderadm_h-zzzsettleamt / .
ENDIF.
ls_field_names-fieldname = 'ZZZSETTLEAMT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzfld000009 = 'X'.
ls_orderadm_h-zzfld000009 = head-zzfld000009.
IF head-sales_org = 'O 50000231'.
ls_orderadm_h-zzfld000009 = ls_orderadm_h-zzfld000009 / .
ENDIF.
ls_field_names-fieldname = 'ZZFLD000009'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzfld00000a = 'JPY'.
ls_field_names-fieldname = 'ZZFLD00000A'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-quota_for_retailer = 'X'.
ls_orderadm_h-zzzquota_rtl = head-quota_for_retailer / .
ls_field_names-fieldname = 'ZZZQUOTA_RTL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzafld00001h = 'JPY'.
ls_field_names-fieldname = 'ZZAFLD00001H'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-quota_for_end_user = 'X'.
ls_orderadm_h-zzzquota_usr = head-quota_for_end_user / .
ls_field_names-fieldname = 'ZZZQUOTA_USR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_orderadm_h-zzafld00001i = 'JPY'.
ls_field_names-fieldname = 'ZZAFLD00001I'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzafld00001r = 'X'.
ls_orderadm_h-zzafld00001r = head-zzafld00001r.
ls_field_names-fieldname = 'ZZAFLD00001R'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. IF headx-zzafld00001t = 'X'.
ls_orderadm_h-zzafld00001t = head-zzafld00001t.
ls_field_names-fieldname = 'ZZAFLD00001T'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF. "DISTANCEIF head-object_id IS INITIAL."工单创建
ls_orderadm_h-mode = 'A'.
ELSE.
ow_header = head-guid.
INSERT ow_header INTO TABLE ot_header.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = ot_header
* IT_ITEM_GUID =
* IV_MODE =
* IV_ONLY_SPEC_ITEMS =
* IT_REQUESTED_OBJECTS =
* IV_NO_AUTH_CHECK =
* IT_ITEM_USAGE_RANGE =
* IV_SUBITEM_DEPTH = -1
* IT_OBJECT_FILTER =
* IV_ONLY_CHANGED_OBJ = FALSE
* IV_STATUS_H_CHECK_RELEVANCE = FALSE
* IV_TEXT_LOG_SINGLE = FALSE
IMPORTING
et_orderadm_h = ot_order_h
* ET_OPPORT_H =
* ET_LEAD_H =
* ET_ACTIVITY_H =
* ET_LAWREF_H =
* ET_ORDERADM_I =
* ET_OPPORT_I =
* ET_ACTIVITY_I =
* ET_PRODUCT_I =
* ET_FINPROD_I =
* ET_BATCH =
* ET_CONFIG =
* ET_STRUCT_I =
* ET_SALES =
* ET_PRICING =
* ET_PRICING_I =
* ET_ORGMAN =
* ET_SHIPPING =
* ET_CUSTOMER_H =
* ET_CUSTOMER_I =
* ET_SERVICE_H =
* ET_SERVICE_I =
* ET_SERVICE_ASSIGN =
* ET_QUALIF =
* ET_PAYPLAN =
* ET_PAYPLAN_D =
* ET_APPOINTMENT =
et_text = ot_text
et_schedlin = ot_schedlin
et_partner = ot_partner
* ET_SERVICE_OS =
* ET_REFOBJ =
* ET_SUBJECT =
* ET_CUMULAT_H =
* ET_STATUS =
* ET_STATUS_H =
* ET_SCHEDLIN_I =
* ET_CANCEL =
* ET_CANCEL_IR =
* ET_CANCEL_CR =
* ET_BILLPLAN =
* ET_BILLING =
* ET_ORDPRP_I =
* ET_ORDPRP_I_D =
* ET_ORDPRP_OBJL_I_D =
* ET_CUMULATED_I =
* ET_DOC_FLOW =
* ET_EXCEPTION =
et_pridoc = ot_cond
* ET_PRICE_AGREEMENTS_CRM =
* ET_PRICE_AGREEMENTS_BBP =
* ET_CONFIG_FILTER =
* ET_SERVICEPLAN_I =
* ET_SERVICEPLAN_IE =
* ET_EXTENSION =
* ET_CREDITVALUES =
* ET_SURVEY =
* ET_AC_ASSIGN =
* ET_APO_I =
* ET_EXT_REF =
* ET_UBB_CTR_I =
* ET_UBB_CR_I =
* ET_UBB_VOL_I =
* ET_CHNGPROC_H =
* ET_CHNGPROC_I =
* ET_DOC_FLOW_PNT =
* ET_FUND_H =
* ET_CLA_H =
* ET_SRV_REQ_H =
* ET_APPROVAL =
* ET_EXTENSION2 =
* ET_CLA_I =
* CHANGING
* CV_LOG_HANDLE =
EXCEPTIONS
document_not_found =
error_occurred =
document_locked =
no_change_authority =
no_display_authority =
no_change_allowed =
OTHERS = .
IF sy-subrc <> .
ENDIF. ENDIF. INSERT ls_orderadm_h INTO TABLE lt_orderadm_h. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ORDERADM_H'.
INSERT ls_input_field INTO TABLE lt_input_field.
"******************************HEAD*************************END "******************************sales org********************begin
IF headx-sales_org = 'X'.
SELECT SINGLE * INTO gw_zbp_sales FROM zbp_sales WHERE sales_org = head-sales_org.
ls_orgman-ref_guid = head-guid.
ls_orgman-ref_kind = 'A'.
ls_orgman-dis_channel = gw_zbp_sales-channel.
ls_orgman-sales_org_ori = 'C'.
ls_orgman-sales_org = gw_zbp_sales-sales_org.
ls_orgman-sales_office = gw_zbp_sales-sales_office."默认sales office 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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ORGMAN'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
"******************************sales org********************end "******************************SERVICE_H********************BEGIN
IF headx-store_contact_person IS NOT INITIAL OR
headx-store_contact_cellphone IS NOT INITIAL OR
headx-store_contact_phone IS NOT INITIAL OR
headx-store_contact_email IS NOT INITIAL OR
headx-zzcon_fax IS NOT INITIAL..
ls_service_h-ref_guid = head-guid.
IF headx-store_contact_person IS NOT INITIAL.
ls_service_h-zzcon_person = head-store_contact_person.
ls_field_names-fieldname = 'ZZCON_PERSON'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-store_contact_cellphone IS NOT INITIAL.
ls_service_h-zzcon_mob = head-store_contact_cellphone.
ls_field_names-fieldname = 'ZZCON_MOB'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-store_contact_phone IS NOT INITIAL.
ls_service_h-zzcon_phone = head-store_contact_phone.
ls_field_names-fieldname = 'ZZCON_PHONE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-store_contact_email IS NOT INITIAL.
ls_service_h-zzcon_email = head-store_contact_email.
ls_field_names-fieldname = 'ZZCON_EMAIL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-zzcon_fax IS NOT INITIAL.
ls_service_h-zzcon_fax = head-zzcon_fax.
ls_field_names-fieldname = 'ZZCON_FAX'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
"******************************SERVICE_H********************end
"******************************activity_H********************BEGIN
IF HEADX-priority IS NOT INITIAL.
CLEAR: ls_input_field,lt_activity_h[],ls_activity_h.
ls_activity_h-category = ''.
ls_activity_h-ref_guid = head-guid.
ls_activity_h-priority = head-priority.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'ACTIVITY_H'. INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
"******************************activity_H********************end
"******************************CUSTOMER_H********************BEGIN
IF headx-zzord_origin IS NOT INITIAL.
ls_customer_h-ref_guid = head-guid.
ls_customer_h-zzord_origin = head-zzord_origin.
ls_field_names-fieldname = 'ZZORD_ORIGIN'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'CUSTOMER_H'. INSERT ls_input_field INTO TABLE lt_input_field.
INSERT ls_customer_h INTO TABLE lt_customer_h.
CLEAR:ls_customer_h.
ENDIF.
"******************************CUSTOMER_H********************end "******************************SERVICE_OS*************************BEGIN
IF headx-product_id = 'X'.
SELECT SINGLE product_guid INTO ls_refobject-guid_object
FROM comm_product
WHERE product_id = head-product_id.
IF sy-subrc = .
ls_service_os-ref_guid = head-guid.
ls_service_os-ref_kind = 'A'.
ls_osset-ref_guid = head-guid.
ls_osset-subject_profile = 'ZSERV'.
ls_osset-profile_type = 'A'.
ls_refobject-ref_guid = head-guid.
ls_refobject-product_id = head-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 = 'B'.
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 = head-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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'SERVICE_OS'.
INSERT ls_input_field INTO TABLE lt_input_field.
* endif.
CLEAR: lt_refobject,lt_osset.
ENDIF.
ENDIF. "*S*********************SALES********************************
IF headx-sp_order = 'X' OR headx-store_reference_no = 'X'..
REFRESH:lt_sales.
CLEAR:ls_sales.
ls_sales-ref_guid = head-guid.
ls_sales-ref_kind = 'A'. IF headx-store_reference_no = 'X'.
ls_sales-po_number_ship = head-store_reference_no.
ls_field_names-fieldname = 'PO_NUMBER_SHIP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-sp_order = 'X'.
ls_sales-po_number_sold = head-sp_order.
ls_field_names-fieldname = 'PO_NUMBER_SOLD'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF headx-create_date = 'X'.
ls_sales-po_date_sold = head-create_date.
ls_field_names-fieldname = 'PO_DATE_SOLD'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
INSERT ls_sales INTO TABLE lt_sales.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
ENDIF. "*E*********************SALES******************************** "*S*********************TEXT*************************************
"SET DEFAULT TIME ZONE
IF head-sales_org = 'O 50000297'."法国
gv_zonlo = 'WAT'.
ELSEIF head-sales_org = 'O 50000005'."西班牙
gv_zonlo = 'CAT'.
ELSEIF head-sales_org = 'O 50000231'."日本
gv_zonlo = 'UTC+9'.
ELSEIF head-sales_org = 'O 50000362'."英国
gv_zonlo = 'UK'.
ELSE."其他以中国记
gv_zonlo = 'UTC+8'.
ENDIF.
CONVERT DATE sy-datum TIME sy-uzeit INTO TIME STAMP gv_timez TIME ZONE 'UTC+8'.
CONVERT TIME STAMP gv_timez TIME ZONE gv_zonlo INTO DATE gv_date TIME gv_time.
IF headx-repair_note = 'X'.
CONCATENATE gv_date+() '/' gv_date+() '/' gv_date+()
' RFC ' gv_time+() ':' gv_time+() ':' gv_time+() ' '
head-repair_note INTO head-repair_note.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'A002'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'U'.
READ TABLE ot_text INTO ow_text WITH KEY ref_guid = head-guid.
IF sy-subrc = .
IF ow_text-stxh-tdid = 'A002'.
APPEND LINES OF ow_text-lines TO gt_ltxts.
ENDIF.
ENDIF.
l_len = strlen( head-repair_note ).
WHILE strlen( head-repair_note ) > .
IF strlen( head-repair_note ) > .
lw_ltxt-tdline = head-repair_note+().
l_len = l_len - .
head-repair_note = head-repair_note+(l_len).
ELSE.
lw_ltxt-tdline = head-repair_note.
CLEAR:head-repair_note.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF.
IF headx-unsolvedreason = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH16'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-unsolvedreason ).
WHILE strlen( head-unsolvedreason ) > .
IF strlen( head-unsolvedreason ) > .
lw_ltxt-tdline = head-unsolvedreason+().
l_len = l_len - .
head-repair_note = head-unsolvedreason+(l_len).
ELSE.
lw_ltxt-tdline = head-unsolvedreason.
CLEAR:head-unsolvedreason.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF.
IF headx-can_reason = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH14'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-can_reason ).
WHILE strlen( head-can_reason ) > .
IF strlen( head-can_reason ) > .
lw_ltxt-tdline = head-can_reason+().
l_len = l_len - .
head-can_reason = head-can_reason+(l_len).
ELSE.
lw_ltxt-tdline = head-can_reason.
CLEAR:head-can_reason.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-zh28 = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH28'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-zh28 ).
WHILE strlen( head-zh28 ) > .
IF strlen( head-zh28 ) > .
lw_ltxt-tdline = head-zh28+().
l_len = l_len - .
head-zh28 = head-zh28+(l_len).
ELSE.
lw_ltxt-tdline = head-zh28.
CLEAR:head-zh28.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-zh30 = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH30'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-zh30 ).
WHILE strlen( head-zh30 ) > .
IF strlen( head-zh30 ) > .
lw_ltxt-tdline = head-zh30+().
l_len = l_len - .
head-zh30 = head-zh30+(l_len).
ELSE.
lw_ltxt-tdline = head-zh30.
CLEAR:head-zh30.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-zh24 = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH24'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-zh24 ).
WHILE strlen( head-zh24 ) > .
IF strlen( head-zh24 ) > .
lw_ltxt-tdline = head-zh24+().
l_len = l_len - .
head-zh24 = head-zh24+(l_len).
ELSE.
lw_ltxt-tdline = head-zh24.
CLEAR:head-zh24.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-zh32 = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH32'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-zh32 ).
WHILE strlen( head-zh32 ) > .
IF strlen( head-zh32 ) > .
lw_ltxt-tdline = head-zh32+().
l_len = l_len - .
head-zh32 = head-zh32+(l_len).
ELSE.
lw_ltxt-tdline = head-zh32.
CLEAR:head-zh32.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF. IF headx-problem_note = 'X'.
REFRESH:gt_ltxts.
CLEAR:ls_text,lw_ltxt.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_text-ref_guid = head-guid.
ls_text-ref_kind = 'A'.
ls_text-tdid = 'ZH30'.
ls_text-tdspras = 'E'.
ls_text-tdstyle = 'SYSTEM'.
ls_text-tdform = 'SYSTEM'.
ls_text-tdtexttype = ''.
ls_text-mode = 'A'.
l_len = strlen( head-problem_note ).
WHILE strlen( head-problem_note ) > .
IF strlen( head-problem_note ) > .
lw_ltxt-tdline = head-problem_note+().
l_len = l_len - .
head-problem_note = head-problem_note+(l_len).
ELSE.
lw_ltxt-tdline = head-problem_note.
CLEAR:head-problem_note.
ENDIF.
lw_ltxt-tdformat = '*'.
APPEND lw_ltxt TO gt_ltxts.
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 = head-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.
ENDIF.
"*E*********************TEXT************************************* "******************************SERVICE_OS*************************END *S*********************status**************************************
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-order_status = 'X'.
ls_status-ref_guid = head-guid.
ls_status-ref_kind = 'A'.
READ TABLE gt_tj30t INTO gw_tj30t WITH KEY estat = head-order_status.
IF sy-subrc = .
ls_status-status = head-order_status.
ELSE.
READ TABLE gt_tj30t INTO gw_tj30t WITH KEY txt04 = head-order_status.
IF sy-subrc = .
ls_status-status = gw_tj30t-estat.
ENDIF.
ENDIF.
ls_status-user_stat_proc = gw_profile-user_stat_proc.
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 = head-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.
ENDIF. *E*********************status************************************** *S*********************APPOINTMENT-DATE********************************* CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-ack_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-ack_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZACKNOWLEG'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZACKNOWLEG'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-repair_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-repair_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZREPAIR'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZREPAIR'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-assign_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-assign_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZASSIGNMENT'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZASSIGNMENT'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-in_depot_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-in_depot_date
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZDELIVER'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZDELIVER'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-zfeedback = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-zfeedback
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZFEEDBACK'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZFEEDBACK'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-purchase_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-purchase_date
i_timlo = sy-uzeit
i_tzone = gv_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 = head-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.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-reservation_date = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-reservation_date
i_timlo = sy-uzeit
i_tzone = gv_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 = head-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.
ENDIF.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
IF headx-zrefund = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-zrefund
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZREFUND'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZREFUND'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. IF headx-zexchange = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-zexchange
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZEXCHANGE'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZEXCHANGE'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
IF headx-ZTAKNUMSENT = 'X'.
ls_appointment-ref_guid = head-guid.
ls_appointment-ref_kind = 'A'.
ls_appointment-timezone_from = gv_zonlo.
CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = head-ZTAKNUMSENT
i_timlo = sy-uzeit
i_tzone = gv_zonlo
IMPORTING
e_timestamp = ls_appointment-timestamp_from. ls_appointment-appt_type = 'ZTAKNUMSENT'.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-logical_key = 'ZTAKNUMSENT'.
ls_input_field-objectname = 'APPOINTMENT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
*E*********************APPOINTMENT-DATE********************************* *S********************* *partnr ********************************************
IF headx-sp_partner = 'X'."服务商
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
CLEAR:ls_partner,ow_partner.
l_partner = head-sp_partner.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI00SP'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI00SP'.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI00SP' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0001'.
INSERT ls_input_field INTO TABLE lt_input_field. "bill to pay to 都是服务商
"bill
IF zcl_otr=>jp_sp = 'X'.
ELSE.
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
INSERT ls_partner INTO TABLE lt_partner.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
"payer
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
INSERT ls_partner INTO TABLE lt_partner.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
ENDIF.
IF headx-end_user_id = 'X'."终端用户
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-end_user_id.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI00EU'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI00EU'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI00EU'.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI00EU'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI00EU'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI00EU' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
IF headx-sold_to = 'X'."售达方
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-sold_to.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = ''.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0005'.
INSERT ls_input_field INTO TABLE lt_input_field. IF head-order_type+() = 'ZSO' OR zcl_otr=>sold_as_bill = 'X'."销售的bill to payer都是sold to
zcl_otr=>sold_as_bill = ''.
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
CLEAR:ow_partner.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_partner_fct = ''.
ENDIF.
INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-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.
"payer
REFRESH:ls_input_field-field_names[].
ls_partner-ref_partner_handle = ''.
ls_partner-partner_fct = ''.
CLEAR:ow_partner.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_partner_fct = ''.
ENDIF.
INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0003'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
ENDIF.
IF headx-ship_to = 'X'."售达方
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-ship_to.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = ''.
ELSEIF sy-subrc = AND ow_partner-partner_no = ls_partner-partner_no AND ZCL_OTR=>JP_IF = 'X'.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = ''.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0006'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
IF headx-store_id = 'X'."Reatiler
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-store_id.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI00RT'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI00RT'.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI00RT'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI00RT'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI00RT' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. IF headx-bp09 = 'X'."Activity Partner
CLEAR:ls_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-bp09.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. 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 = head-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. IF headx-zzser_network = 'X'."
CLEAR:ls_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-zzser_network.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI00SN'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI00SN'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI00SN'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. 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 = head-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. IF headx-logistics = 'X'."
CLEAR:ls_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-logistics.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
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'. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI0LGC'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI0LGC'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. 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 = head-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. IF headx-zhsi0con = 'X'."ZHSI0CON
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-zhsi0con.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI0CON'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI0CON'.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI0CON'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI0CON'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI0CON' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. IF headx-zhsi0cnn = 'X'."ZHSI0CNN
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-zhsi0cnn.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI0CNN'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI0CNN'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI0CNN'.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI0CNN'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI0CNN'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI0CNN' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. IF headx-ZHSI0DEL = 'X'."ZHSI0DEL
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-ZHSI0DEL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = ''.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = 'ZHSI0DEL'.
ls_partner-partner_no = l_partner.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
ls_partner-mainpartner = 'X'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = 'ZHSI0DEL'.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = 'ZHSI0DEL'.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = 'ZHSI0DEL'.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = 'ZHSI0DEL'.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '0000ZHSI0DEL' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF. IF headx-bill_to_party = 'X'."
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-payer.
DELETE lt_partner WHERE ref_guid = head-guid AND partner_fct = ''.
DELETE lt_input_field WHERE logical_key = ''.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = ''.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
IF headx-payer = 'X'."
CLEAR:ls_partner,ow_partner.
CLEAR:ls_input_field,ls_field_names,lt_field_names[].
l_partner = head-payer.
DELETE lt_partner WHERE ref_guid = head-guid AND partner_fct = ''.
DELETE lt_input_field WHERE logical_key = ''.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_partner
IMPORTING
output = l_partner.
ls_partner-ref_guid = head-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'.
READ TABLE ot_partner INTO ow_partner WITH KEY partner_fct = ''.
IF sy-subrc = AND ow_partner-partner_no <> ls_partner-partner_no.
ls_partner-ref_partner_no = ow_partner-partner_no.
ls_partner-ref_partner_handle = ''.
ls_partner-ref_no_type = 'BP'.
ls_partner-ref_display_type = 'BP'.
ls_partner-ref_partner_fct = ''.
ENDIF. READ TABLE partner INTO gw_partner WITH KEY ref_partner_fct = ''.
IF sy-subrc = .
READ TABLE partnerx INTO gw_partnerx WITH KEY ref_partner_fct = ''.
SELECT * INTO TABLE gt_dd03l FROM dd03l WHERE tabname = 'ZCRM_MAINTAIN_P'.
DELETE gt_dd03l WHERE fieldname = 'REF_GUID'.
DELETE gt_dd03l WHERE fieldname = 'REF_PARTNER_FCT'. LOOP AT gt_dd03l INTO gw_dd03l.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partnerx TO <fsx>.
IF <fsx> IS ASSIGNED.
IF <fsx> = 'X'.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE ls_partner TO <partner>.
IF <partner> IS ASSIGNED.
ls_field_names-fieldname = gw_dd03l-fieldname.
INSERT ls_field_names INTO TABLE lt_field_names.
ASSIGN COMPONENT gw_dd03l-fieldname OF STRUCTURE gw_partner TO <fs>.
IF <fs> IS ASSIGNED.
<partner> = <fs>.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF. INSERT ls_partner INTO TABLE lt_partner.
IF ow_partner IS INITIAL.
ls_input_field-logical_key = ''.
ls_field_names-fieldname = 'PARTNER_FCT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ELSE.
CONCATENATE '' ls_partner-ref_partner_no
ls_partner-ref_no_type ls_partner-ref_display_type INTO ls_input_field-logical_key RESPECTING BLANKS.
ENDIF.
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 = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PARTNER'.
* ls_input_field-logical_key = '0000'.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
*E********************* *partnr ******************************************** *S**************************ITEM ********************************************
READ TABLE ot_cond INTO ow_cond INDEX .
LOOP AT item INTO gw_item.
CLEAR:ow_schedlin."读取历史记录
READ TABLE ot_schedlin INTO ow_schedlin WITH KEY item_guid = gw_item-guid.
IF sy-subrc = .
* gw_item-guid = ow_schedlin-guid.
ELSE.
IF gw_item-guid IS INITIAL.
CALL FUNCTION 'CRM_GUID_CREATE'
IMPORTING
ev_guid = gw_item-guid.
ENDIF.
ENDIF. 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 = gw_item-guid.
INSERT ls_service_i INTO TABLE lt_service_i. ls_product_i-ref_guid = gw_item-guid.
INSERT ls_product_i INTO TABLE lt_product_i. IF gw_item-price_list IS NOT INITIAL.
ls_pricing-ref_guid = gw_item-guid.
ls_pricing-price_list = gw_item-price_list.
ls_pricing-ref_kind = 'B'.
INSERT ls_pricing INTO TABLE lt_pricing.
ENDIF. ls_schedlin_i-ref_guid = gw_item-guid.
ls_schedlin_extdt-quantity = gw_item-item_quantity.
IF ow_schedlin IS NOT INITIAL.
ls_schedlin_extdt-guid = ow_schedlin-guid.
ls_schedlin_extdt-logical_key = ow_schedlin-guid.
ELSE.
ls_schedlin_extdt-logical_key = ''.
ENDIF.
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. CLEAR: ls_input_field, ls_field_names, lt_field_names.
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 = gw_item-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'SCHEDLIN'.
IF ow_schedlin IS NOT INITIAL..
ls_input_field-logical_key = ow_schedlin-guid.
ELSE.
ls_input_field-logical_key = ''.
ENDIF. INSERT ls_input_field INTO TABLE lt_input_field. CLEAR: ls_input_field, ls_field_names, lt_field_names. ls_orderadm_i-guid = gw_item-guid.
ls_orderadm_i-header = gw_item-head_guid.
ls_orderadm_i-number_int = gw_item-item_number.
ls_orderadm_i-itm_type = gw_item-item_category. 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 = gw_item-item_product_id.
ls_orderadm_i-number_parent = gw_item-item_high_level.
IF gw_item-item_high_level IS NOT INITIAL.
READ TABLE item INTO gv_item WITH KEY guid = gw_item-guid
item_number = gw_item-item_high_level.
IF sy-subrc = .
ls_orderadm_i-parent = gv_item-guid.
ENDIF.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_orderadm_i-ordered_prod
IMPORTING
output = ls_orderadm_i-ordered_prod. ls_orderadm_i-description = gw_item-item_product_des.
ls_orderadm_i-zzzserialno = gw_item-item_serial_no.
ls_orderadm_i-zzzserialno1 = gw_item-item_serial_no_1.
ls_orderadm_i-zzzserialno2 = gw_item-item_serial_no_2.
ls_orderadm_i-zzorderadm_i0403 = gw_item-zzorderadm_i0403.
ls_orderadm_i-zzorderadm_i0404 = gw_item-zzorderadm_i0404.
ls_orderadm_i-zzorderadm_i0405 = gw_item-item_imei_1.
ls_orderadm_i-zzorderadm_i0406 = gw_item-item_imei_1.
ls_orderadm_i-zzzcustmodeno = gw_item-zzzmodeno.
ls_orderadm_i-zzplant = gw_item-item_plant.
ls_orderadm_i-zzlgort = gw_item-item_storage_loc.
ls_orderadm_i-zzcrm04p = gw_item-exre_reason.
ls_orderadm_i-zzpurc_date = gw_item-purchase_date.
ls_orderadm_i-zzreturn_process = gw_item-zzreturn_process.
ls_orderadm_i-zzzgroup = gw_item-zzzgroup.
ls_orderadm_i-zzzbrand = gw_item-zzzbrand.
ls_orderadm_i-zzsymp_grou = gw_item-zzsymp_grou.
ls_orderadm_i-zzsymp_code = gw_item-zzsymp_code.
ls_orderadm_i-zzzremark = gw_item-zzzremark.
ls_orderadm_i-zzorderadm_i0407 = gw_item-item_zzorderadm_i0407.
ls_orderadm_i-zzref_exh_date = gw_item-item_zzref_exh_date.
ls_orderadm_i-zzsymp_text = gw_item-item_zzsymp_text.
ls_orderadm_i-partner_prod = gw_item-item_partner_prod.
ls_orderadm_i-ZZORDERADM_I0412 = gw_item-ZZORDERADM_I0412."ADD BY LY 20181018 批次
ls_orderadm_i-zzzclnt_price = gw_item-zzzclnt_price / .
ls_orderadm_i-zzafld00001d = 'JPY'.
ls_orderadm_i-zzzrtl_price = gw_item-zzzrtl_price / .
ls_orderadm_i-zzafld00001g = 'JPY'.
ls_orderadm_i-zzzsp_price = gw_item-zzzsp_price / .
ls_orderadm_i-zzafld00001f = 'JPY'.
IF gw_item-mode = 'D'.
ls_orderadm_i-mode = 'D'.
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 = '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. READ TABLE itemx INTO gw_itemx WITH KEY guid = gw_item-guid.
IF sy-subrc = .
IF gw_itemx-item_high_level = 'X'.
ls_field_names-fieldname = 'NUMBER_PARENT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_serial_no = 'X'.
ls_field_names-fieldname = 'ZZZSERIALNO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_serial_no_1 = 'X'.
ls_field_names-fieldname = 'ZZZSERIALNO1'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_serial_no_2 = 'X'.
ls_field_names-fieldname = 'ZZZSERIALNO2'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzmodeno = 'X'.
ls_field_names-fieldname = 'ZZZCUSTMODENO'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_plant = 'X'.
ls_field_names-fieldname = 'ZZPLANT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_storage_loc = 'X'.
ls_field_names-fieldname = 'ZZLGORT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-exre_reason = 'X'.
ls_field_names-fieldname = 'ZZCRM04P'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-purchase_date = 'X'.
ls_field_names-fieldname = 'ZZPURC_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzorderadm_i0403 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0403'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzorderadm_i0404 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0404'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_imei_1 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0405'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_imei_2 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0406'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzreturn_process = 'X'.
ls_field_names-fieldname = 'ZZRETURN_PROCESS'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzgroup = 'X'.
ls_field_names-fieldname = 'ZZZGROUP'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzbrand = 'X'.
ls_field_names-fieldname = 'ZZZBRAND'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzsymp_grou = 'X'.
ls_field_names-fieldname = 'ZZSYMP_GROU'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzsymp_code = 'X'.
ls_field_names-fieldname = 'ZZSYMP_CODE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzremark = 'X'.
ls_field_names-fieldname = 'ZZZREMARK'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_zzorderadm_i0407 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0407'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_zzref_exh_date = 'X'.
ls_field_names-fieldname = 'ZZREF_EXH_DATE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_zzsymp_text = 'X'.
ls_field_names-fieldname = 'ZZSYMP_TEXT'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-item_partner_prod = 'X'.
ls_field_names-fieldname = 'PARTNER_PROD'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzorderadm_i0412 = 'X'.
ls_field_names-fieldname = 'ZZORDERADM_I0412'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzclnt_price = 'X'.
ls_field_names-fieldname = 'ZZZCLNT_PRICE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZAFLD00001D'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzrtl_price = 'X'.
ls_field_names-fieldname = 'ZZZRTL_PRICE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZAFLD00001G'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-zzzsp_price = 'X'.
ls_field_names-fieldname = 'ZZZSP_PRICE'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'ZZAFLD00001F'.
INSERT ls_field_names INTO TABLE lt_field_names.
ENDIF.
IF gw_itemx-rejection = 'X'.
CLEAR:ls_sales.
ls_sales-ref_guid = gw_item-guid.
ls_sales-ref_kind = 'B'.
ls_sales-rejection = gw_item-rejection."
INSERT ls_sales INTO TABLE lt_sales. ls_input_field-ref_guid = gw_item-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'SALES'. ls_field_names-fieldname = 'REJECTION'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_input_field-field_names = lt_field_names. INSERT ls_input_field INTO TABLE lt_input_field.
CLEAR: lt_field_names.
ENDIF.
ENDIF. ls_input_field-field_names = lt_field_names.
ls_input_field-ref_guid = gw_item-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'ORDERADM_I'.
INSERT ls_input_field INTO TABLE lt_input_field.
REFRESH:lt_pric_cond,lt_pric_chag.
CLEAR:ls_pridoc.
LOOP AT price INTO gw_price WHERE ref_guid = gw_item-guid.
ot_price[] = ow_cond-pric_cond[]."add by ly 20180124
SORT ot_price[] BY kposn kschl stunr zaehk DESCENDING.
READ TABLE ot_price INTO ow_price WITH KEY kposn = gw_item-guid kschl = gw_price-kschl.
IF sy-subrc = .
ls_pric_chag-stunr = ow_price-stunr.
ls_pric_chag-zaehk = ow_price-zaehk.
ls_pric_chag-kbetr = gw_price-kbetr.
IF head-sales_org = 'O 50000231'.
ls_pric_chag-kbetr = ls_pric_chag-kbetr / .
ENDIF.
ls_pric_chag-kpein = .
ls_pric_chag-kmein = ow_price-kmein.
INSERT ls_pric_chag INTO TABLE lt_pric_chag.
ls_pridoc-cond_change[] = lt_pric_chag[].
ELSE.
ls_pric_cond-kschl = gw_price-kschl.
ls_pric_cond-kbetr = gw_price-kbetr.
ls_pric_cond-kwert = gw_price-kwert.
IF head-sales_org = 'O 50000231'.
ls_pric_cond-kbetr = ls_pric_cond-kbetr / .
ls_pric_cond-kwert = ls_pric_cond-kwert / .
ENDIF.
INSERT ls_pric_cond INTO TABLE lt_pric_cond.
ls_pridoc-cond_add[] = lt_pric_cond[].
ENDIF. ls_pridoc-ref_guid = gw_item-guid.
ls_pridoc-ref_kind = 'B'.
INSERT ls_pridoc INTO TABLE lt_pridoc. CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_field_names-fieldname = 'KSCHL'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KBETR'.
INSERT ls_field_names INTO TABLE lt_field_names.
ls_field_names-fieldname = 'KWERT'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-ref_guid = gw_item-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'PRIDOC'.
ls_input_field-field_names = lt_field_names.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDLOOP. ENDLOOP.
*E**************************ITEM ********************************************
*B**************************PRICING ********************************************
IF headx-price_list = 'X'.
ls_pricing-ref_guid = head-guid.
ls_pricing-price_list = head-price_list.
ls_pricing-ref_kind = 'A'.
INSERT ls_pricing INTO TABLE lt_pricing.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_field_names-fieldname = 'PRICE_LIST'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'A'.
ls_input_field-objectname = 'PRICING'.
ls_input_field-field_names = lt_field_names.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
LOOP AT item INTO gw_item.
IF gw_item-price_list IS NOT INITIAL.
ls_pricing-ref_guid = gw_item-guid.
ls_pricing-price_list = gw_item-price_list.
ls_pricing-ref_kind = 'B'.
INSERT ls_pricing INTO TABLE lt_pricing.
CLEAR: ls_input_field, ls_field_names, lt_field_names.
ls_field_names-fieldname = 'PRICE_LIST'.
INSERT ls_field_names INTO TABLE lt_field_names. ls_input_field-ref_guid = head-guid.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'PRICING'.
ls_input_field-field_names = lt_field_names.
INSERT ls_input_field INTO TABLE lt_input_field.
ENDIF.
ENDLOOP.
*E**************************PRICING ******************************************** CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_activity_h = lt_activity_h
it_sales = lt_sales
it_text = lt_text
it_status = lt_status
it_service_os = lt_service_os
it_service_h = lt_service_h
it_customer_h = lt_customer_h
it_service_i = lt_service_i
it_pricing = lt_pricing
it_appointment = lt_appointment
it_schedlin_i = lt_schedlin_i
it_product_i = lt_product_i
it_orgman = lt_orgman
it_partner = lt_partner
it_pridoc = lt_pridoc
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 <> .
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'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF. CHECK error_type <> 'E'. CLEAR:lt_exception.
is_objects_to_save = head-guid.
INSERT is_objects_to_save INTO TABLE it_objects_to_save.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = it_objects_to_save
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved =
OTHERS = . IF lt_objects_not_saved IS NOT INITIAL.
error_type = 'E'.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO error_log.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. CALL FUNCTION 'CRM_ORDER_DEQUEUE'
EXPORTING
iv_guid = head-guid. READ TABLE lt_saved_objects INTO ls_saved_objects INDEX .
error_type = 'S'.
IF head-object_id IS INITIAL.
MESSAGE s322(zcrm_msg) WITH ls_saved_objects-object_id INTO error_log.
ELSE.
MESSAGE s368(zcrm_msg) WITH ls_saved_objects-object_id INTO error_log.
ENDIF. * error_log = 'Create Order:' && ls_saved_objects-object_id && ' successful'.
object_o = ls_saved_objects-object_id. REFRESH: tk_orderadm_h,
lt_orderadm_h,
lt_input_field,
it_objects_to_save,
lt_saved_objects.
CLEAR: tk_orderadm_h,
wk_orderadm_h,
lt_orderadm_h,
ls_orderadm_h,
lt_input_field,
it_objects_to_save,
lt_saved_objects.
ENDIF. 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 INTO error_log.
* error_type = sy-msgty.
ENDIF. IF head-prov_guid IS NOT INITIAL."关联前序订单
CALL FUNCTION 'ZCRM_CREATE_DOC_FLOW'
IN BACKGROUND TASK
EXPORTING
iv_guid_a = head-prov_guid
iv_guid_b = head-guid
iv_order_guid = head-guid.
COMMIT WORK.
ENDIF. ENDFUNCTION.