审批

REPORT zmc_plgoal_see MESSAGE-ID s05.
DATA:gv_msg_reset(255).
DATA:gv_msg_return(50).
DATA gv_highest_level  TYPE zmct_spr-zspjb.
DATA:gt_zmct_spr LIKE TABLE OF zmct_spr WITH HEADER LINE.
"//---------------------------------------------------
CONSTANTS:con_pernr TYPE pernr_d VALUE '61060017'.
DATA:lv_spjb_now  TYPE zmct_spr-zspjb."当前审批节点
DATA:lv_spjb_now_txt  TYPE char16."当前审批节点
DATA:lv_spjb_highest  TYPE zmct_spr-zspjb.
DATA:lv_fieldname  TYPE char14.
DATA:lv_fieldname_highest  TYPE char14.
DATA:gv_sp_msg  TYPE char255.
DATA:lv_spr  TYPE    char14.
DATA:lv_sprq  TYPE   char14.
DATA:lv_spsj  TYPE   char14.
DATA:lv_spr_h TYPE   char14.
DATA:lv_sprq_h TYPE  char14.
DATA:lv_spsj_h TYPE  char14.
FIELD-SYMBOLS:<spzt> TYPE ANY,<spzt_high> TYPE ANY.
FIELD-SYMBOLS:<spr> TYPE ANY,<sprq> TYPE ANY,<spsj> TYPE ANY.
"//------------审批人姓名---------------------------------------
DATA:lv_value1  TYPE char20..
DATA:lv_name  TYPE char20..
DATA:lv_index1  TYPE char20..
FIELD-SYMBOLS:<spr1> TYPE ANY.
FIELD-SYMBOLS:<sprzt1> TYPE ANY.
FIELD-SYMBOLS:<spr1_name> TYPE ANY.
DEFINE  macro_spname.
  do 6 times.
    clear:lv_value1,lv_name.
    lv_index1 = sy-index.
    condense lv_index1 no-gaps.
    concatenate 'ZSPR_'  lv_index1 into lv_value1.
    concatenate 'NAME_'  lv_index1 into lv_name.
    assign component lv_value1 of structure &1 to <spr1>.
    if sy-subrc = 0 .
      read table gt_zmct_spr   with key    pernr = <spr1>.
      if sy-subrc = 0.
        assign component lv_name of structure &1 to <spr1_name>.
        if sy-subrc = 0 .
          <spr1_name> = gt_zmct_spr-name.
        endif.
      endif.
    endif.
  enddo.
END-OF-DEFINITION.
"//---------------------------------------------------
DEFINE macro_stauts.
  if &1-&2 = 'X' or &1-&2 = icon_checked."程序一开始使用的X标识符,如果审批完成后会更新为图标标识符
    &1-&2  = icon_checked.
  else.
    &1-&2  = icon_cancel.
  endif.
END-OF-DEFINITION.

DEFINE  macro_fname.
  if gv_highest_level >= 1.
    "
    gs_fieldcat-icon = 'X'.
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPZT_1' . perform  set_fieldcat1  using  'ZSPZT_1'   '一级'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPR_1' .  perform  set_fieldcat1  using  'ZSPR_1'    '确认人 '    .
    "
    gs_fieldcat-ref_table = 'ZMCS_NAME' . gs_fieldcat-ref_field = 'NAME_1' .  perform  set_fieldcat1  using  'NAME_1'    '姓名 '    .

    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPRQ_1' . perform  set_fieldcat1  using  'ZSPRQ_1'   '确认日期'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPSJ_1' . perform  set_fieldcat1  using  'ZSPSJ_1'   '确认时间'    .

  endif.
  if gv_highest_level >= 2.
    "
    gs_fieldcat-icon = 'X'.
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPZT_2' . perform  set_fieldcat1  using  'ZSPZT_2'   '二级'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPR_2' .  perform  set_fieldcat1  using  'ZSPR_2'    '确认人 '    .
    "
    gs_fieldcat-ref_table = 'ZMCS_NAME' . gs_fieldcat-ref_field = 'NAME_2' .  perform  set_fieldcat1  using  'NAME_2'    '姓名 '    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPRQ_2' . perform  set_fieldcat1  using  'ZSPRQ_2'   '确认日期'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPSJ_2' . perform  set_fieldcat1  using  'ZSPSJ_2'   '确认时间'    .
  endif.
  if gv_highest_level >= 3.
    "
    gs_fieldcat-icon = 'X'.
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPZT_3' . perform  set_fieldcat1  using  'ZSPZT_3'   '大区一级'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPR_3' .  perform  set_fieldcat1  using  'ZSPR_3'    '确认人 '    .
    "
    gs_fieldcat-ref_table = 'ZMCS_NAME' . gs_fieldcat-ref_field = 'NAME_3' .  perform  set_fieldcat1  using  'NAME_3'    '姓名 '    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPRQ_3' . perform  set_fieldcat1  using  'ZSPRQ_3'   '确认日期'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPSJ_3' . perform  set_fieldcat1  using  'ZSPSJ_3'   '确认时间'    .
  endif.

  if gv_highest_level >= 4.
    "
    gs_fieldcat-icon = 'X'.
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPZT_4' . perform  set_fieldcat1  using  'ZSPZT_4'   '大区二级'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPR_4' .  perform  set_fieldcat1  using  'ZSPR_4'    '确认人 '    .
    "
    gs_fieldcat-ref_table = 'ZMCS_NAME' . gs_fieldcat-ref_field = 'NAME_4' .  perform  set_fieldcat1  using  'NAME_4'    '姓名 '    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPRQ_4' . perform  set_fieldcat1  using  'ZSPRQ_4'   '确认日期'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPSJ_4' . perform  set_fieldcat1  using  'ZSPSJ_4'   '确认时间'    .
  endif.
  if gv_highest_level >= 5.
    "
    gs_fieldcat-icon = 'X'.
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPZT_5' . perform  set_fieldcat1  using  'ZSPZT_5'   '医管'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPR_5' .  perform  set_fieldcat1  using  'ZSPR_5'    '确认人 '    .
    "
    gs_fieldcat-ref_table = 'ZMCS_NAME' . gs_fieldcat-ref_field = 'NAME_5' .  perform  set_fieldcat1  using  'NAME_5'    '姓名 '    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPRQ_5' . perform  set_fieldcat1  using  'ZSPRQ_5'   '确认日期'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPSJ_5' . perform  set_fieldcat1  using  'ZSPSJ_5'   '确认时间'    .
  endif.
  if gv_highest_level >= 6.
    "
    gs_fieldcat-icon = 'X'.
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPZT_6' . perform  set_fieldcat1  using  'ZSPZT_6'   '五级'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPR_6' .  perform  set_fieldcat1  using  'ZSPR_6'    '确认人 '    .
    "
    gs_fieldcat-ref_table = 'ZMCS_NAME' . gs_fieldcat-ref_field = 'NAME_6' .  perform  set_fieldcat1  using  'NAME_6'    '姓名 '    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPRQ_6' . perform  set_fieldcat1  using  'ZSPRQ_6'   '确认日期'    .
    "
    gs_fieldcat-ref_table = 'ZMCT_TLKF' . gs_fieldcat-ref_field = 'ZSPSJ_6' . perform  set_fieldcat1  using  'ZSPSJ_6'   '确认时间'    .
  endif.
