首页 > 其他分享 >生产订单修改记录报表

生产订单修改记录报表

时间:2024-11-15 09:08:46浏览次数:1  
标签:field old log 修改 lv 订单 ls table 报表

1、写在前面

生产订单修改记录报表对于项目上并不陌生。通常会在增强中编写逻辑来判断生产订单主要信息是否有变更,有则保存到日志表,并通过查询报表展示,帮助用户查看生产订单发生的修改。

本文档的代码,只是对现有逻辑的一些优化,通过配置表的方式,设置监控字段,灵活监控生产订单这些字段的变更,也方便迁移到其他项目使用。

利弊不谈,只是换个思路解决问题,感兴趣的读者可以试一下,也一起测试一下是否有隐藏的BUG。

如果仅仅实施一次,也不需要像本文档这么复杂,直接在增强中写死需要监控的字段就可以了。

2、实施过程

2.1、实施保存增强

CMOD实施订单保存增强

保存时调用日志记录函数

2.2、自建表

创建监控字段配置表,配置需要监控的生产订单字段

其中“表名”和“删除标识”是自定义的域

维护上对应结构的字段,可以根据“表名”字段的搜索帮助找到对应字段。例如找到抬头对应的结构为CAUFVDB,可从CAUFVDB结构中找到要监控的抬头字段,工艺、组件同理。

创建更改日志表,用于存放更改的记录

增强中的函数ZPP_CO02_LOG则根据配置表维护的数据,监控对应的数据改变,并保存到日志表中。

创建查询报表将日志表中的数据进行展示,效果如下

3、参考代码

3.1、增强函数

FUNCTION zpp_co02_log.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  TABLES
*"      HEADER_TABLE STRUCTURE  CAUFVDB
*"      HEADER_TABLE_OLD STRUCTURE  CAUFVDB
*"      POSITION_TABLE STRUCTURE  AFPOB
*"      POSITION_TABLE_OLD STRUCTURE  AAFPO
*"      SEQUENCE_TABLE STRUCTURE  AFFLB
*"      SEQUENCE_TABLE_OLD STRUCTURE  AAFFL
*"      OPERATION_TABLE STRUCTURE  AFVGB
*"      OPERATION_TABLE_OLD_AFVC STRUCTURE  AAFVC
*"      OPERATION_TABLE_OLD_AFVV STRUCTURE  AAFVV
*"      COMPONENT_TABLE STRUCTURE  RESBB
*"      COMPONENT_TABLE_OLD STRUCTURE  ARESB
*"      RELATION_TABLE STRUCTURE  AFABB OPTIONAL
*"      RELATION_TABLE_OLD STRUCTURE  AAFAB OPTIONAL
*"      PSTEXT_TABLE STRUCTURE  NPTXB OPTIONAL
*"      PSTEXT_TABLE_OLD STRUCTURE  ANPTX OPTIONAL
*"      MILESTONE_TABLE STRUCTURE  MLSTB OPTIONAL
*"      MILESTONE_TABLE_OLD STRUCTURE  AMLST OPTIONAL
*"      PLANNED_ORDER_TABLE STRUCTURE  PLAF
*"      STATUS_TABLE STRUCTURE  JEST
*"      STATUS_TABLE_OLD STRUCTURE  JEST
*"      OPERATION_RELATIONS STRUCTURE  PRE_DEC
*"      OPERATION_RELATIONS_OLD STRUCTURE  PRE_DEC
*"      OPERATION_TABLE_OLD_AFVU STRUCTURE  AAFVU
*"      DOCLINK_TABLE STRUCTURE  AFDLD
*"      DOCLINK_TABLE_OLD STRUCTURE  AFDLD
*"----------------------------------------------------------------------

  CHECK sy-tcode = 'CO02'.

  CONSTANTS:c_h TYPE string VALUE '抬头'.
  CONSTANTS:c_r TYPE string VALUE '工艺'.
  CONSTANTS:c_c TYPE string VALUE '组件'.
  CONSTANTS:c_s TYPE string VALUE '订单状态'.

  DATA:lt_log      TYPE TABLE OF zppt_gdbg_log,
       ls_log      TYPE zppt_gdbg_log,
       ls_log_temp TYPE zppt_gdbg_log.

  DATA:lv_tname     TYPE zppt_gdbg_zd-tabname,
       lv_tname_old TYPE zppt_gdbg_zd-tabname.

  "IP和HOST
  DATA: lv_iporg TYPE msxxlist-hostadr,
        lv_ipdec TYPE char16,
        lv_host  TYPE char18.

  DATA:lv_arbpl     TYPE arbpl,
       lv_arbpl_old TYPE arbpl.

  DATA:lv_delete TYPE c,
       lv_seq    TYPE zppt_gdbg_log-seqno.

  FIELD-SYMBOLS:<fs_field>     TYPE any,
                <fs_field_old> TYPE any.


  SELECT SINGLE
    MAX( seqno )
  FROM zppt_gdbg_log
  INTO lv_seq
  WHERE aufnr = header_table-aufnr.

  "生产订单变更日期监控字段
  SELECT
    tabname,"表名
    fieldname,"字段
    ddtext"名称
  FROM zppt_gdbg_zd
  INTO TABLE @DATA(lt_field).

