Chinaunix首页 | 论坛 | 博客
  • 博客访问: 153437
  • 博文数量: 72
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 745
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-15 14:48
文章分类

全部博文(72)

文章存档

2010年(25)

2009年(47)

我的朋友
XI

分类:

2010-07-30 11:14:55

  FUNCTION zcdm_if_sch03.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(I_APPLYPLAY_CD) TYPE  ZCDM_APPLYPLAY_CD
*"     REFERENCE(I_NAME) TYPE  SY-UNAME OPTIONAL
*"  EXPORTING
*"     REFERENCE(MESSAGE) TYPE  CHAR255
*"  EXCEPTIONS
*"      ERROR
*"      NO_APPLYPLAY_INFO
*"      NO_RECEIVE_SYSTEM
*"----------------------------------------------------------------------
  DATA output TYPE ztvreceive_task_request9.
  DATA ls_request1 TYPE ztvreceive_task_request10.
  DATA ls_request2 TYPE ztvreceive_task_request_type6.
  DATA lt_task_item TYPE ztvtask_item_type_tab6.
  DATA ls_task_item TYPE ztvtask_item_type6.
  DATA ls_task_version TYPE ztvtask_version_type6. "任务版本类型
  DATA ls_program_basic_info TYPE ztvprogram_basic_info_type8. "节目基本信息类型----暂时不填充信息
  DATA ls_task_basic_info TYPE ztvtask_basic_info_type6.   "任务基本信息
  DATA ls_task_specific_info  TYPE ztvtask_specific_info_type6."任务特定信息类型
  DATA ls_allocated_resource  TYPE ztvallocated_resource_type6 ."已分配的资源信息类型----暂时不填充信息
  DATA ls_task_relation       TYPE ztvtask_relation_type6 ."任务上下游关系类型----暂时不填充信息
  DATA ls_program_play_apply_request TYPE ztvprogram_play_apply_type1."Sch03 中心审批通过的报播单发布
  DATA ls_program_play_apply_items   TYPE ztvmi_sch03_outbound_program_p."
  DATA lt_program_play_apply_item   TYPE ztvmi_sch03_outbound_progr_tab.
  DATA ls_program_play_apply_item  TYPE ztvmi_sch03_outbound_program_1.
  DATA ls_language TYPE ztvlanguage_code_type11.
  DATA lv_char30  TYPE c LENGTH 30.
  DATA lv_string  TYPE string.
  DATA lv_date     TYPE string.
  DATA lv_time    TYPE string.
  DATA lv_datime   TYPE string.
  DATA lv_tableline TYPE i.

  DATA lt_appplay TYPE TABLE OF zcdm_t_appplay .
  DATA ls_appplay  TYPE zcdm_t_appplay.

  DATA lt_appplay_s  TYPE TABLE OF  zcdm_t_appplay_s.
  DATA ls_appplay_s  TYPE    zcdm_t_appplay_s.
  DATA lt_sysdept   TYPE TABLE OF zcdm_t_sysdept.
  DATA ls_sysdept  TYPE zcdm_t_sysdept .

  DATA lr_sch03_outbound TYPE REF TO ztvco_mi_sch03_outbound.
  DATA l_oref TYPE REF TO cx_ai_system_fault.

  DATA: ls_e2e_log TYPE zppm_e2e_log.

  CLEAR lv_tableline.
***检查所要发送的系统
  CALL FUNCTION 'ZCDM_IF_GETSYSDEPT'
    EXPORTING
      z_if_id_imp = 'SCH03'
    TABLES
      z_esbgrp_tb = lt_sysdept.

  IF lt_sysdept IS INITIAL .
    RAISE no_receive_system.
  ENDIF.

***********************取报播单主数据
  SELECT SINGLE *
     INTO CORRESPONDING FIELDS OF  ls_appplay
    FROM zcdm_t_appplay
  WHERE z_applyplay_cd = i_applyplay_cd.
*************** 主表未取到数据
  IF sy-subrc NE 0 .
    RAISE no_applyplay_info.
  ENDIF.

  SELECT *
    INTO CORRESPONDING FIELDS OF TABLE lt_appplay_s
    FROM zcdm_t_appplay_s
   WHERE z_applyplay_cd = ls_appplay-z_applyplay_cd.