END-OF-DEFINITION.
TYPE-POOLS:slis.
TYPES:
BEGIN OF typ_data,
  sel              TYPE char1,
  jgbm             TYPE zmct_pl-jgbm,             "机构
  qdsj             TYPE zmct_pl-qdsj,             "渠道一级
  zqdej            TYPE zmct_pl-zqdej,            "渠道二级
  gjahr            TYPE zmct_pl-gjahr,            "会计年度
  smon             TYPE zmct_pl-smon,             "会计期间
  zvalue_typ       TYPE zmct_pl-zvalue_typ,       "值类型
  zvalue_typ_txt   TYPE zmct_pl-zvalue_typ_txt,   "值类型
  zjg_txt          TYPE zmct_pl-zjg_txt,          "机构描述
  qdsjt            TYPE zmct_pl-qdsjt,            "渠道一级文本
  zqdejt           TYPE zmct_pl-zqdejt,           "渠道二级文本
  zzw_eyebrow      TYPE zmct_pl-zzw_eyebrow,      "整外-眉部整形
  zzw_eye          TYPE zmct_pl-zzw_eye,          "整外-眼部整形
  zzw_rhinoplasty  TYPE zmct_pl-zzw_rhinoplasty,  "整外-鼻部整形
  zzw_breast       TYPE zmct_pl-zzw_breast,       "整外-胸部整形
  zzw_fat_fillers  TYPE zmct_pl-zzw_fat_fillers,  "整外-脂肪填充
  zzw_liposuction  TYPE zmct_pl-zzw_liposuction,  "整外-吸脂
  zzw_facial_wrink TYPE zmct_pl-zzw_facial_wrink, "整外-面部除皱
  zzw_otoplasty    TYPE zmct_pl-zzw_otoplasty,    "整外-耳部整形
  zzw_other        TYPE zmct_pl-zzw_other,        "整外-整外其他
  zwc_acid         TYPE zmct_pl-zwc_acid,         "无创-玻尿酸
  zwc_regenerativ  TYPE zmct_pl-zwc_regenerativ,  "无创-再生材料
  zwc_collagen     TYPE zmct_pl-zwc_collagen,     "无创-胶原蛋白
  zwc_sculpting    TYPE zmct_pl-zwc_sculpting,    "无创-肉毒素塑形
  zwc_wreduction   TYPE zmct_pl-zwc_wreduction,   "无创-肉毒素除皱
  zwc_thread_s     TYPE zmct_pl-zwc_thread_s,     "无创-线雕
  zwc_other        TYPE zmct_pl-zwc_other,        "无创-其它
  zskin_maintain   TYPE zmct_pl-zskin_maintain,   "皮肤-嫩肤保养
  zskin_tighten    TYPE zmct_pl-zskin_tighten,    "皮肤-紧肤抗衰
  zskin_whitening  TYPE zmct_pl-zskin_whitening,  "皮肤-美白祛斑
  zskin_acne_remo  TYPE zmct_pl-zskin_acne_remo,  "皮肤-祛痘
  zskin_scars      TYPE zmct_pl-zskin_scars,      "皮肤-疤痕/瘢痕
  zskin_hair_remov TYPE zmct_pl-zskin_hair_remov, "皮肤-脱毛
  zskin_tattoo     TYPE zmct_pl-zskin_tattoo,     "皮肤-纹绣
  zskin_cosmetic   TYPE zmct_pl-zskin_cosmetic,   "皮肤-化妆品
  zskin_redness    TYPE zmct_pl-zskin_redness,    "皮肤-袪红治疗
  zskin_other      TYPE zmct_pl-zskin_other,      "皮肤-皮肤其他
  zsm_instrument   TYPE zmct_pl-zsm_instrument,   "私密-仪器私密
  zsm_injections   TYPE zmct_pl-zsm_injections,   "私密-注射私密
  zsm_other        TYPE zmct_pl-zsm_other,        "私密-私密其他
  zxt_instrument   TYPE zmct_pl-zxt_instrument,   "纤体-仪器纤体
  zxt_lipolysis    TYPE zmct_pl-zxt_lipolysis,    "纤体-美塑溶脂
  zxt_acid         TYPE zmct_pl-zxt_acid,         "纤体-玻尿酸塑形
  zxt_botox        TYPE zmct_pl-zxt_botox,        "纤体-肉毒塑形
  zxt_other        TYPE zmct_pl-zxt_other,        "纤体-纤体其他
  zkq_orthodontic  TYPE zmct_pl-zkq_orthodontic,  "口腔-正畸
  zkq_restoration  TYPE zmct_pl-zkq_restoration,  "口腔-修复
  zkq_treatment    TYPE zmct_pl-zkq_treatment,    "口腔-治疗
  zkq_implant      TYPE zmct_pl-zkq_implant,      "口腔-种植
  zkq_other        TYPE zmct_pl-zkq_other,        "口腔-口腔其他
  zmf_implants     TYPE zmct_pl-zmf_implants,     "毛发-毛发种植
  zmf_artistic_im  TYPE zmct_pl-zmf_artistic_im,  "毛发-艺术种植
  zmf_anti_aging   TYPE zmct_pl-zmf_anti_aging,   "毛发-头皮抗衰
  zmf_other        TYPE zmct_pl-zmf_other,        "毛发-头皮其他
  zyjk_tcm         TYPE zmct_pl-zyjk_tcm,         "亚健康管理-中医理疗
  zyjk_spa         TYPE zmct_pl-zyjk_spa,         "亚健康管理SPA
  count            TYPE i,                        "该字段专门用来统计行数
  dd_handle        TYPE int4,                     "设置关于下拉列表
  line_color(4)    TYPE c,                        "设置行颜色的字段
  cell_color       TYPE slis_t_specialcol_alv,    "设置字段颜色
  cellstyles       TYPE lvc_t_styl,               "控制单元格可编辑
  checkbox         TYPE c,                        "复选框列
  sep_flag         TYPE char10,                   "结果标识
  created_by       TYPE  zmct_zx-created_by     ,
  created_date     TYPE  zmct_zx-created_date   ,
  created_time     TYPE  zmct_zx-created_time   ,
  zspr_ygnam      TYPE zmc_tygh-ygnam,      "确认人
  msg              TYPE char255.

        INCLUDE STRUCTURE zmct_sp.                    "
        INCLUDE STRUCTURE zmcs_name.                 "
