工单更改历史记录

一、自定义表结构

二、生产工单出口增强

三、查询报表

一、自定义表结构

表ZPCO02

MANDT MANDT CLNT 3 0 客户端
AUFNR AUFNR CHAR 12 0 订单号
MATNR MATNR CHAR 18 0 物料号
FILED FIELDNAME CHAR 30 0 字段名
AENAM AENAM CHAR 12 0 对象更改人员的名称
LAEDA LAEDA DATS 8 0 上次更改的日期
TCODE TCODE CHAR 20 0 事务代码
CHNID CDCHNGIND CHAR 1 0 修改类型 (U, I, E, D)
HOSTIP CHAR20 CHAR 20 0 字符 20
HOST MSHOST2 CHAR 32 0 Name of Application Server
VALUE_OLD CHAR20 CHAR 20 0 字符 20
VALUE_NEW CHAR20 CHAR 20 0 字符 20
TIMES CDUZEIT TIMS 6 0 时间已更改
LOOPID SYTABIX INT4 10 0                                                            
ALPOS ALPOS CHAR 1 0 指示符:替代项目
STTXT CO_STTXT CHAR 40 0 系统状态

BDMNG BDMNG QUAN 13 3 需求量

二、生产工单出口增强

PPCO0001

EXIT_SAPLCOBT_001

ZXCO1U01

check sy-tcode ne 'CO01'.

*&保存工单更改的历史记录
tables:caufv,resb.
data: begin of old_resb  occurs 0,  "更改后未保存之RESB.
         aufnr like resb-aufnr,
         posnr like resb-posnr,
         matnr like resb-matnr,
         rsnum like resb-rsnum,
         rspos like resb-rspos,
         xloek like resb-xloek,
         bdmng like resb-bdmng,
         objnr like resb-objnr,
         lgort like resb-lgort,
         end of old_resb.

data: begin of new_resb occurs 0.  "数据库中的RESB.
        include structure old_resb.
data: end of new_resb.
data: begin of obj_resb occurs 0.  "插入的RESB
        include structure old_resb.
data: end of obj_resb.

data: i_zpco02 like zpco02 occurs 0 with header line.
data: i_temp   like zpco02 occurs 0 with header line.

data: iporg like msxxlist-hostadr,
      ipdec(16) type c,
      host(18)  type c.
data: char1(20) type c,
      char2(20) type c.

data: licl type c.

data: inst_flg type c value 'N',
      chan_had type c value 'N'.
*      teco_flg TYPE c VALUE 'N',
*      read_flg TYPE c .
data: l_str type string.

data: i_msgty like sy-msgty.
data: tabix like sy-tabix.

*BREAK-POINT.

clear: i_temp, iporg, ipdec, host.
**  Get user IP,hostname
call function 'TH_USER_INFO'    " Get user IP,hostname
  exporting
    client   = sy-mandt
    user     = sy-uname
  importing
    hostaddr = iporg
    terminal = host
  exceptions
    others   = 1.

**"Conv.IP addr to format 'xxx.xxx.xxx.xxx'
call function 'GWY_IPADR2STRING'  "Conv.IP addr
  exporting
    ipadr   = iporg
  importing
    string  = ipdec.

***Common var.
move: sy-mandt to i_temp-mandt,
      sy-uname to i_temp-aenam,
      sy-datum to i_temp-laeda,
      sy-uzeit to i_temp-times,
      sy-tcode to i_temp-tcode,
         ipdec to i_temp-hostip,
          host to i_temp-host,
* { INCERT
          header_table-sttxt to i_temp-sttxt,  "工单状态
* INCERT } DEVK905414 ADD:工单状态取值
          header_table-aufnr to i_temp-aufnr.

***Check M/O header
select single gamng gltrp gstrp into (caufv-gamng, caufv-gltrp,caufv-gstrp)
         from caufv where aufnr eq header_table-aufnr.