*************** 子表未取到数据
  IF sy-subrc NE 0 .
    RAISE no_applyplay_info.
  ENDIF.


  CONCATENATE '00000000000000000' i_applyplay_cd INTO lv_string.
  lv_char30 = lv_string.


  LOOP AT lt_appplay_s INTO ls_appplay_s.

    ls_program_play_apply_item-item_id = ls_appplay_s-z_apply_item_cd .   "条目标识
    ls_program_play_apply_item-column_play_plan_id = ls_appplay_s-z_subj_plan_id.   "栏目播出计划标识类型
    ls_program_play_apply_item-plan_match_flag  = ls_appplay_s-z_plan_match . "计划匹配标识 0:不完全匹配;1:完全匹配
    ls_program_play_apply_item-channel_code  = ls_appplay_s-z_chanl_cd . "频道代码类型
    ls_program_play_apply_item-play_date  = ls_appplay_s-z_play_date.  "XSD 日期:yyyy-mm-dd  [ext.]
    "ls_program_play_apply_item-play_time = ls_appplay_s-z_play_time. "播放时间类型(04:00:00 ~ 27:59:59;最长11位用于帧)
    CONCATENATE ls_appplay_s-z_play_time+0(2':' ls_appplay_s-z_play_time+2(2':'
       ls_appplay_s-z_play_time+4(2INTO ls_program_play_apply_item-play_time .
    " ls_program_play_apply_item-duration = ls_appplay_s-z_subj_time. "时长类型
    CONCATENATE ls_appplay_s-z_subj_time+0(2':' ls_appplay_s-z_subj_time+2(2':'
       ls_appplay_s-z_subj_time+4(2INTO ls_program_play_apply_item-duration  .
    ls_program_play_apply_item-program_code = ls_appplay_s-z_procode. "节目代码类型
*    ls_program_play_apply_item-audio_language_version = ls_appplay_s-. "语言版本类型
*    ls_program_play_apply_item-subtitle_language_version = ls_appplay_s-. "语言版本类型
    CALL METHOD zcl_cdm_wda_common=>get_language_txt
      EXPORTING
        i_sprsl = ls_appplay_s-z_aud_ver
      IMPORTING
        e_sptxt = ls_language-lang_name
        e_laiso = ls_language-lang_code.
    MOVE-CORRESPONDING ls_language TO ls_program_play_apply_item-audio_language_version.
    CLEAR ls_language.
    CALL METHOD zcl_cdm_wda_common=>get_language_txt
      EXPORTING
        i_sprsl = ls_appplay_s-z_cap_ver
      IMPORTING
        e_sptxt = ls_language-lang_name
        e_laiso = ls_language-lang_code.
    MOVE-CORRESPONDING ls_language TO ls_program_play_apply_item-subtitle_language_version.
    CLEAR ls_language.

    ls_program_play_apply_item-program_name = ls_appplay_s-z_pgnam. "节目名称类型
    "  ls_program_play_apply_item-prog_duration = ls_appplay_s-z_subj_length. "时长类型
    CONCATENATE ls_appplay_s-z_subj_time+0(2':' ls_appplay_s-z_subj_time+2(2':'
       ls_appplay_s-z_subj_time+4(2INTO ls_program_play_apply_item-prog_duration  .

    ls_program_play_apply_item-key_topic_code = ls_appplay_s-z_spec_flg. "重点选题代码类型
    ls_program_play_apply_item-is_live = ls_appplay_s-z_play_form.  "播出方式(0录播,1直播)
    ls_program_play_apply_item-is_first_play = ls_appplay_s-z_rep_flag. "首重并播标志类型
    APPEND ls_program_play_apply_item TO lt_program_play_apply_item .

  ENDLOOP.
  APPEND LINES OF lt_program_play_apply_item TO ls_program_play_apply_items-program_play_apply_item .

  ls_program_play_apply_request-program_play_apply_id = ls_appplay-z_applyplay_cd ."节目报播单编号
  ls_program_play_apply_request-program_play_apply_name = ls_appplay-z_applyplay_nm ."报播单名称
  ls_program_play_apply_request-column_code            = ls_appplay-z_subj_cd."栏目代码类型
  ls_program_play_apply_request-apply_person_id        = sy-uname ."用户工号类型
  ls_program_play_apply_request-comment                = ls_appplay-z_comment ."备注
  CLEAR lv_date.
  CLEAR lv_time.
  CLEAR lv_datime.
  lv_date = ls_appplay-z_apprv_fandat .
  lv_time = ls_appplay-z_apprv_fantim .
  CONCATENATE lv_date lv_time  INTO  lv_datime.
  ls_program_play_apply_request-final_confirm_time     = lv_datime . "确认时间XSD 时间 (UTC):yyyy-mm-ddThh:mm:ssZ [ext.]
  MOVE-CORRESPONDING  ls_program_play_apply_items TO   ls_program_play_apply_request-program_play_apply_items.
  MOVE-CORRESPONDING  ls_program_play_apply_request TO ls_task_specific_info-program_play_apply_request.

  CALL FUNCTION 'ZCDM_IF_TASK_COMMON'
    EXPORTING
      i_objnr                  = lv_char30
      i_creator_id             = i_name
      i_task_name              = 'SCH03-中心审批通过的报播单发布'
      i_end_time               = sy-uzeit
      i_if_name                = 'SCH03'
   IMPORTING
     task_id                  = ls_task_item-task_id
     task_version             = ls_task_version
     task_basic_info          = ls_task_basic_info
* EXCEPTIONS
*   RANGE_GET_FAILED         = 1
*   USER_GET_FAILED          = 2
*   VERSION_GET_FAILED       = 3
*   OTHERS                   = 4
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CONCATENATE  ls_appplay-z_applyplay_begi '04:00:00' INTO  ls_task_basic_info-end_time  .
  MOVE-CORRESPONDING ls_task_version TO ls_task_item-task_version.
  MOVE-CORRESPONDING ls_task_basic_info TO ls_task_item-task_basic_info.
  MOVE-CORRESPONDING ls_task_relation   TO ls_task_item-task_specific_info.
  MOVE-CORRESPONDING ls_task_specific_info TO ls_task_item-task_specific_info.

  APPEND ls_task_item TO lt_task_item.

  APPEND LINES OF lt_task_item TO ls_request2-task_item.

  MOVE-CORRESPONDING ls_request2 TO ls_request1-receive_task_request.
  MOVE-CORRESPONDING ls_request1 TO output-receive_task_request.

  DATA l_guid TYPE char32.

  CALL FUNCTION 'GUID_CREATE'
   IMPORTING
*   EV_GUID_16       =
*   EV_GUID_22       =
     ev_guid_32       = l_guid
  .
  output-receive_task_request-receive_task_request-request_id = l_guid.

  DATA l_request_time_stamp TYPE string.
  CONCATENATE sy-datum+0(4'-' sy-datum+4(2'-'  sy-datum+6(2' ' sy-uzeit+0(2':' sy-uzeit+2(2':' sy-uzeit+4(2'000'
  INTO l_request_time_stamp.
*  OUTPUT-RECEIVE_TASK_REQUEST-RECEIVE_TASK_REQUEST-REQUEST_TIME_STAMP = L_REQUEST_TIME_STAMP.

  output-receive_task_request-receive_task_request-ifneed_receipt = '1'.
  output-receive_task_request-receive_task_request-validate_type = ''.
  output-receive_task_request-receive_task_request-validate_value = ''.
  output-receive_task_request-request_head-source_sys_id = 'CDM'.
  output-receive_task_request-request_head-target_service = 'SCH03-中心审批通过的报播单发布'.
  output-receive_task_request-request_head-request_id = l_guid.


  ls_e2e_log-objnr = i_applyplay_cd.
  ls_e2e_log-ifnam = 'SCH03'.

  ls_e2e_log-ernam = sy-uname.
  ls_e2e_log-ioflg = 'O'.
  ls_e2e_log-taskid = ls_task_item-task_id.
  LOOP AT lt_sysdept INTO ls_sysdept.
    output-receive_task_request-request_head-target_sys_id = ls_sysdept-z_sys_id.
    lv_tableline = sy-tabix.

    ls_e2e_log-tsyst = ls_sysdept-z_sys_id.

*"----------------------------------------------------------------------
*"调用MI_SCH06_OUTBOUND发布数据
*"----------------------------------------------------------------------

    IF lv_tableline EQ '1'.
      TRY.
          CREATE OBJECT lr_sch03_outbound
*  EXPORTING
*    LOGICAL_PORT_NAME  =
              .
        CATCH cx_ai_system_fault .
      ENDTRY.

      TRY.
          CALL METHOD lr_sch03_outbound->mi_sch03_outbound
            EXPORTING
              output = output.

          COMMIT WORK.

        CATCH cx_ai_system_fault INTO l_oref.
          message  = l_oref->if_message~get_text( ).
          ls_e2e_log-stats = 'E'.
          ls_e2e_log-log = '中心审批通过的报播单下发出错'.
          CALL FUNCTION 'ZCDM_IF_E2ELOG'
            EXPORTING
              objnr  = ls_e2e_log-objnr
              ifnam  = ls_e2e_log-ifnam
              tsyst  = ls_e2e_log-tsyst
              ernam  = ls_e2e_log-ernam
              ioflg  = ls_e2e_log-ioflg
              taskid = ls_e2e_log-taskid
              stats  = ls_e2e_log-stats
              log    = ls_e2e_log-log
            EXCEPTIONS
              error  = 1
              OTHERS = 2.
          IF sy-subrc <> 0.
            ROLLBACK WORK.
          ELSE.
            COMMIT WORK.
          ENDIF.
          RAISE error.
      ENDTRY.
      ls_e2e_log-stats = 'S'.
      ls_e2e_log-log = '中心审批通过的报播单下发成功'.

      CALL FUNCTION 'ZCDM_IF_E2ELOG'
        EXPORTING
          objnr  = ls_e2e_log-objnr
          ifnam  = ls_e2e_log-ifnam
          tsyst  = ls_e2e_log-tsyst
          ernam  = ls_e2e_log-ernam
          ioflg  = ls_e2e_log-ioflg
          taskid = ls_e2e_log-taskid
          stats  = ls_e2e_log-stats
          log    = ls_e2e_log-log
        EXCEPTIONS
          error  = 1
          OTHERS = 2.
      IF sy-subrc <> 0.
        ROLLBACK WORK.
      ELSE.
        COMMIT WORK.
      ENDIF.
    ELSE.
      TRY.
          CALL METHOD lr_sch03_outbound->mi_sch03_outbound
            EXPORTING
              output = output.

          COMMIT WORK.

        CATCH cx_ai_system_fault INTO l_oref.
          message  = l_oref->if_message~get_text( ).
          ls_e2e_log-stats = 'E'.
          ls_e2e_log-log = '中心审批通过的报播单下发出错'.
          CALL FUNCTION 'ZCDM_IF_E2ELOG'
            EXPORTING
              objnr  = ls_e2e_log-objnr
              ifnam  = ls_e2e_log-ifnam
              tsyst  = ls_e2e_log-tsyst
              ernam  = ls_e2e_log-ernam
              ioflg  = ls_e2e_log-ioflg
              taskid = ls_e2e_log-taskid
              stats  = ls_e2e_log-stats
              log    = ls_e2e_log-log
            EXCEPTIONS
              error  = 1
              OTHERS = 2.
          IF sy-subrc <> 0.
            ROLLBACK WORK.
          ELSE.
            COMMIT WORK.
          ENDIF.
          RAISE error.
      ENDTRY.
      ls_e2e_log-stats = 'S'.
      ls_e2e_log-log = '中心审批通过的报播单下发成功'.

      CALL FUNCTION 'ZCDM_IF_E2ELOG'
        EXPORTING
          objnr  = ls_e2e_log-objnr
          ifnam  = ls_e2e_log-ifnam
          tsyst  = ls_e2e_log-tsyst
          ernam  = ls_e2e_log-ernam
          ioflg  = ls_e2e_log-ioflg
          taskid = ls_e2e_log-taskid
          stats  = ls_e2e_log-stats
          log    = ls_e2e_log-log
        EXCEPTIONS
          error  = 1
          OTHERS = 2.
      IF sy-subrc <> 0.
        ROLLBACK WORK.
      ELSE.
        COMMIT WORK.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFUNCTION.
阅读(895) | 评论(0) | 转发(0) |
0

上一篇:webdynpro for abap 创建rule

下一篇:CRM_T-Code

给主人留下些什么吧!~~