TYPES:END OF typ_data.

DATA: gt_show TYPE TABLE OF typ_data,
      gs_show TYPE typ_data.
FIELD-SYMBOLS:<fs_show> TYPE typ_data.
DATA:gv_event_flag(1).
DATA go_alv_handler_maint TYPE REF TO zcl_alv_event_handler.
************************************************************************
* Tables
************************************************************************
TABLES:     t000.
TYPE-POOLS: slis,icon.

*--·与ALV相关的变量
DATA: gs_fieldcat     TYPE lvc_s_fcat,
      gt_fieldcat     TYPE lvc_t_fcat,
      gs_layout       TYPE lvc_s_layo,
      ls_glay         TYPE lvc_s_glay,
      gt_sub_fieldcat TYPE lvc_t_fcat,
      gs_sub_layout   TYPE lvc_s_layo,
      con_diabox      TYPE REF TO cl_gui_dialogbox_container,
      go_alv          TYPE REF TO cl_gui_alv_grid.

*--·与ALV函数相关的参数
DATA: gt_excluding TYPE slis_t_extab,          "关于排除ALV工具栏标准按钮的内表
      gs_excluding LIKE LINE OF gt_excluding,  "关于排除ALV工具栏标准按钮的结构
      gt_ddval     TYPE lvc_t_drop,            "关于下拉列表的内表
      gs_ddval     TYPE lvc_s_drop,            "关于下拉列表的工作区
      git_events   TYPE slis_t_event.          "注册ALV事件的内表
DATA: gv_need_refresh TYPE c.                  "定义全局的
DATA: lo_alv TYPE REF TO cl_gui_alv_grid.

TABLES:zmct_pl.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE sxtj.
SELECT-OPTIONS:s_jgbm  FOR zmct_pl-jgbm OBLIGATORY MEMORY ID zjg
           MATCHCODE OBJECT zmc_sh_jgbm_d   .   . "机构
SELECT-OPTIONS:s_gjahr  FOR zmct_pl-gjahr NO INTERVALS NO-EXTENSION DEFAULT sy-datum+0(4)."会计年度
SELECT-OPTIONS:s_smon  FOR zmct_pl-smon DEFAULT sy-datum+4(2)."会计期间
SELECT-OPTIONS:s_qdsj  FOR zmct_pl-qdsj."渠道一级
SELECT-OPTIONS:s_zqdej  FOR zmct_pl-zqdej."渠道二级
SELECT-OPTIONS:s_zvalue  FOR zmct_pl-zvalue_typ."值类型
SELECT-OPTIONS:s_zspzt  FOR zmct_pl-zspzt  NO-DISPLAY ."
SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

  %_s_jgbm_%_app_%-text = '机构' .
  %_s_qdsj_%_app_%-text = '渠道一级' .
  %_s_zqdej_%_app_%-text = '渠道二级' .
  %_s_gjahr_%_app_%-text = '会计年度' .
  %_s_smon_%_app_%-text = '会计期间' .
  %_s_zvalue_%_app_%-text = '值类型' .
  sxtj = '筛选条件' .
  IF sy-tcode = 'ZCO_24032'.
    sy-title = '品类目标-查看'.
  ELSEIF sy-tcode = 'ZCO_24036'."取消确认
    sy-title = '品类目标-取消确认'.
  ELSEIF sy-tcode = 'ZCO_24035'."确认
    sy-title = '品类目标-确认'.
  ENDIF.

AT SELECTION-SCREEN  .
  IF sy-tcode = 'ZCO_24035'  ."确认时候只能看见待审核流程 .
    s_zspzt-sign = 'I'.
    s_zspzt-option = 'EQ'.
    s_zspzt-low = 'N'.
    APPEND s_zspzt.CLEAR s_zspzt.
  ENDIF.

START-OF-SELECTION.

  PERFORM authority_check.

  PERFORM a_get_data.

END-OF-SELECTION.

*--·设置排除按钮
  PERFORM frm_set_excluding.
*--·设置事件
  PERFORM frm_set_event.
*--·设置fieldcat
  PERFORM frm_set_fieldcat.
*--·设置layout
  PERFORM frm_set_layout.
*--·输出数据至内表
  PERFORM frm_disp_data.

*&---------------------------------------------------------------------*
*&      Form  authority_check
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM authority_check .
  DATA:s_werks TYPE zmc_tt_range.

  s_werks[] =  s_jgbm[] .
  IF zcl_ck=>auth_control(  s_werks[]  ) = abap_false.
    MESSAGE e000 WITH '您没有此机构的权限!!!'.
    RETURN.
  ENDIF.
ENDFORM.                    "authority_check