**qty
if header_table-gamng ne caufv-gamng.
  move: caufv-gamng to char1, header_table-gamng to char2.
  move-corresponding i_temp to i_zpco02.
  move: '更改工单总数' to i_zpco02-filed,
        'U'            to i_zpco02-chnid,
        char1          to i_zpco02-value_old,
        char2          to i_zpco02-value_new.
  append i_zpco02.
  inst_flg = 'Y'.
  chan_had = 'Y'.
endif.
**增加开始日期修改记录(MODIFY BY LU.X 2010.09.26)
if header_table-gstrp ne caufv-gstrp.
  move-corresponding i_temp to i_zpco02.
  move: '更改开始时间' to i_zpco02-filed,
        'U'        to i_zpco02-chnid,
        caufv-gstrp        to i_zpco02-value_old,
        header_table-gstrp to i_zpco02-value_new.
  append i_zpco02.
  inst_flg = 'Y'.
endif.

if header_table-gltrp ne caufv-gltrp.
  move-corresponding i_temp to i_zpco02.
  move: '更改完成时间' to i_zpco02-filed,
        'U'        to i_zpco02-chnid,
        caufv-gltrp        to i_zpco02-value_old,
        header_table-gltrp to i_zpco02-value_new.
  append i_zpco02.
  inst_flg = 'Y'.
endif.

 

if inst_flg = 'Y'.
  insert zpco02 from table i_zpco02 accepting duplicate keys.
  inst_flg = 'N'.
endif.

loop at component_table where vbkz eq 'U'
                           or vbkz eq 'I'
                           or vbkz eq 'D'.
  clear licl.
  case component_table-vbkz.
    when 'I'.
      move-corresponding i_temp to i_zpco02.
      move: '新增组件' to i_zpco02-filed,
            'I'        to i_zpco02-chnid,
            ''         to i_zpco02-value_old, "old_resb-matnr
            component_table-matnr to i_zpco02-value_new,
            '新增的组件'   to i_zpco02-matnr,
*           read_flg       TO i_zpco02-readf,
            component_table-alpos to i_zpco02-alpos,
            component_table-bdmng to i_zpco02-bdmng,
            sy-tabix       to i_zpco02-loopid.
      append i_zpco02.
      inst_flg = 'Y'.

    when 'D'.
      move-corresponding i_temp to i_zpco02.
      move: '删除组件' to i_zpco02-filed,
            'D'        to i_zpco02-chnid,
            resb-xloek to i_zpco02-value_old,
            component_table-xloek to i_zpco02-value_new,
            component_table-matnr to i_zpco02-matnr,
*            read_flg       TO i_zpco02-readf,
            component_table-alpos to i_zpco02-alpos,
            sy-tabix       to i_zpco02-loopid.
      append i_zpco02.
      inst_flg = 'Y'.

    when 'U'.
* { INCERT
      if component_table-xloek is not initial.
* { INCERT
        search i_temp-sttxt for 'TECO'.
        case sy-subrc.
          when 4.
* } DEVK910121
            move-corresponding i_temp to i_zpco02.
            move: '删除组件' to i_zpco02-filed,
                  'D'        to i_zpco02-chnid,
                  resb-xloek to i_zpco02-value_old,
                  component_table-xloek to i_zpco02-value_new,
                  component_table-matnr to i_zpco02-matnr,
*            read_flg       TO i_zpco02-readf,
                  component_table-alpos to i_zpco02-alpos,
                  sy-tabix       to i_zpco02-loopid.
            append i_zpco02.
            inst_flg = 'Y'.
* { INCERT
        endcase.
* } DEVK910121 忽略由工单关闭引起的组件删除
      else.
* INCERT } DEVK905414 FIX BUG:删除组件无记录
        select single matnr bdmng lgort into  (resb-matnr, resb-bdmng,resb-lgort)
                 from resb  where aufnr eq component_table-aufnr
                              and posnr eq component_table-posnr
                              and matnr eq component_table-matnr
                              and rsnum eq component_table-rsnum
                              and rspos eq component_table-rspos.
        if component_table-matnr ne resb-matnr.
          move-corresponding i_temp to i_zpco02.
          move: '更改组件' to i_zpco02-filed,
                'U'        to i_zpco02-chnid,
                resb-matnr to i_zpco02-value_old,
                component_table-matnr to i_zpco02-value_new,
                '更改的工单组件' to i_zpco02-matnr,