**  Get user IP,hostname
  CALL FUNCTION 'TH_USER_INFO'    " Get user IP,hostname
    EXPORTING
      client   = sy-mandt
      user     = sy-uname
    IMPORTING
      hostaddr = lv_iporg
      terminal = lv_host
    EXCEPTIONS
      OTHERS   = 1.

**"Conv.IP addr to format 'xxx.xxx.xxx.xxx'
  CALL FUNCTION 'GWY_IPADR2STRING'  "Conv.IP addr
    EXPORTING
      ipadr  = lv_iporg
    IMPORTING
      string = lv_ipdec.

  READ TABLE header_table INDEX 1.
  READ TABLE header_table_old INDEX 1.
  READ TABLE position_table INDEX 1.
  READ TABLE position_table_old INDEX 1.

  ls_log_temp-mandt = sy-mandt.
  ls_log_temp-aenam = sy-uname.
  ls_log_temp-laeda = sy-datum.
  ls_log_temp-times = sy-uzeit.
  ls_log_temp-tcode = sy-tcode.
  ls_log_temp-host = lv_host.
  ls_log_temp-ip = lv_ipdec.
  ls_log_temp-aufnr = header_table-aufnr.

*1)生产订单抬头更改记录字段

  LOOP AT lt_field INTO DATA(ls_field) WHERE tabname = 'HEAD'.
    ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE header_table TO <fs_field>.
    IF sy-subrc EQ 0.
      ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE header_table_old TO <fs_field_old>.
      IF sy-subrc EQ 0 AND <fs_field> <> <fs_field_old>.
        ls_log = ls_log_temp.
        lv_seq = lv_seq + 1.
        ls_log-seqno = lv_seq.
        ls_log-object = c_h.
        ls_log-chnid = 'U'.
        ls_log-field = ls_field-ddtext.
        ls_log-value_old = <fs_field_old>.
        ls_log-value_new = <fs_field>.
        APPEND ls_log TO lt_log.
        CLEAR ls_log.
      ENDIF.
    ENDIF.
    CLEAR:ls_field.
  ENDLOOP.

  LOOP AT lt_field INTO ls_field WHERE tabname = 'POSI'.
    ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE position_table TO <fs_field>.
    IF sy-subrc EQ 0.
      ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE position_table_old TO <fs_field_old>.
      IF sy-subrc EQ 0 AND <fs_field> <> <fs_field_old>.
        ls_log = ls_log_temp.
        lv_seq = lv_seq + 1.
        ls_log-seqno = lv_seq.
        ls_log-object = c_h.
        ls_log-chnid = 'U'.
        ls_log-field = ls_field-ddtext.
        ls_log-value_old = <fs_field_old>.
        ls_log-value_new = <fs_field>.
        APPEND ls_log TO lt_log.
        CLEAR ls_log.
      ENDIF.
    ENDIF.
    CLEAR:ls_field.
  ENDLOOP.