*&---------------------------------------------------------------------*
*&      Form  A_get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM a_get_data .

  SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_zmct_spr FROM zmct_spr WHERE jgbm IN s_jgbm.
  SORT gt_zmct_spr BY zspjb DESCENDING.

  READ TABLE gt_zmct_spr  INDEX 1 .
  IF sy-subrc = 0.
    gv_highest_level = gt_zmct_spr-zspjb.
  ENDIF.

  SELECT * INTO CORRESPONDING FIELDS OF TABLE  gt_show
    FROM zmct_pl
    WHERE jgbm IN s_jgbm
    AND qdsj      IN   s_qdsj
    AND zqdej     IN    s_zqdej
    AND gjahr     IN    s_gjahr
    AND smon      IN    s_smon
    AND zvalue_typ IN   s_zvalue
    AND zspzt IN   s_zspzt
    .

  LOOP AT gt_show ASSIGNING <fs_show>.
    <fs_show>-sep_flag = icon_yellow_light.
    IF <fs_show>-zspzt = 'X'..
      <fs_show>-zspzt_txt = icon_led_green.
    ELSE.
      <fs_show>-zspzt_txt = icon_led_red.
    ENDIF.

    macro_stauts <fs_show> zspzt_1 .
    macro_stauts <fs_show> zspzt_2 .
    macro_stauts <fs_show> zspzt_3 .
    macro_stauts <fs_show> zspzt_4 .
    macro_stauts <fs_show> zspzt_5 .
    macro_stauts <fs_show> zspzt_6 .

    macro_spname  <fs_show>.
  ENDLOOP.

  SORT gt_show BY jgbm gjahr smon qdsj zqdej.
ENDFORM.                    "A_get_data

*&---------------------------------------------------------------------*
*&      Form  frm_disp_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM frm_disp_data .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
  EXPORTING
    i_callback_program       = sy-repid
    i_callback_pf_status_set = 'FRM_SET_PF_STATUS'
    i_callback_user_command  = 'FRM_USER_COMMAND'
    i_background_id          = 'ALV_BACKGROUND'
    is_layout_lvc            = gs_layout
    it_fieldcat_lvc          = gt_fieldcat
    it_excluding             = gt_excluding
    "i_grid_title             = CONV lvc_title( |共{ lines( gt_show ) }条| )
    i_save                   = 'A'                   ""X 可以保存全局变式 U 可以保存特定变式 A 都可以保存
    it_events                = git_events
  TABLES
    t_outtab                 = gt_show
  EXCEPTIONS
    program_error            = 1
    OTHERS                   = 2.
  IF sy-subrc <> 0."
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    "frm_disp_data

*&---------------------------------------------------------------------*
*&      Form  frm_set_event
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM frm_set_event .
  DATA l_events TYPE LINE OF slis_t_event.
  l_events-name = 'CALLER_EXIT'.    "'CALLER_EXIT'在此写固定即可
  l_events-form = 'FRM_ENTER_EVENT'."回车事件调用的FORM
  APPEND l_events TO git_events.
ENDFORM.                    "frm_set_event

*&---------------------------------------------------------------------*
*&      Form  frm_enter_event
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->E_GRID     text
*----------------------------------------------------------------------*
FORM frm_enter_event USING e_grid TYPE slis_data_caller_exit.

ENDFORM.                    " frm_set_event

*&---------------------------------------------------------------------*
*&      Form  frm_set_pf_status
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->PT_EXTAB   text
*----------------------------------------------------------------------*
FORM frm_set_pf_status USING pt_extab TYPE slis_t_extab.
  DATA ls_button TYPE slis_extab.
  DATA: lo_alv TYPE REF TO cl_gui_alv_grid.
  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = lo_alv.
*   ls_button-fcode = 'DEL'. APPEND ls_button TO pt_extab.CLEAR ls_button.
*   ls_button-fcode = 'CONFIRM'. APPEND ls_button TO pt_extab.CLEAR ls_button.
*   ls_button-fcode = 'RESET'. APPEND ls_button TO pt_extab.CLEAR ls_button.
  FREE:pt_extab.
  IF sy-tcode = 'ZCO_24032'."查看
    ls_button-fcode = 'CONFIRM'. APPEND ls_button TO pt_extab.CLEAR ls_button.
    ls_button-fcode = 'RESET'. APPEND ls_button TO pt_extab.CLEAR ls_button.
  ELSEIF sy-tcode = 'ZCO_24036'."取消确认
    ls_button-fcode = 'DEL'. APPEND ls_button TO pt_extab.CLEAR ls_button.
    ls_button-fcode = 'CONFIRM'. APPEND ls_button TO pt_extab.CLEAR ls_button.
  ELSEIF sy-tcode = 'ZCO_24035'."确认
    ls_button-fcode = 'RESET'. APPEND ls_button TO pt_extab.CLEAR ls_button.
    ls_button-fcode = 'DEL'. APPEND ls_button TO pt_extab.CLEAR ls_button.
  ENDIF.
  PERFORM alv_col_opt IN PROGRAM zabap_sedi_forms USING lo_alv.

  SET PF-STATUS 'STANDARD'   EXCLUDING pt_extab.
*  SET TITLEBAR 'TITLE' WITH lv_gs1 ."生产计划协同平台&s条
ENDFORM.                    "frm_set_pf_status

*&---------------------------------------------------------------------*
*&      Form  frm_set_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM frm_set_layout .
  CLEAR gs_layout.
  gs_layout-cwidth_opt = 'X'.           "优化列宽度,设置此属性后,GS_fieldcat-OUTPUTLEN不再起作用
  gs_layout-zebra = 'X'.
  gs_layout-sel_mode = 'D'.
  gs_layout-box_fname = 'SEL'.
  gs_layout-countfname = 'COUNT'.       "计数的功能,就是统计ALV显示了多少条记录,在SAP ALV标准过滤后仍能正确的计数
  gs_layout-info_fname   = 'LINE_COLOR'."设置行颜色
  gs_layout-ctab_fname   = 'CELL_COLOR'."单元格颜色设置
  gs_layout-stylefname = 'CELLSTYLES'.  "控制单元格可编辑的字段
  gs_layout-totals_bef  = 'X'.
ENDFORM.                    "frm_set_layout

*&---------------------------------------------------------------------*
*&      Form  frm_set_excluding
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM frm_set_excluding .
  CLEAR: gt_excluding,gs_excluding.
  gs_excluding-fcode = '&RNT_PREV'.
  APPEND gs_excluding TO gt_excluding .
ENDFORM.                    "frm_set_excluding