*             read_flg       TO i_zpco02-readf,
                component_table-alpos to i_zpco02-alpos,
                  sy-tabix       to i_zpco02-loopid.
          append i_zpco02.
          inst_flg = 'Y'.

        elseif component_table-bdmng ne resb-bdmng.
* { DELETE
*          CHECK chan_had NE 'Y'.
* DELETE } DEVK905414 FIX BUG:抬头数量修改引起的组件数量修改无记录
          move: component_table-bdmng to char1, resb-bdmng to char2.
          move-corresponding i_temp to i_zpco02.
          move: '需求数量' to i_zpco02-filed,
          'U'   to i_zpco02-chnid,
          char2 to i_zpco02-value_old,
          char1 to i_zpco02-value_new,
          component_table-matnr to i_zpco02-matnr,
*      read_flg       TO i_zpco02-readf,
          component_table-alpos to i_zpco02-alpos,
          sy-tabix       to i_zpco02-loopid.
          append i_zpco02.
          inst_flg = 'Y'.
*      wangkai 发料仓库变更的记录
        elseif component_table-lgort ne resb-lgort .
          move: component_table-lgort to char1, resb-lgort to char2.
          move-corresponding i_temp to i_zpco02.
          move: '发料仓库' to i_zpco02-filed,
           'U'   to i_zpco02-chnid,
           char2 to i_zpco02-value_old,
           char1 to i_zpco02-value_new,
           component_table-matnr to i_zpco02-matnr,
*      read_flg       TO i_zpco02-readf,
           component_table-alpos to i_zpco02-alpos,
           sy-tabix       to i_zpco02-loopid.
          append i_zpco02.
          inst_flg = 'Y'.
* { INCERT
        endif.
* INCERT } DEVK905414
      endif.
  endcase.

endloop.

if inst_flg = 'Y'.
  insert zpco02 from table i_zpco02 accepting duplicate keys.
  if sy-subrc eq 0.
    inst_flg = 'N'.
    chan_had = 'N'.
    free: i_zpco02.
    clear: i_temp.
  endif.
endif.

三、查询报表

REPORT  ZCOHS.
tables: zpco02, afko.
data: i_zpco02 like zpco02 occurs 0 with header line.
data: i_clear  like zpco02 occurs 0 with header line.
*data: i_aufnr
selection-screen begin of block block1 with frame. title text-001 .
select-options s_aufnr for  afko-aufnr."生产订单
*SELECT-OPTIONS s_matnr FOR ZPCO02-MATNR.
select-options s_aenam for zpco02-aenam."更改者
select-options s_laeda for zpco02-laeda modif id gp2."修改日期
"PARAMETERS:    p_clear AS CHECKBOX MODIF ID gp1.
selection-screen end of block block1 .

 

top-of-page.
  perform. write_header.

at selection-screen output.
  loop at screen.
    if screen-group1 = 'GP1'.
      screen-intensified = '1'.
      modify screen.
      continue.
    endif.
  endloop.

*&---------------------------------------------------------------------*
*&   Event START-OF-SELECTION
*&---------------------------------------------------------------------*
start-of-selection.

  perform. get_data.
*&---------------------------------------------------------------------*
*&   Event END-OF-SELECTION
*&---------------------------------------------------------------------*
end-of-selection.
  perform. report_output.

 form. get_data .
  select zpco02~mandt zpco02~aufnr zpco02~matnr zpco02~filed zpco02~aenam zpco02~laeda zpco02~tcode
         zpco02~chnid zpco02~hostip zpco02~host zpco02~value_old zpco02~value_new zpco02~times zpco02~loopid
         zpco02~alpos zpco02~sttxt zpco02~bdmng
    into corresponding fields of table i_zpco02
    from zpco02
    inner join afpo on zpco02~aufnr = afpo~aufnr
    where  afpo~posnr = 1
      and  afpo~elikz = ''
      and  zpco02~aufnr in s_aufnr
      and  zpco02~aenam in s_aenam
      and  zpco02~laeda in s_laeda
      .

  check i_zpco02[] is initial or sy-subrc eq 4.
  message id 'ZX' type 'S'
          number '000' with '没有找到数据'.