*-组件
*2)生产订单组件更改记录字段
*    删除组件时也需要记录以上内容


  LOOP AT component_table WHERE vbkz EQ 'U'
                              OR vbkz EQ 'I'
                              OR vbkz EQ 'D'.

    CASE component_table-vbkz.
      WHEN 'I'.
        LOOP AT lt_field INTO ls_field WHERE tabname = 'COMP'.
          ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE component_table TO <fs_field>.
          IF sy-subrc EQ 0 AND <fs_field> IS NOT INITIAL.
            ls_log = ls_log_temp.
            lv_seq = lv_seq + 1.
            ls_log-seqno = lv_seq.
            ls_log-object = c_c.
            ls_log-chnid = 'I'.
            ls_log-field = ls_field-ddtext.
            ls_log-matnr = component_table-matnr.
            ls_log-value_new = <fs_field>.
            APPEND ls_log TO lt_log.
            CLEAR ls_log.
          ENDIF.
          CLEAR:ls_field.
        ENDLOOP.
      WHEN 'D'.
        CLEAR component_table_old.
        READ TABLE component_table_old WITH KEY rsnum = component_table-rsnum
                                                 rspos = component_table-rspos.
        LOOP AT lt_field INTO ls_field WHERE tabname = 'COMP'.
          ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE component_table_old TO <fs_field_old>.
          IF sy-subrc EQ 0 AND <fs_field_old> IS NOT INITIAL.
            ls_log = ls_log_temp.
            lv_seq = lv_seq + 1.
            ls_log-seqno = lv_seq.
            ls_log-object = c_c.
            ls_log-chnid = 'D'.
            ls_log-field = ls_field-ddtext.
            ls_log-matnr = component_table_old-matnr.
            ls_log-value_old = <fs_field_old>.
            APPEND ls_log TO lt_log.
            CLEAR ls_log.
          ENDIF.
          CLEAR:ls_field.
        ENDLOOP.
      WHEN 'U'.
        CLEAR component_table_old.
        READ TABLE component_table_old WITH KEY rsnum = component_table-rsnum
                                                 rspos = component_table-rspos.

        LOOP AT lt_field INTO ls_field WHERE tabname = 'COMP'.
          ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE component_table TO <fs_field>.
          IF sy-subrc EQ 0.
            ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE component_table_old TO <fs_field_old>.
            IF sy-subrc EQ 0 AND <fs_field> <> <fs_field_old>.
              ls_log = ls_log_temp.
              lv_seq = lv_seq + 1.
              ls_log-seqno = lv_seq.
              ls_log-object = c_c.
              ls_log-chnid = 'U'.
              ls_log-field = ls_field-ddtext.
              ls_log-matnr = component_table-matnr.
              ls_log-value_old = <fs_field_old>.
              ls_log-value_new = <fs_field>.
              APPEND ls_log TO lt_log.
              CLEAR ls_log.
            ENDIF.
          ENDIF.
          CLEAR:ls_field.
        ENDLOOP.
    ENDCASE.
  ENDLOOP.