*&---------------------------------------------------------------------*
*&      Form  frm_set_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM frm_set_fieldcat .
  CLEAR:                gt_fieldcat,gs_fieldcat.
  gs_fieldcat-key       =                        'X'     .
  PERFORM set_fieldcat USING  ' ' ' '  'COUNT' '条目数'.
  IF sy-tcode = 'ZCO_24036' OR sy-tcode = 'ZCO_24035'."取消确认/确认
    gs_fieldcat-key =  'X'.      "
    gs_fieldcat-icon = 'X'.
    PERFORM set_fieldcat USING ''  ''  'SEP_FLAG' '结果标识'   .
    gs_fieldcat-key =  'X'.      "
    PERFORM set_fieldcat USING ''  ''  'MSG' '消息'   .
  ENDIF.

  gs_fieldcat-key       =                        'X'     .
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'JGBM'             'JGBM'             '机构'         .
  gs_fieldcat-key       =                        'X'     .
  gs_fieldcat-no_out = 'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'QDSJ'             'QDSJ'             '渠道一级'       .
  gs_fieldcat-key       =                        'X'     .
  gs_fieldcat-no_out = 'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZQDEJ'            'ZQDEJ'            '渠道二级'       .
  gs_fieldcat-key       =                        'X'     .
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'GJAHR'            'GJAHR'            '会计年度'       .
  gs_fieldcat-key       =                        'X'     .
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'SMON'             'SMON'             '会计期间'       .
  gs_fieldcat-key       =                        'X'     .
  gs_fieldcat-no_out = 'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZVALUE_TYP'       'ZVALUE_TYP'       '值类型'        .
  gs_fieldcat-key =  'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZVALUE_TYP_TXT'   'ZVALUE_TYP_TXT'   '值类型'        .
  gs_fieldcat-key =  'X'.
  PERFORM               set_fieldcat             USING   ' ' ' '          'ZJG_TXT'          '机构描述'       .
  gs_fieldcat-key =  'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'QDSJT'            'QDSJT'            '渠道一级文本'     .
  gs_fieldcat-key =  'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZQDEJT'           'ZQDEJT'           '渠道二级文本'     .
  "//---------------------------------------------------
  PERFORM               set_fieldcat             USING   ' ' ' '           'CREATED_BY'           '创建人'     .
  PERFORM               set_fieldcat             USING   ' ' ' '           'CREATED_DATE'           '创建日期'     .
  PERFORM               set_fieldcat             USING   ' ' ' '           'CREATED_TIME'           '创建时间'     .
  gs_fieldcat-no_out = 'X'.
  PERFORM               set_fieldcat             USING   ' ' ' '           'ZSPZT'           '确认状态'     .
  gs_fieldcat-icon = 'X'.
  PERFORM               set_fieldcat             USING   ' ' ' '           'ZSPZT_TXT'           '确认状态'     .
  macro_fname.
  "//---------------------------------------------------


  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_EYEBROW'      'ZZW_EYEBROW'      '整外-眉部整形'    .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_EYE'          'ZZW_EYE'          '整外-眼部整形'    .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_RHINOPLASTY'  'ZZW_RHINOPLASTY'  '整外-鼻部整形'    .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_BREAST'       'ZZW_BREAST'       '整外-胸部整形'    .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_FAT_FILLERS'  'ZZW_FAT_FILLERS'  '整外-脂肪填充'    .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_LIPOSUCTION'  'ZZW_LIPOSUCTION'  '整外-吸脂'      .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_FACIAL_WRINK' 'ZZW_FACIAL_WRINK' '整外-面部除皱'    .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_OTOPLASTY'    'ZZW_OTOPLASTY'    '整外-耳部整形'    .
  gs_fieldcat-emphasize =                        'C300'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZZW_OTHER'        'ZZW_OTHER'        '整外-整外其他'    .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZWC_ACID'         'ZWC_ACID'         '无创-玻尿酸'     .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZWC_REGENERATIV'  'ZWC_REGENERATIV'  '无创-再生材料'    .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZWC_COLLAGEN'     'ZWC_COLLAGEN'     '无创-胶原蛋白'    .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZWC_SCULPTING'    'ZWC_SCULPTING'    '无创-肉毒素塑形'   .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZWC_WREDUCTION'   'ZWC_WREDUCTION'   '无创-肉毒素除皱'   .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZWC_THREAD_S'     'ZWC_THREAD_S'     '无创-线雕'      .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZWC_OTHER'        'ZWC_OTHER'        '无创-其它'      .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_MAINTAIN'   'ZSKIN_MAINTAIN'   '皮肤-嫩肤保养'    .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_TIGHTEN'    'ZSKIN_TIGHTEN'    '皮肤-紧肤抗衰'    .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_WHITENING'  'ZSKIN_WHITENING'  '皮肤-美白祛斑'    .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_ACNE_REMO'  'ZSKIN_ACNE_REMO'  '皮肤-祛痘'      .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_SCARS'      'ZSKIN_SCARS'      '皮肤-疤痕/瘢痕'   .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_HAIR_REMOV' 'ZSKIN_HAIR_REMOV' '皮肤-脱毛'      .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_TATTOO'     'ZSKIN_TATTOO'     '皮肤-纹绣'      .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_COSMETIC'   'ZSKIN_COSMETIC'   '皮肤-化妆品'     .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_REDNESS'    'ZSKIN_REDNESS'    '皮肤-袪红治疗'    .
  gs_fieldcat-emphasize =                        'C410'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSKIN_OTHER'      'ZSKIN_OTHER'      '皮肤-皮肤其他'    .
  gs_fieldcat-emphasize =                        'C210'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSM_INSTRUMENT'   'ZSM_INSTRUMENT'   '私密-仪器私密'    .
  gs_fieldcat-emphasize =                        'C210'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSM_INJECTIONS'   'ZSM_INJECTIONS'   '私密-注射私密'    .
  gs_fieldcat-emphasize =                        'C210'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZSM_OTHER'        'ZSM_OTHER'        '私密-私密其他'    .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZXT_INSTRUMENT'   'ZXT_INSTRUMENT'   '纤体-仪器纤体'    .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZXT_LIPOLYSIS'    'ZXT_LIPOLYSIS'    '纤体-美塑溶脂'    .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZXT_ACID'         'ZXT_ACID'         '纤体-玻尿酸塑形'   .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZXT_BOTOX'        'ZXT_BOTOX'        '纤体-肉毒塑形'    .
  gs_fieldcat-emphasize =                        'C700'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZXT_OTHER'        'ZXT_OTHER'        '纤体-纤体其他'    .
  gs_fieldcat-emphasize =                        'C500'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZKQ_ORTHODONTIC'  'ZKQ_ORTHODONTIC'  '口腔-正畸'      .
  gs_fieldcat-emphasize =                        'C500'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZKQ_RESTORATION'  'ZKQ_RESTORATION'  '口腔-修复'      .
  gs_fieldcat-emphasize =                        'C500'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZKQ_TREATMENT'    'ZKQ_TREATMENT'    '口腔-治疗'      .
  gs_fieldcat-emphasize =                        'C500'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZKQ_IMPLANT'      'ZKQ_IMPLANT'      '口腔-种植'      .
  gs_fieldcat-emphasize =                        'C500'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZKQ_OTHER'        'ZKQ_OTHER'        '口腔-口腔其他'    .
  gs_fieldcat-emphasize =                        'C710'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZMF_IMPLANTS'     'ZMF_IMPLANTS'     '毛发-毛发种植'    .
  gs_fieldcat-emphasize =                        'C710'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZMF_ARTISTIC_IM'  'ZMF_ARTISTIC_IM'  '毛发-艺术种植'    .
  gs_fieldcat-emphasize =                        'C710'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZMF_ANTI_AGING'   'ZMF_ANTI_AGING'   '毛发-头皮抗衰'    .
  gs_fieldcat-emphasize =                        'C710'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZMF_OTHER'        'ZMF_OTHER'        '毛发-头皮其他'    .
  gs_fieldcat-emphasize =                        'C600'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZYJK_TCM'         'ZYJK_TCM'         '亚健康管理-中医理疗' .
  gs_fieldcat-emphasize =                        'C600'.
  gs_fieldcat-do_sum    =                        'X'.
  PERFORM               set_fieldcat             USING   'ZMCT_PL' 'ZYJK_SPA'         'ZYJK_SPA'         '亚健康管理SPA'   .