endform.                    " get_data
*&---------------------------------------------------------------------*
*&      Form  write_header
*&---------------------------------------------------------------------*
form. write_header .
  data: l_pos1 type i,
        l_pos2 type i,
        l_pos3 type i,
        l_title(33) type c value '工单更改历史记录'.
*   CONCATENATE l_title v_bom_til INTO l_title.

  l_pos1 = sy-linsz / 2 - 15.
  l_pos2 = sy-linsz - 15.
  l_pos3 = l_pos2 + 6.
  skip 2.
  write /l_pos1 l_title.
  uline at /l_pos1(16).
  skip.
  write at: /(11) '生产订单',
             (16) '组件/表头',
             (16) '更改动作',
             (20) '新字段值',
             (20) '旧字段值',
             (08) '替代',
             (08) '需求数',
             (08) '更改帐号',
             (15) '更改者IP',
             (10) '更改者PC',
             (10) '更改日期',
             (10) '更改时间',
* { INCERT
             (35) '工单状态'.
* INCERT } DEVK910078

  uline.
endform.                    " write_header
*&---------------------------------------------------------------------*
*&      Form  report_output
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form. report_output .
* { REPLACE
*  SORT i_zpco02 BY aufnr aenam laeda.
  sort i_zpco02 by aufnr laeda times matnr.
* REPLACE } DEVK910078
  data qty(13) type c .
  loop at i_zpco02.
    write at: /(11) i_zpco02-aufnr ,  " '生产订单',
               (16) i_zpco02-matnr ,  "  '物料号码',
               (16) i_zpco02-filed .  "  '更改动作',
* { INCERT
    set left scroll-boundary.
* INCERT } DEVK910078
    if i_zpco02-filed = '新增组件' .
      qty = i_zpco02-bdmng .
    else .
      qty = ''.
   endif .
      write at:  (20) i_zpco02-value_new
                      color 2,  "  '新字段值',
                 (20) i_zpco02-value_old
                      color 3,  "  '旧字段值',
                 (08) i_zpco02-alpos
                      color 4,
                 (08) qty
                      color 5,          "  '需求数'
                 (08) i_zpco02-aenam ,  "  '更改帐号',
                 (15) i_zpco02-hostip , "  '更改者IP',
                 (10) i_zpco02-host ,   "  '更改者PC',
                 (10) i_zpco02-laeda ,  "  '更改日期',
                 (10) i_zpco02-times ,  "  '更改时间'.
                 (35) i_zpco02-sttxt.  "'工单状态'.

    endloop.

  endform.                    " report_output

时间: 2024-09-28 10:35:19

工单更改历史记录的相关文章

16家调研,60天测试,选型客服工单系统有“一套”

一个远洋电话,就决定采购一套系统? 北京时间PM 18:58,掌心宝贝技术总监刘登攀及其临时成立的选型团队,刚刚结束长达三个多小时的选型工作汇报会.此时,刘登攀接到一个来自美国的越洋电话,电话那端(美国时间AM 2:58)是掌心宝贝选型团队正在测试的某一家客服系统创始人,双方就客户服务模式的创新与业务应用进行了长达一个多小时的深入探讨. 这一通越洋电话,虽然让刘登攀印象深刻,但并非马上决定采购这样一套系统.掌心宝贝作为家园互动领域最被看好的平台,服务注册幼儿园数量近5万家,覆盖超过1000家代理

工单成本差异分析中的总目标数量

问题描述 工单成本差异分析中的总目标数量 解决方案 http://zhidao.baidu.com/link?url=3DUx-42uKGNDI6fdw0dEIARUR_xnJNCn1cLtddf2BwHGoAYHN0IHBmMDAXAdF3K5lH8I8IL3agMGhLXRY1xQT_

一般在什么情况下需开立RunCard 工单

问题描述 1.一般在什么情况下需开立RunCard工单2.RUNCARD工单与工艺流程的关系是什么?