*-工艺路线
*3)生产订单工艺更改记录字段

  LOOP AT operation_table WHERE vbkz EQ 'U'
                           OR vbkz EQ 'I'
                           OR vbkz EQ 'D'.
    CASE operation_table-vbkz.
      WHEN 'I'.
        LOOP AT lt_field INTO ls_field WHERE tabname = 'OPER'.
          IF ls_field-fieldname = 'ARBPL'."工作中心
            CLEAR:lv_arbpl.
            SELECT SINGLE
              arbpl
            FROM crhd
            INTO lv_arbpl
            WHERE objid = operation_table-arbid.

            IF lv_arbpl IS NOT INITIAL.
              ls_log = ls_log_temp.
              lv_seq = lv_seq + 1.
              ls_log-seqno = lv_seq.
              ls_log-object = c_r.
              ls_log-chnid = 'I'.
              ls_log-field = '工作中心'.
              ls_log-vornr = operation_table-vornr.
              ls_log-value_new = lv_arbpl.
              APPEND ls_log TO lt_log.
              CLEAR ls_log.
            ENDIF.
          ELSE.
            ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE operation_table TO <fs_field>.
            IF sy-subrc EQ 0 AND <fs_field> IS NOT INITIAL.
              ls_log = ls_log_temp.
              lv_seq = lv_seq + 1.
              ls_log-seqno = lv_seq.
              ls_log-object = c_r.
              ls_log-chnid = 'I'.
              ls_log-field = ls_field-ddtext.
              ls_log-vornr = operation_table-vornr.
              ls_log-value_new = <fs_field>.
              APPEND ls_log TO lt_log.
              CLEAR ls_log.
            ENDIF.
          ENDIF.
          CLEAR:ls_field.
        ENDLOOP.
      WHEN 'D'."删除工艺并不会设置为D,要用状态来判断
      WHEN 'U'.
        "用状态判断工艺是否删除
        CLEAR lv_delete.
        READ TABLE status_table
          WITH KEY objnr = operation_table-objnr
                   stat = 'I0013'
                   inact = ''.
        IF sy-subrc = 0.
          lv_delete = 'X'.
        ENDIF.

        CLEAR operation_table_old_afvc.
        READ TABLE operation_table_old_afvc WITH KEY aufpl = operation_table-aufpl
                                                      aplzl = operation_table-aplzl.

        CLEAR operation_table_old_afvv.
        READ TABLE operation_table_old_afvv WITH KEY aufpl = operation_table-aufpl
                                                      aplzl = operation_table-aplzl.


        CLEAR lv_arbpl.
        SELECT SINGLE
            arbpl
        FROM crhd
        INTO lv_arbpl
        WHERE objid = operation_table-arbid.

        CLEAR lv_arbpl_old.
        SELECT SINGLE
            arbpl
        FROM crhd
        INTO lv_arbpl_old
        WHERE objid = operation_table_old_afvc-arbid.

        IF lv_delete = 'X'."删除
          LOOP AT lt_field INTO ls_field WHERE tabname = 'OPER'.
            IF ls_field-fieldname = 'ARBPL'."工作中心
              IF lv_arbpl_old IS NOT INITIAL.
                ls_log = ls_log_temp.
                lv_seq = lv_seq + 1.
                ls_log-seqno = lv_seq.
                ls_log-object = c_r.
                ls_log-chnid = 'D'.
                ls_log-field = '工作中心'.
                ls_log-vornr = operation_table-vornr.
                ls_log-value_old = lv_arbpl_old.
                APPEND ls_log TO lt_log.
                CLEAR ls_log.
              ENDIF.
            ELSE.
              ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE operation_table_old_afvc TO <fs_field_old>.
              IF sy-subrc NE 0.
                ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE operation_table_old_afvv TO <fs_field_old>.
              ENDIF.
              IF sy-subrc EQ 0 AND <fs_field_old> IS NOT INITIAL.
                ls_log = ls_log_temp.
                lv_seq = lv_seq + 1.
                ls_log-seqno = lv_seq.
                ls_log-object = c_r.
                ls_log-chnid = 'D'.
                ls_log-field = ls_field-ddtext.
                ls_log-vornr = operation_table-vornr.
                ls_log-value_old = <fs_field_old>.
                APPEND ls_log TO lt_log.
                CLEAR ls_log.
              ENDIF.
            ENDIF.

            CLEAR:ls_field.
          ENDLOOP.
        ELSE."修改
          LOOP AT lt_field INTO ls_field WHERE tabname = 'OPER'.
            IF ls_field-fieldname = 'ARBPL'."工作中心
              IF lv_arbpl <> lv_arbpl_old.
                ls_log = ls_log_temp.
                lv_seq = lv_seq + 1.
                ls_log-seqno = lv_seq.
                ls_log-object = c_r.
                ls_log-chnid = 'U'.
                ls_log-field = '工作中心'.
                ls_log-vornr = operation_table-vornr.
                ls_log-value_old = lv_arbpl_old.
                ls_log-value_new = lv_arbpl.
                APPEND ls_log TO lt_log.
                CLEAR ls_log.
              ENDIF.
            ELSE.
              ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE operation_table TO <fs_field>.
              IF sy-subrc EQ 0.
                ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE operation_table_old_afvc TO <fs_field_old>.
                IF sy-subrc NE 0.
                  ASSIGN COMPONENT ls_field-fieldname OF STRUCTURE operation_table_old_afvv TO <fs_field_old>.
                ENDIF.
                IF sy-subrc EQ 0 AND <fs_field> <> <fs_field_old>.
                  ls_log = ls_log_temp.
                  lv_seq = lv_seq + 1.
                  ls_log-seqno = lv_seq.
                  ls_log-object = c_r.
                  ls_log-chnid = 'U'.
                  ls_log-field = ls_field-ddtext.
                  ls_log-vornr = operation_table-vornr.
                  ls_log-value_old = <fs_field_old>.
                  ls_log-value_new = <fs_field>.
                  APPEND ls_log TO lt_log.
                  CLEAR ls_log.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDLOOP.
        ENDIF.
      WHEN OTHERS.
    ENDCASE.
  ENDLOOP.