ENDFORM .                    "frm_set_fieldcat

*&---------------------------------------------------------------------*
*&      Form  frm_user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM    text
*      -->R_SELFIELD text
*----------------------------------------------------------------------*
FORM frm_user_command USING r_ucomm LIKE sy-ucomm
      r_selfield TYPE slis_selfield.

  DATA: lo_alv TYPE REF TO cl_gui_alv_grid.

  CLEAR:gv_msg_return,gv_msg_reset.

  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = lo_alv.

  CALL METHOD lo_alv->check_changed_data.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  CASE r_ucomm.
    WHEN 'CONFIRM'."确认
      IF sy-mandt = '210' AND sy-uname = 'CHENK'..
        sy-uname = con_pernr.
      ENDIF.
      PERFORM b_confirm.
    WHEN 'RESET'."取消确认
      PERFORM b_reset.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
    WHEN 'DEL'.
      PERFORM b_del.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
    WHEN '&IC1'.
    WHEN '&F03'.
      LEAVE TO SCREEN 0.
    WHEN '&F15' OR '&F12'.
      LEAVE PROGRAM.
      CLEAR gs_show.
      READ TABLE gt_show INTO gs_show INDEX r_selfield-tabindex.
      IF r_selfield-fieldname = 'MANDT'.
        CALL TRANSACTION 'SCC4'. "查看集团信息
      ENDIF.
  ENDCASE.

  r_selfield-refresh = 'X'.

ENDFORM.                    "user_command

*&---------------------------------------------------------------------*
*&      Form  set_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->VALUE(P_0546)  text
*      -->VALUE(P_0547)  text
*      -->VALUE(P_0548)  text
*      -->VALUE(P_0549)  text
*----------------------------------------------------------------------*
FORM set_fieldcat  USING   value(p_0546) value(p_0547)  value(p_0548) value(p_0549).
* GS_fieldcat-just = 'l'."对其方式,L表示左对齐
  gs_fieldcat-ref_table = p_0546  .
  gs_fieldcat-ref_field = p_0547  .
  gs_fieldcat-fieldname = p_0548 .
  gs_fieldcat-coltext   = p_0549 .
  gs_fieldcat-seltext   = p_0549 .
  APPEND gs_fieldcat TO gt_fieldcat.
  CLEAR gs_fieldcat.
ENDFORM.                    " SET_FIELDCAT
*&---------------------------------------------------------------------*
*&      Form  B_RESET
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM b_reset .
  DATA: lv_answer TYPE c.
  DATA:lt_zmct_pl LIKE TABLE OF zmct_pl WITH HEADER LINE.
  gv_msg_return = '取消确认操作成功!'.
  gv_msg_reset = '将撤销【此界面下】的所有确认过的的数据 ,是否继续!!!'.

  LOOP AT gt_show INTO gs_show WHERE sel = 'X'..
  ENDLOOP.
  IF sy-subrc NE 0 .
    MESSAGE s000(z01fi)  WITH '请选择行项目!!!' DISPLAY LIKE 'E'.
    RETURN.
  ENDIF.

  PERFORM popup_to_confirm IN PROGRAM zabap_sedi_forms USING  gv_msg_reset  ' ' CHANGING lv_answer. "1是/2否/A取消
  CHECK lv_answer = '1'.

  LOOP AT gt_show INTO gs_show WHERE sel = 'X'..
    gs_show-sep_flag = icon_green_light.
    gs_show-msg  = gv_msg_return.

    gs_show-zspr  = sy-uname.
    gs_show-zsprq  = sy-datum.
    gs_show-zspsj  = sy-uzeit .
    gs_show-zspzt  = 'X'.

    PERFORM get_domain_ddtext(zabap_sedi_forms) USING 'ZSPZT' lt_zmct_pl-zspzt   CHANGING lt_zmct_pl-zspzt_txt .

    UPDATE zmct_pl SET zspr = ''  zsprq = ''  zspsj = ''   zspzt = 'N' zspzt_txt = '未审核'
    "//---------------------------------------------------
    zspr_1 = ''  zsprq_1 = ''  zspsj_1 = ''   zspzt_1 = ' '
    zspr_2 = ''  zsprq_2 = ''  zspsj_2 = ''   zspzt_2 = ' '
    zspr_3 = ''  zsprq_3 = ''  zspsj_3 = ''   zspzt_3 = ' '
    zspr_4 = ''  zsprq_4 = ''  zspsj_4 = ''   zspzt_4 = ' '
    zspr_5 = ''  zsprq_5 = ''  zspsj_5 = ''   zspzt_5 = ' '
    zspr_6 = ''  zsprq_6 = ''  zspsj_6 = ''   zspzt_6 = ' '
    "//---------------------------------------------------
    WHERE jgbm             = gs_show-jgbm
    AND  qdsj              = gs_show-qdsj
    AND  zqdej             = gs_show-zqdej
    AND  gjahr             = gs_show-gjahr
    AND  smon              = gs_show-smon
    AND  zvalue_typ        = gs_show-zvalue_typ        .
    gs_show-zspzt_txt = icon_red_light.
    gs_show-sep_flag = icon_green_light.
    gs_show-zspzt =  'N'.
    CLEAR:gs_show-zspr,gs_show-zsprq,gs_show-zspsj, gs_show-zspr_ygnam.
    COMMIT WORK AND WAIT.
    MODIFY gt_show FROM  gs_show.CLEAR gs_show.
  ENDLOOP.