域名解析商DNSPod工单系统上线 客户服务趋于专业智能化

中介交易 SEO诊断 淘宝客 云主机 技术大厅 随着市场竞争的激烈化,服务质量越来越多的成为企业发展的一大重要因素.对于想要完善服务的企业,工单系统不失为一个很好的客户服务方式.至2006年创建以来,DNSPod用户数量激增,为提高客户服务水平,阿D工单系统应运而生. 据WebHosting.info公布的最新数据显示,2013年1月份,国内域名服务商市场基本保持平稳.而域名解析服务商DNSPod,继续维持去年的强势增长势头,份额现已升至16.783%.目前,DNSPod已经拥有50多万用户,

福州电业局:来自12345网站的一张用电服务表扬工单

12月17日,福州电业局台江营销网点收到一张来自福州市http://www.aliyun.com/zixun/aggregation/39437.html">便民服务中心12345网站的特别工单,工单内容如下:"台江区河下社区永兴楼共有4座楼,今天早上一大清早电业局的装表师傅们就上门,将我们的旧电表更换成新表,甚至有的师傅连饭都还没来得及吃,真是令人非常感动,在此表示深深地感谢!" "12345网站是政府效能办督导的一个关注民生.倾听民意的网站,以往收到的12

《CCNP TSHOOT 300-135认证考试指南》——6.3节单臂路由故障工单

6.3 单臂路由故障工单CCNP TSHOOT 300-135认证考试指南本节将给出与本章前面讨论过的主题相关的故障工单,目的是通过这些故障工单让读者真正了解现实世界或考试环境中的故障检测与排除流程.本节的所有故障工单都以图6-2所示的拓扑结构为例. 6.3.1 故障工单6-1故障问题:PC1无法访问PC2的资源. 深入分析该故障工单后发现,由于PC仍然连接在交换机上,而且仍然有VLAN和中继,因而前面章节讨论过的所有内容均适用于本故障工单.因此拥有一套可重复使用的结构化故障检测与排除流程,对于

基于PHP技术开发客服工单系统_php实例

相关知识:客顺通php在线客服系统 v2.0.0 PESCMS Ticket PESMCS Ticket(下称PT)是一款基于GPLv2协议发布的开源客服工单系统.PT基于PESCMS2为核心进行开发,以全新的设计理念,实现一句JS即可嵌入任意页面中,让工单系统变得更加轻便. 运行环境 PHP 5.4及以上版本 Mysql 5.5及以上版本 浏览器不能低于IE8含8 快速使用 登入系统后台--工单模型--创建工单 .创建完毕后,点击'生成JS'按钮.将JS文件保存到本地.最后在任意的页面中,引入

《CCNP TSHOOT 300-135认证考试指南》——6.5节SVI故障工单

6.5 SVI故障工单CCNP TSHOOT 300-135认证考试指南本节将给出与本章前面讨论过的主题相关的故障工单,目的是通过这些故障工单让读者真正了解现实世界或考试环境中的故障检测与排除流程.本节的所有故障工单都以图6-5所示的拓扑结构为例. 6.5.1 故障工单6-3故障问题:PC1无法访问PC2的资源. 首先验证该故障工单提到的故障问题.例6-19证实了PC1无法访问PC2的资源,这是因为ping测试失败. 接下来验证SW2在正确的接口上学到了PC1的MAC地址并且关联到正确的VLAN

《CCNP TSHOOT 300-135认证考试指南》——5.8节 EtherChannel故障工单

5.8 EtherChannel故障工单CCNP TSHOOT 300-135认证考试指南本节将给出与本章前面讨论过的主题相关的故障工单,目的是通过这些故障工单让读者真正了解现实世界或考试环境中的故障检测与排除流程.本节的所有故障工单都以图5-8所示的拓扑结构为例. 5.8.1 故障工单5-4故障问题:某初级网络管理员抱怨在SW1与SW2之间尝试建立EtherChannel绑定时没有成功,现在请求协助解决这个问题. 首先查看SW1和SW2的show etherchannel summary命令输