*-生产订单状态
*4)生产订单状态记录
  LOOP AT status_table WHERE objnr = header_table-objnr.

    READ TABLE status_table_old WITH KEY objnr = status_table-objnr
                                   stat = status_table-stat.
    IF sy-subrc = 0.
      IF status_table_old-inact <> status_table-inact.
        ls_log = ls_log_temp.
        lv_seq = lv_seq + 1.
        ls_log-seqno = lv_seq.
        ls_log-object = c_s.
        ls_log-chnid = 'U'.
        ls_log-field = status_table-stat.
        IF status_table_old-inact = 'X'.
          ls_log-value_old = '状态未激活'.
          ls_log-value_new = '状态激活'.
        ELSE.
          ls_log-value_old = '状态激活'.
          ls_log-value_new = '状态未激活'.
        ENDIF.
        APPEND ls_log TO lt_log.
        CLEAR ls_log.
      ENDIF.
    ELSE.
      ls_log = ls_log_temp.
      lv_seq = lv_seq + 1.
      ls_log-seqno = lv_seq.
      ls_log-object = c_s.
      ls_log-chnid = 'U'.
      ls_log-field = status_table-stat.
      ls_log-value_old = ''.
      ls_log-value_new = '状态激活'.
      APPEND ls_log TO lt_log.
      CLEAR ls_log.
    ENDIF.

  ENDLOOP.

  IF lt_log IS NOT INITIAL.
    INSERT zppt_gdbg_log FROM TABLE lt_log.
    REFRESH:lt_log.
  ENDIF.
ENDFUNCTION.

3.2、报表代码

*&---------------------------------------------------------------------*
*& Report: ZPP_GDBG_LOG                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
* Creation Date :                                           *
* Author        :                                             *
* Description   : 生产订单变更记录报表                                 *
* Tcode         : ZPP_GDBG_LOG                                              *
* Doc : 生产订单变更记录报表
* Notion:
* 依赖增强
*  # 二代增强
*    PPCO0001  : EXIT_SAPLCOBT_001 开发应用程序: PP订单
*  # 增强内部调用函数
*    ZPP_CO02_LOG
*----------------------------------------------------------------------*
REPORT ZPP_GDBG_LOG.

*----------------------------------------------------------------------*
*表声明
*----------------------------------------------------------------------*
TABLES:afko,zppt_gdbg_log,aufk.

*----------------------------------------------------------------------*
*类型池声明
*----------------------------------------------------------------------*
TYPE-POOLS:slis.

*----------------------------------------------------------------------*
* 类型定义
*----------------------------------------------------------------------*
TYPES: BEGIN OF ty_alv.
         include structure zppt_gdbg_log.
TYPES: color(4) TYPE c.
TYPES: END OF ty_alv.

*----------------------------------------------------------------------*
* 声明内表和工作区
*----------------------------------------------------------------------*
DATA:gt_alv TYPE TABLE OF ty_alv,
     gs_alv TYPE ty_alv.

*----------------------------------------------------------------------*
*ALV参数声明
*----------------------------------------------------------------------*