ENDFORM.                    " B_RESET
*&---------------------------------------------------------------------*
*&      Form  set_fieldcat1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->VALUE(P_0548)  text
*      -->VALUE(P_0549)  text
*----------------------------------------------------------------------*
FORM set_fieldcat1  USING    value(p_0548)
      value(p_0549).
*   WA_FIELDCAT-JUST = 'L'."对其方式,L表示左对齐
  gs_fieldcat-fieldname = p_0548 .
  gs_fieldcat-coltext   = p_0549 .
  gs_fieldcat-seltext   = p_0549 .
  APPEND gs_fieldcat TO gt_fieldcat.
  CLEAR gs_fieldcat.
ENDFORM.                    " SET_FIELDCAT
*&---------------------------------------------------------------------*
*&      Form  B_DEL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM b_del .
  DATA:lv_value  TYPE char1.
  DATA:lt_zmc_pl TYPE TABLE OF zmct_pl WITH HEADER LINE.

  LOOP AT gt_show INTO gs_show WHERE sel IS NOT INITIAL.
    MOVE-CORRESPONDING gs_show TO lt_zmc_pl.
    IF gs_show-zspzt = 'X'   .
      lv_value = 'X'.
      EXIT.
    ENDIF.

    DO 6 TIMES.
      CLEAR:lv_value1,lv_name.
      lv_index1 = sy-index.
      CONDENSE lv_index1 NO-GAPS.
      CONCATENATE 'ZSPZT_'  lv_index1 INTO lv_value1.
      ASSIGN COMPONENT lv_value1 OF STRUCTURE gs_show TO <sprzt1>.
      IF sy-subrc = 0 .

        IF <sprzt1> = 'X' OR <sprzt1> = icon_checked .
          lv_value = 'X'.
          EXIT.
        ENDIF.
      ENDIF.
    ENDDO.

    APPEND lt_zmc_pl.CLEAR lt_zmc_pl.
    IF lv_value = 'X'.
      EXIT.
    ENDIF.
  ENDLOOP.
  IF sy-subrc NE 0 .
    MESSAGE e000(z01fi)  WITH '请选中行再进行操作'.
    LEAVE TO LIST-PROCESSING.
  ENDIF.

  IF lv_value = 'X'..
    MESSAGE e000(z01fi)  WITH '存在确认过的行项目,因此不能删除,请取消确认后重试!!!'.
    RETURN.
  ENDIF.
  CHECK lv_value IS INITIAL."确认过的不能删除


  IF lt_zmc_pl[] IS NOT INITIAL.
    DELETE zmct_pl FROM TABLE lt_zmc_pl.
    COMMIT WORK AND WAIT.
    IF sy-subrc = 0 .
      DELETE gt_show WHERE sel IS NOT INITIAL.
      MESSAGE s000(z01fi)  WITH '删除成功'.
    ENDIF.
  ENDIF.

ENDFORM.                    " B_DEL
*&---------------------------------------------------------------------*
*&      Form  B_CONFIRM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM b_confirm .
  READ TABLE gt_zmct_spr   WITH KEY pernr = sy-uname    .
  IF sy-subrc NE 0.
    MESSAGE e000(z01fi)  WITH '您没有操作权限,请配置确认人后再进行操作!'.
    RETURN.
  ENDIF.

  PERFORM a_check_sp_is_it_done CHANGING lv_fieldname lv_fieldname_highest lv_spjb_now lv_spjb_highest
    lv_spr lv_sprq lv_spsj
    lv_spr_h lv_sprq_h lv_spsj_h
    gs_show
    .

  DATA:lt_zmct_pl LIKE TABLE OF zmct_pl WITH HEADER LINE.

  LOOP AT gt_show INTO  gs_show WHERE sel = 'X'..
    gs_show-sep_flag = icon_green_light.
    gs_show-msg  = gv_sp_msg.
    IF gs_show-zspzt_txt = icon_led_green.
      gs_show-msg  = '无需重复审核'..
      gs_show-sep_flag  = icon_red_light.
    ELSE.
      PERFORM a_sp_update_now_status  CHANGING gs_show."当前审批节点状态更新
    ENDIF.

    ASSIGN COMPONENT lv_fieldname_highest OF STRUCTURE  gs_show TO <spzt_high>.
    IF <spzt_high> IS ASSIGNED AND <spzt_high> = 'X'..
      gs_show-zspr  = sy-uname.
      gs_show-zsprq  = sy-datum.
      gs_show-zspsj  = sy-uzeit .
      gs_show-zspzt  = 'X'.
      gs_show-zspzt_txt  = icon_led_green.

      PERFORM a_sp_update_highest_status  CHANGING gs_show."最高节点状态更新
    ENDIF.


    MOVE-CORRESPONDING gs_show TO lt_zmct_pl.

    PERFORM get_domain_ddtext(zabap_sedi_forms) USING 'ZSPZT' lt_zmct_pl-zspzt   CHANGING lt_zmct_pl-zspzt_txt .
    macro_stauts gs_show zspzt_1 .
    macro_stauts gs_show zspzt_2 .
    macro_stauts gs_show zspzt_3 .
    macro_stauts gs_show zspzt_4 .
    macro_stauts gs_show zspzt_5 .
    macro_stauts gs_show zspzt_6 .
    MODIFY gt_show FROM gs_show .CLEAR gs_show.
    APPEND lt_zmct_pl.CLEAR lt_zmct_pl.
  ENDLOOP.
  IF sy-subrc NE 0 .

    MESSAGE s000(z01fi)  WITH '请选择行项目!!!' DISPLAY LIKE 'E'.
    RETURN.
  ELSE.
    MODIFY zmct_pl FROM TABLE lt_zmct_pl.
    COMMIT WORK AND WAIT.
  ENDIF.