DATA:gt_fieldcat TYPE lvc_t_fcat, "字段目录内表
     gs_fieldcat TYPE lvc_s_fcat, "字段目录工作区
     gs_layout   TYPE lvc_s_layo. "用于定义ALV表单的相关格式、属性

*----------------------------------------------------------------------*
*选 择 屏 幕 定 义 块
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE TEXT-001 .
  SELECT-OPTIONS:s_werks FOR aufk-werks  NO INTERVALS OBLIGATORY,
                  s_aufnr FOR zppt_gdbg_log-aufnr, "生产订单
                  s_aenam FOR zppt_gdbg_log-aenam, "更改者
                  s_laeda FOR zppt_gdbg_log-laeda. "修改日期
SELECTION-SCREEN END OF BLOCK block1 .

*&---------------------------------------------------------------------*
*&  INITIALIZATION:程序初始化时所执行的代码
*&---------------------------------------------------------------------*
INITIALIZATION.

*&---------------------------------------------------------------------*
*&  AT SELECTION-SCREEN:在选择屏幕上执行的代码
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN.

*&---------------------------------------------------------------------*
*&  START-OF-SELECTION:程序运行所处理的代码
*&---------------------------------------------------------------------*
START-OF-SELECTION.

  "权限检查
  PERFORM frm_check_srceen.

  "获取取数
  PERFORM frm_get_data.

  "设置字段属性
  PERFORM frm_set_fieldcat.

  "设置输出格式
  PERFORM frm_set_layout.

  "显示ALV
  PERFORM frm_display_alv.

*&---------------------------------------------------------------------*
*&      Form  FRM_CHECK_SRCEEN
*----------------------------------------------------------------------*
FORM frm_check_srceen.

ENDFORM. "frm_check_srceen

*&---------------------------------------------------------------------*
*&      Form  FRM_GET_DATA
*----------------------------------------------------------------------*
FORM frm_get_data.

  SELECT
    co~aufnr,"
    co~aenam,"
    co~laeda,"
    co~times,"
    co~seqno,"
    co~tcode,"
    co~chnid,"
    co~field,"
    co~object,"
    co~matnr,"
    co~vornr,"
    co~host,"
    co~value_old,"
    co~value_new,"
    co~ip
   FROM zppt_gdbg_log AS co
   INNER JOIN aufk AS fv ON fv~aufnr = co~aufnr
   INTO TABLE @DATA(lt_log)
   WHERE co~aufnr IN @s_aufnr
     AND co~aenam IN @s_aenam
     AND co~laeda IN @s_laeda
     AND fv~werks IN @s_werks.

  LOOP AT lt_log INTO DATA(ls_log).
    CLEAR:gs_alv.
    MOVE-CORRESPONDING ls_log TO gs_alv.
    CASE gs_alv-chnid.
      WHEN 'U'.
        gs_alv-color = 'C510'.
      WHEN 'I'.
        gs_alv-color = 'C710'.
      WHEN 'D'.
        gs_alv-color = 'C610'.
    ENDCASE.
    APPEND gs_alv TO gt_alv.
    CLEAR:ls_log.
  ENDLOOP.

  SORT gt_alv BY aufnr seqno.
ENDFORM. "FRM_GET_DATA

*&---------------------------------------------------------------------*
*&      Form  FRM_SET_FIELDCAT
*----------------------------------------------------------------------*
FORM frm_set_fieldcat.

  REFRESH gt_fieldcat.
  DEFINE  init_fill_fcat.
    CLEAR:gs_fieldcat.
    gs_fieldcat-fieldname    = &1.
    gs_fieldcat-coltext      = &2.
    gs_fieldcat-ref_table    = &3.
    gs_fieldcat-ref_field    = &4.
    gs_fieldcat-key          = &5.
    gs_fieldcat-hotspot      = &6.
    gs_fieldcat-edit         = &7.
    gs_fieldcat-no_zero      = &8.
    gs_fieldcat-icon         = &9.
    APPEND gs_fieldcat TO gt_fieldcat.
  END-OF-DEFINITION.

  init_fill_fcat 'AUFNR'     '生产订单' 'ZPPT_GDBG_LOG' 'AUFNR' 'X' '' '' 'X' ''.
  init_fill_fcat 'SEQNO'     '序号' '' '' 'X' '' '' '' ''.
  init_fill_fcat 'FIELD'     '描述' '' '' 'X' '' '' '' ''.
  init_fill_fcat 'VALUE_OLD' '旧值' '' '' '' '' '' '' ''.
  init_fill_fcat 'VALUE_NEW' '新值' '' '' '' '' '' '' ''.
  init_fill_fcat 'OBJECT'    '对象名称' 'ZPPT_GDBG_LOG' 'OBJECT' 'X' '' '' '' ''.
  init_fill_fcat 'MATNR'     '物料' 'ZPPT_GDBG_LOG' 'MATNR' '' '' '' 'X' ''.
  init_fill_fcat 'VORNR'     '组件工序' 'ZPPT_GDBG_LOG' 'VORNR' '' '' '' '' ''.
  init_fill_fcat 'AENAM'     '修改人' 'ZPPT_GDBG_LOG' 'AENAM' '' '' '' '' ''.
  init_fill_fcat 'LAEDA'     '修改日期' 'ZPPT_GDBG_LOG' 'LAEDA' '' '' '' 'X' ''.
  init_fill_fcat 'TIMES'     '修改时间' 'ZPPT_GDBG_LOG' 'TIMES' '' '' '' 'X' ''.
  init_fill_fcat 'TCODE'     '事务代码' 'ZPPT_GDBG_LOG' 'TCODE' '' '' '' '' ''.
  init_fill_fcat 'CHNID'     '修改类型' 'ZPPT_GDBG_LOG' 'CHNID' '' '' '' '' ''.
  init_fill_fcat 'IP'        'IP地址' 'ZPPT_GDBG_LOG' 'IP' '' '' '' '' ''.
  init_fill_fcat 'HOST'      '机器名' 'ZPPT_GDBG_LOG' 'HOST' '' '' '' '' ''.

ENDFORM. "FRM_SET_FIELDCAT

*&---------------------------------------------------------------------*
*&      Form  FRM_SET_LAYOUT
*&---------------------------------------------------------------------*
*       text  界面格式属性
*----------------------------------------------------------------------*
FORM frm_set_layout .
  CLEAR gs_layout.
  gs_layout-sel_mode   = 'A'.     "选择行模式
  gs_layout-cwidth_opt = 'A'.     "优化列宽设置
  gs_layout-zebra      = 'X'.     "设置斑马线
*  gs_layout-box_fname = 'CHECKBOX'.
  gs_layout-info_fname = 'COLOR'.
ENDFORM. " FRM_SET_LAYOUT

*&---------------------------------------------------------------------*
*&      Form  FRM_DISPLAY_ALV
*&---------------------------------------------------------------------*
*       text  界面显示
*----------------------------------------------------------------------*
FORM frm_display_alv .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program      = sy-repid
      is_layout_lvc           = gs_layout
*     i_callback_pf_status_set = 'FRM_SET_STATUS'
      i_callback_user_command = 'FRM_USER_COMMAND'
      it_fieldcat_lvc         = gt_fieldcat
      i_save                  = 'A'
    TABLES
      t_outtab                = gt_alv
    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_DISPLAY_ALV

*&---------------------------------------------------------------------*
*&      Form  SUB_USER_COMMAND、
*----------------------------------------------------------------------*
FORM frm_user_command USING s_ucomm TYPE sy-ucomm
                             re_selfield TYPE slis_selfield.
  CASE s_ucomm.
    WHEN '&IC1'.
      CLEAR gs_alv.
      READ TABLE gt_alv INTO gs_alv INDEX re_selfield-tabindex.
      IF sy-subrc = 0.
        SET PARAMETER ID 'ANR' FIELD gs_alv-aufnr.
        CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.
      ENDIF.

  ENDCASE.

ENDFORM. "SUB_USER_COMMAND


*Selection texts
*----------------------------------------------------------
* S_AENAM         更改者
* S_AUFNR         生产订单
* S_LAEDA         更改日期
* S_WERKS         工厂

 

      TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
  TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back     此页面的语言为英语   翻译为中文(简体)          