ENDFORM.                    " B_CONFIRM
*&---------------------------------------------------------------------*
*&      Form  a_check_sp_is_it_done
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->LV_FIELDNAME          text
*      -->LV_FIELDNAME_HIGHEST  text
*      -->LV_SPJB_NOW           text
*      -->LV_SPJB_HIGHEST       text
*      -->LV_SPR                text
*      -->LV_SPRQ               text
*      -->LV_SPSJ               text
*      -->LV_SPR_H              text
*      -->LV_SPRQ_H             text
*      -->LV_SPSJ_H             text
*      -->GS_SHOW-MSG           text
*----------------------------------------------------------------------*
FORM a_check_sp_is_it_done  CHANGING  lv_fieldname TYPE char14
                                      lv_fieldname_highest TYPE char14
                                      lv_spjb_now TYPE zmct_spr-zspjb
                                      lv_spjb_highest TYPE zmct_spr-zspjb

                                      lv_spr     TYPE char14
                                      lv_sprq    TYPE char14
                                      lv_spsj    TYPE char14
                                      lv_spr_h   TYPE char14
                                      lv_sprq_h  TYPE char14
                                      lv_spsj_h  TYPE char14
                                      gs_show-msg
  .

  CLEAR:lv_fieldname,lv_fieldname_highest,lv_spjb_now, lv_spjb_highest.
  CLEAR:lv_spr,lv_sprq,lv_spsj, lv_spr_h,lv_sprq_h,lv_spsj_h.
  CLEAR:lv_spjb_now_txt.
  CLEAR:gv_sp_msg.

  "--- 最高审批节点是否审批完成 ---
  SORT gt_zmct_spr BY zspjb DESCENDING.
  READ TABLE gt_zmct_spr  INDEX 1   .
  IF sy-subrc = 0 .
    lv_spjb_highest = gt_zmct_spr-zspjb.
    CONCATENATE  'ZSPZT_' gt_zmct_spr-zspjb INTO lv_fieldname_highest.
    CONCATENATE  'ZSPR_' gt_zmct_spr-zspjb INTO lv_spr_h.
    CONCATENATE  'ZSPRQ_' gt_zmct_spr-zspjb INTO lv_sprq_h.
    CONCATENATE  'ZSPSJ_' gt_zmct_spr-zspjb INTO lv_spsj_h.
  ENDIF.

  "--- 当前审批节点 ---
  READ TABLE gt_zmct_spr   WITH KEY pernr = sy-uname    .
  IF sy-subrc = 0.
    CONCATENATE  'ZSPZT_' gt_zmct_spr-zspjb INTO lv_fieldname.
    lv_spjb_now = gt_zmct_spr-zspjb.

    CONCATENATE  'ZSPR_'  lv_spjb_now INTO lv_spr .
    CONCATENATE  'ZSPRQ_' lv_spjb_now INTO lv_sprq.
    CONCATENATE  'ZSPSJ_' lv_spjb_now INTO lv_spsj.

    PERFORM get_domain_ddtext(zabap_sedi_forms) USING 'ZSPJB' lv_spjb_now   CHANGING lv_spjb_now_txt .
  ENDIF.


  "//---------------------------------------------------
  DATA:lv_end TYPE char15.
  IF lv_spjb_now = lv_spjb_highest.
    lv_end = '流程结束'.
  ENDIF.
  CONCATENATE '&'  lv_spjb_now_txt  '确认成功'  '&' lv_end INTO gv_sp_msg.


ENDFORM.                    " A_CHECK_SP_IS_IT_DONE
*&---------------------------------------------------------------------*
*&      Form  a_sp_update_highest_status
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->gs_show  text
*----------------------------------------------------------------------*
FORM a_sp_update_highest_status  CHANGING gs_show.
  ASSIGN COMPONENT lv_fieldname_highest OF STRUCTURE  gs_show TO <spzt>.
  IF sy-subrc = 0 ."审批状态
    <spzt> = 'X'.
  ENDIF.


  ASSIGN COMPONENT lv_spr_h OF STRUCTURE  gs_show TO <spr>.
  IF sy-subrc = 0 .
    <spr> = sy-uname.
  ENDIF.

  ASSIGN COMPONENT lv_sprq_h OF STRUCTURE  gs_show TO <sprq>.
  IF sy-subrc = 0 .
    <sprq> = sy-datum.
  ENDIF.

  ASSIGN COMPONENT lv_spsj_h OF STRUCTURE  gs_show TO <spsj>.
  IF sy-subrc = 0 .
    <spsj> = sy-uzeit.
  ENDIF.
ENDFORM.                    " A_SP_UPDATE_HIGHEST_STATUS
*&---------------------------------------------------------------------*
*&      Form  a_sp_update_now_status
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->GS_SHOW    text
*----------------------------------------------------------------------*
FORM a_sp_update_now_status  CHANGING gs_show.

  ASSIGN COMPONENT lv_fieldname OF STRUCTURE  gs_show TO <spzt>.
  IF sy-subrc = 0 ."审批状态
    <spzt> = 'X'.
  ENDIF.


  ASSIGN COMPONENT lv_spr OF STRUCTURE  gs_show TO <spr>.
  IF sy-subrc = 0 .
    <spr> = sy-uname.
  ENDIF.

  ASSIGN COMPONENT lv_sprq OF STRUCTURE  gs_show TO <sprq>.
  IF sy-subrc = 0 .
    <sprq> = sy-datum.
  ENDIF.

  ASSIGN COMPONENT lv_spsj OF STRUCTURE  gs_show TO <spsj>.
  IF sy-subrc = 0 .
    <spsj> = sy-uzeit.
  ENDIF.
ENDFORM.                    " A_SP_UPDATE_NOW_STATUS
View Code

 

posted @ 2023-02-09 17:54  蜡哲图  阅读(34)  评论(0编辑  收藏  举报
目录内容