标签:field,old,log,修改,lv,订单,ls,table,报表
From: https://www.cnblogs.com/BinGeneral/p/18492970

相关文章

  • Qt/C++地图高级绘图/指定唯一标识添加删除修改/动态显示和隐藏/支持天地图高德地图百
    一、前言说明已经有了最基础的接口用来添加覆盖物,而且还有通过进入覆盖物模式动态添加覆盖物的功能,为什么还要来个高级绘图?因为又有新的需求,给钱就搞,一点底线都没有。无论哪个地图厂家,提供的接口都是没有唯一标识参数的,也就类似于学号,这就是需要自己主动定一个属性用来存储唯一标......
  • 网站换主页在哪里修改
    要修改网站的主页,通常需要访问网站的后台管理系统或直接编辑服务器上的文件。具体步骤取决于你的网站是如何构建和托管的。以下是一些常见的方法:使用CMS(内容管理系统):登录到你的CMS后台(如WordPress,Joomla,Drupal等)。导航到“外观”或“主题”部分,选择当前使用的主题进行编......
  • hadoop+Spark+基于Python的餐厅订单数据分析系统(源码+文档+调试+可视化大屏)
    收藏关注不迷路!!......
  • 2292. 连续两年有 3 个及以上订单的产品
    力扣题目跳转(.-力扣(LeetCode))表: Orders+---------------+------+|ColumnName|Type|+---------------+------+|order_id|int||product_id|int||quantity|int||purchase_date|date|+---------------+------+order_id包含......
  • 关闭 Windows 中的各种广告和提示信息,你可以通过修改注册表(.reg 文件)来实现。这些设置
    关闭Windows中的各种广告和提示信息,你可以通过修改注册表(.reg文件)来实现。这些设置可以帮助你屏蔽掉一些烦人的广告和推荐内容。以下是可以通过.reg文件关闭的功能的注册表条目。1. 关闭文件管理器广告文件资源管理器中的广告(如OneDrive提示或其他推荐内容)可以通过以下......
  • 使用Python爬虫获取商品订单详情:从API到数据存储
    在电子商务日益发展的今天,获取商品订单详情成为了许多开发者和数据分析师的需求。无论是为了分析用户行为,还是为了优化库存管理,订单数据的获取都是至关重要的。本文将详细介绍如何使用Python编写爬虫,通过API获取商品订单详情,并将数据存储到本地。环境搭建在开始编写爬虫之前......
  • 获取购买到的商品订单详情API返回值说明
    在代购系统中,用户常常需要查看自己购买商品的订单详情,这对于提升用户体验和满意度至关重要。本文将详细介绍如何设计和实现一个获取订单详情API,并提供相应的代码示例。系统设计订单详情API需要提供关于特定订单的详尽信息,包括订单状态、商品信息、支付详情、物流信息等。这......
  • Maven修改镜像仓库地址
    Maven修改镜像仓库地址在日常工作中,我们经常会使用Maven来管理项目的依赖。然而,默认的Maven中央仓库可能由于网络问题导致下载依赖速度缓慢或失败。为了提高下载速度和稳定性,我们需要修改Maven的镜像仓库地址。本文将详细介绍如何修改Maven的镜像仓库地址。一、检查Maven安装在......
  • 修改 NIKKE PC 端游戏缓存位置
    本文记录如何使用mklink命令修改NIKKEPC端游戏缓存位置前言NIKKE每次版本更新都要下载大约5~10G的数据,以至于成为了我AFK的一部分原因[允悲]但是看游戏安装目录的大小却只有1G多,我还奇怪数据存哪去了,看到越来越小的C盘的空间才明白,草搜索了一下后立马mklink......
  • 宝塔如何修改网站名,如何在宝塔面板中修改网站名称
    修改网站名称可以提升品牌识别度。以下是详细的步骤:登录宝塔面板:打开浏览器,输入宝塔面板的地址,例如 http://yourserverip:8888。输入用户名和密码,点击“登录”。进入网站管理:登录后,点击左侧菜单栏中的“网站”。在网站列表中找到需要修改名称的网站。修改网站名......