工艺路线查询报表

ZPPRQROUT01TOP:

  1 *&---------------------------------------------------------------------*
  2 *&  包含                ZPPRQROUT01TOP
  3 *&---------------------------------------------------------------------*
  4 
  5 *---------------------------------------------------------------------*
  6 *  Tables Declare                                                     *
  7 *---------------------------------------------------------------------*
  8 TABLES : MAPL,TVM1T, MAKT, MARA, PLFLD, PLKO, PLPO, PLPOD.
  9 *---------------------------------------------------------------------*
 10 *  Internal Table Definition                                          *
 11 *---------------------------------------------------------------------*
 12 DATA: BEGIN OF ITAB OCCURS 0,
 13         MATNR LIKE MAPL-MATNR,    " 物料号
 14         MAKTX LIKE MAKT-MAKTX,    " 物料描述
 15         VBELN LIKE MAPL-VBELN,    "2011-05-12       销售订单
 16         POSNR LIKE MAPL-POSNR,    "2011-05-12       销售订单行项目
 17         WERKS LIKE MAPL-WERKS,    " 工厂
 18         DATUV LIKE MAPL-DATUV,    " 有效起始日期
 19         DATUB LIKE PLFLD-DATUB,   " 有效截止日期
 20         PLNTY LIKE MAPL-PLNTY,    " 任务清单类型
 21         PLNNR LIKE MAPL-PLNNR,    " 任务清单组码
 22         PLNAL LIKE MAPL-PLNAL,    " 组计数器
 23         PLNKN LIKE PLPO-PLNKN,     "节点
 24         ZAEHL LIKE MAPL-ZAEHL,    "计数器
 25         VERWE LIKE PLKO-VERWE,    " 任务清单使用
 26         STATU LIKE PLKO-STATU,    " 状态
 27         BMSCH LIKE PLPO-BMSCH,    " 基本数量
 28         MEINH LIKE PLPO-MEINH,    " 作业/工序的计量单位
 29         VORNR LIKE PLPO-VORNR,    " 操作/活动编号
 30         STEUS LIKE PLPO-STEUS,    " 控制码
 31         WERKS_OP LIKE PLPO-WERKS, "工序工厂
 32         ARBPL LIKE PLPOD-ARBPL,   " 工作中心
 33         KTSCH LIKE PLPO-KTSCH,    "工序代码
 34         LTXA1 LIKE PLPO-LTXA1,    " 工序短文本
 35         LGTXT TYPE STRING,        "工序长文本
 36         VGW01 LIKE PLPO-VGW01,    " 标准值
 37         VGW02 LIKE PLPO-VGW02,    " 标准值
 38         VGW03 LIKE PLPO-VGW03,    " 标准值
 39         VGW04 LIKE PLPO-VGW04,    " 标准值
 40         VGW05 LIKE PLPO-VGW05,    " 标准值
 41         VGW06 LIKE PLPO-VGW06,    " 标准值
 42         VGE01 LIKE PLPO-VGE01,    "标准值计量单位
 43         VGE02 LIKE PLPO-VGE02,    "标准值计量单位
 44         VGE03 LIKE PLPO-VGE03,    "标准值计量单位
 45         VGE04 LIKE PLPO-VGE04,    "标准值计量单位
 46         VGE05 LIKE PLPO-VGE05,    "标准值计量单位
 47         VGE06 LIKE PLPO-VGE06,    "标准值计量单位
 48         USR00 TYPE USRCHAR20,     "原定额
 49         ANZMA LIKE PLPO-ANZMA,    "雇员数
 50         SPMUS LIKE PLPO-SPMUS,    " 所需分解
 51         SPLIM LIKE PLPO-SPLIM,    "分解数
 52         UEMUS LIKE PLPO-UEMUS,    " 要求重叠
 53         MINWE LIKE PLPO-MINWE,    " 最小发送数量
 54         FRDLB LIKE PLPO-FRDLB,    " 指示符:带外协加工的外部处理工序
 55         INFNR LIKE PLPO-INFNR,    " 采购信息记录的编号
 56         EKORG LIKE PLPO-EKORG,    " 采购组织
 57         MATKL LIKE PLPO-MATKL,    " 物料组
 58         EKGRP LIKE PLPO-EKGRP,    " 外协加工的采购组
 59         PLIFZ LIKE PLPO-PLIFZ,    " 计划的天数内交货
 60         PEINH LIKE PLPO-PEINH,    " 价格单位
 61         PREIS LIKE PLPO-PREIS,    " 采购信息记录中的净价
 62         SAKTO LIKE PLPO-SAKTO,    " 成本要素
 63         WAERS LIKE PLPO-WAERS,    " 货币码
 64         KTEXT LIKE PLKO-KTEXT,    " 任务清单描述
 65         CKSELKZ LIKE PLPO-CKSELKZ,  "成本核算相关
 66       END OF ITAB.
 67 
 68 ***-----
 69 "DATA:ITAB_1 LIKE ITAB OCCURS 0 WITH HEADER LINE.
 70 
 71 DATA: BEGIN OF ITAB_1 OCCURS 0,
 72         MATNR LIKE MAPL-MATNR,    " 物料号
 73         MAKTX LIKE MAKT-MAKTX,    " 物料描述
 74         "VBELN LIKE MAPL-VBELN,    "2011-05-12       销售订单
 75         "POSNR LIKE MAPL-POSNR,    "2011-05-12       销售订单行项目
 76         WERKS LIKE MAPL-WERKS,    " 工厂
 77         DATUV LIKE MAPL-DATUV,    " 有效起始日期
 78         DATUB LIKE PLFLD-DATUB,   " 有效截止日期
 79         "PLNTY LIKE MAPL-PLNTY,    " 任务清单类型
 80         PLNNR LIKE MAPL-PLNNR,    " 任务清单组码
 81         PLNAL LIKE MAPL-PLNAL,    " 组计数器
 82         "PLNKN LIKE PLPO-PLNKN,     "节点
 83         "ZAEHL LIKE MAPL-ZAEHL,    "计数器
 84         VERWE LIKE PLKO-VERWE,    " 任务清单使用
 85         STATU LIKE PLKO-STATU,    " 状态
 86         "BMSCH LIKE PLPO-BMSCH,    " 基本数量
 87         "MEINH LIKE PLPO-MEINH,    " 作业/工序的计量单位
 88         "VORNR LIKE PLPO-VORNR,    " 操作/活动编号
 89         "STEUS LIKE PLPO-STEUS,    " 控制码
 90         "WERKS_OP LIKE PLPO-WERKS, "工序工厂
 91         "ARBPL LIKE PLPOD-ARBPL,   " 工作中心
 92         "KTSCH LIKE PLPO-KTSCH,    "工序代码
 93         "LTXA1 LIKE PLPO-LTXA1,    " 工序短文本
 94         "LGTXT TYPE STRING,        "工序长文本
 95         VGW01 LIKE PLPO-VGW01,    " 标准值
 96         VGW02 LIKE PLPO-VGW02,    " 标准值
 97         VGW04 LIKE PLPO-VGW04,    " 标准值
 98         "VGW04 LIKE PLPO-VGW04,    " 标准值
 99         "VGW05 LIKE PLPO-VGW05,    " 标准值
100         "VGW06 LIKE PLPO-VGW06,    " 标准值
101         "VGE01 LIKE PLPO-VGE01,    "标准值计量单位
102         "VGE02 LIKE PLPO-VGE02,    "标准值计量单位
103         "VGE03 LIKE PLPO-VGE03,    "标准值计量单位
104         "VGE04 LIKE PLPO-VGE04,    "标准值计量单位
105         "VGE05 LIKE PLPO-VGE05,    "标准值计量单位
106         "VGE06 LIKE PLPO-VGE06,    "标准值计量单位
107         "USR00 TYPE USRCHAR20,     "原定额
108         "SPMUS LIKE PLPO-SPMUS,    " 所需分解
109         "UEMUS LIKE PLPO-UEMUS,    " 要求重叠
110         "MINWE LIKE PLPO-MINWE,    " 最小发送数量
111         "FRDLB LIKE PLPO-FRDLB,    " 指示符:带外协加工的外部处理工序
112         "INFNR LIKE PLPO-INFNR,    " 采购信息记录的编号
113         "EKORG LIKE PLPO-EKORG,    " 采购组织
114         "MATKL LIKE PLPO-MATKL,    " 物料组
115         "EKGRP LIKE PLPO-EKGRP,    " 外协加工的采购组
116         "PLIFZ LIKE PLPO-PLIFZ,    " 计划的天数内交货
117         "PEINH LIKE PLPO-PEINH,    " 价格单位
118         "PREIS LIKE PLPO-PREIS,    " 采购信息记录中的净价
119         "SAKTO LIKE PLPO-SAKTO,    " 成本要素
120         "WAERS LIKE PLPO-WAERS,    " 货币码
121         KTEXT LIKE PLKO-KTEXT,    " 任务清单描述
122         "CKSELKZ LIKE PLPO-CKSELKZ,  "成本核算相关
123       END OF ITAB_1.
124 
125 
126 ***-----
127 
128 DATA: BEGIN OF IT_MAPL OCCURS 0,
129         MATNR LIKE MAPL-MATNR,    " 物料号
130         WERKS LIKE MAPL-WERKS,    " 工厂
131         VBELN LIKE MAPL-VBELN,    "2011-05-12       销售订单
132         POSNR LIKE MAPL-POSNR,    "2011-05-12       销售订单行项目
133         PLNTY LIKE MAPL-PLNTY,    " 任务清单类型
134         PLNNR LIKE MAPL-PLNNR,    " 任务清单组码
135         PLNAL LIKE MAPL-PLNAL,    " 组计数器
136         ZKRIZ LIKE MAPL-ZKRIZ,    " 附加条件计数器
137         ZAEHL LIKE MAPL-ZAEHL,    " 内部计数器
138         DATUV LIKE MAPL-DATUV,    " 有效起始日期
139         LOEKZ LIKE MAPL-LOEKZ,    " 删除标识
140       END OF IT_MAPL.
141 
142 DATA: BEGIN OF IT_PLKO OCCURS 0,
143         PLNTY LIKE PLKO-PLNTY,
144         PLNNR LIKE PLKO-PLNNR,
145 *          plnkn LIKE plko-plnkn,
146         PLNAL LIKE PLKO-PLNAL,
147         PLNKN LIKE PLPO-PLNKN,     "节点
148         ZAEHL LIKE PLKO-ZAEHL,
149         DATUV LIKE PLKO-DATUV,
150         TECHV LIKE PLKO-TECHV,
151         AENNR LIKE PLKO-AENNR,
152         LOEKZ LIKE PLKO-LOEKZ,
153         VERWE LIKE PLKO-VERWE,    " 任务清单使用
154         STATU LIKE PLKO-STATU,    " 状态
155         BMSCH LIKE PLPO-BMSCH,    " 基本数量
156         MEINH LIKE PLPO-MEINH,    " 计量单位
157         VORNR LIKE PLPO-VORNR,    " 操作/活动编号
158         STEUS LIKE PLPO-STEUS,    " 控制码
159         KTSCH LIKE PLPO-KTSCH,    "工序代码
160         LTXA1 LIKE PLPO-LTXA1,    " 工序短文本
161 *          arbpl LIKE plpo-arbpl,
162       END OF IT_PLKO.
163 *----------------------------------------------------------------------*
164 * ALV Definition                                                       *
165 *----------------------------------------------------------------------*
166 TYPE-POOLS: SLIS.
167 
168 DATA: G_REPID        TYPE SY-REPID,
169       GT_FIELDCAT    TYPE SLIS_T_FIELDCAT_ALV,
170       GT_LAYOUT      TYPE SLIS_LAYOUT_ALV,
171       GT_SORTINFO    TYPE SLIS_SORTINFO_ALV,
172       GT_LVC_TITLE   TYPE LVC_TITLE,
173       GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
174       GT_EVENTS      TYPE SLIS_T_EVENT,
175       GT_FCAT        TYPE LVC_T_FCAT,
176       GT_TABLE       TYPE REF TO DATA,
177       GS_SETTINGS    TYPE LVC_S_GLAY,
178       F2CODE         LIKE SY-UCOMM VALUE '&TEA'.
179 
180 DATA: G_STATUS_FORM  TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
181       G_COMMAND_FORM TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
182 DATA: EVENTS         TYPE SLIS_ALV_EVENT OCCURS 0 WITH HEADER LINE.
183 *---------------------------------------------------------------------*
184 *  Gobal Definition                                                   *
185 *---------------------------------------------------------------------*
186 DATA       G_POS   TYPE I.
187 
188 *---------------------------------------------------------------------*
189 *  End                                                                *
190 *---------------------------------------------------------------------*

 

ZPPRQROUT01S01:

 1 *&---------------------------------------------------------------------*
 2 *&  包括                ZPPRQROUT01S01
 3 *&---------------------------------------------------------------------*
 4 *---------------------------------------------------------------------*
 5 *  Define the selection screen here                                   *
 6 *---------------------------------------------------------------------*
 7 SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-T01.
 8 SELECT-OPTIONS:  S_MATNR FOR  MARA-MATNR.                 " 物料号
 9 *                 S_MVGR1 FOR TVM1T-MVGR1.
10 PARAMETERS: S_DATUV LIKE PLKO-DATUV DEFAULT SY-DATUM." 有效日期
11 SELECT-OPTIONS: S_ARBPL FOR  PLPOD-ARBPL.                " 工作中心
12 PARAMETERS    :  P_PLNTY LIKE MAPL-PLNTY OBLIGATORY
13                                          DEFAULT 'N',     " 任务清单类型
14                  P_WERKS LIKE MARC-WERKS OBLIGATORY       " 工厂
15                                          DEFAULT '1010'.
16 SELECT-OPTIONS:S_MATKL FOR MARA-MATKL.
17 SELECTION-SCREEN END OF BLOCK BLK1.
18 
19 SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
20 PARAMETERS:CB_1 AS CHECKBOX MODIF ID 1 USER-COMMAND C1.
21 *           CB_2 AS CHECKBOX,
22 *           CB_3 AS CHECKBOX.
23 SELECTION-SCREEN END OF BLOCK BLK2.
24 
25 *************屏幕控制***********
26 AT SELECTION-SCREEN.     "屏幕执行声明
27 AUTHORITY-CHECK OBJECT 'M_MATE_WRK'
28 *    ID 'ACTVT' FIELD '*'
29 ID 'WERKS' FIELD P_WERKS.
30 IF SY-SUBRC <> 0.
31   MESSAGE '您没有分配工厂代码' && P_WERKS && '权限,请检查' TYPE  'E'.
32 ENDIF.
33 AT SELECTION-SCREEN OUTPUT.
34   IF CB_1 = ''.
35     LOOP AT SCREEN.
36       IF SCREEN-GROUP4 = '010' OR SCREEN-GROUP4 = '011' .
37         SCREEN-ACTIVE = 0.
38       ENDIF.
39       MODIFY SCREEN.
40     ENDLOOP.
41   ENDIF.

 

ZPPRQROUT01F01:

  1 *&---------------------------------------------------------------------*
  2 *&  包括                ZPPRQROUT01F01
  3 *&---------------------------------------------------------------------*
  4 *&---------------------------------------------------------------------*
  5 *&      Form  F_GET_DATA
  6 *&---------------------------------------------------------------------*
  7 *       text
  8 *----------------------------------------------------------------------*
  9 *  -->  p1        text
 10 *  <--  p2        text
 11 *----------------------------------------------------------------------*
 12 FORM F_GET_DATA .
 13 *- 分配任务清单到物料 数据
 14   SELECT  MAPL~MATNR
 15           MAPL~WERKS
 16           MAPL~PLNTY
 17           MAPL~PLNNR
 18           MAPL~PLNAL
 19           MAPL~ZKRIZ
 20           MAPL~ZAEHL
 21           MAPL~DATUV
 22           MAPL~LOEKZ
 23           MAPL~VBELN
 24           MAPL~POSNR
 25      FROM MAPL
 26     INNER JOIN MARA ON MAPL~MATNR = MARA~MATNR
 27     INTO CORRESPONDING FIELDS OF TABLE IT_MAPL
 28     WHERE MAPL~MATNR IN S_MATNR
 29 *      AND MARA~MVGR1 IN S_MVGR1
 30       AND MAPL~WERKS EQ P_WERKS
 31       AND MAPL~PLNTY EQ P_PLNTY
 32       AND MAPL~LOEKZ EQ SPACE
 33       AND MARA~MATKL IN S_MATKL.
 34 
 35   IF IT_MAPL[] IS NOT INITIAL.
 36     SELECT PLKO~PLNTY
 37            PLKO~PLNNR
 38 *           plko~plnkn
 39            PLKO~PLNAL
 40            PLPO~PLNKN     "节点
 41            PLKO~ZAEHL
 42            PLKO~DATUV
 43            PLKO~TECHV
 44            PLKO~AENNR
 45            PLKO~LOEKZ
 46            PLPO~BMSCH
 47            PLPO~MEINH
 48            PLPO~VORNR
 49            PLPO~STEUS
 50            PLPO~LTXA1
 51            PLPO~KTSCH
 52       INTO CORRESPONDING FIELDS OF TABLE IT_PLKO
 53       FROM PLKO JOIN
 54                 PLAS
 55                 ON PLKO~PLNTY = PLAS~PLNTY
 56                AND PLKO~PLNNR = PLAS~PLNNR
 57                AND PLKO~PLNAL = PLAS~PLNAL
 58             JOIN PLPO
 59                 ON PLPO~PLNTY = PLAS~PLNTY
 60                AND PLPO~PLNNR = PLAS~PLNNR
 61                AND PLPO~PLNKN = PLAS~PLNKN
 62 *          join plpo on plko~plnty = plpo~plnty
 63 *               and plko~plnnr = plpo~plnnr
 64 **               AND plko~plnal = plpo~vplal
 65 *               and plko~zaehl = plpo~zaehl
 66            JOIN CRHD AS C ON C~OBJID = PLPO~ARBID
 67 *      and c~objty = 'A'
 68        FOR ALL ENTRIES IN IT_MAPL
 69       WHERE PLKO~PLNTY = IT_MAPL-PLNTY
 70         AND PLKO~PLNNR = IT_MAPL-PLNNR
 71         AND PLKO~PLNAL = IT_MAPL-PLNAL
 72         AND PLPO~LOEKZ EQ SPACE
 73         AND C~ARBPL IN S_ARBPL
 74         AND C~OBJTY = 'A'
 75         AND PLKO~DATUV <= S_DATUV.
 76   ENDIF.
 77 
 78   SORT IT_PLKO BY PLNTY
 79                   PLNNR
 80                   PLNAL.
 81   DELETE ADJACENT DUPLICATES FROM IT_PLKO COMPARING PLNTY PLNNR PLNAL.
 82 
 83 ENDFORM.                    " F_GET_DATA
 84 *&---------------------------------------------------------------------*
 85 *&      Form  F_DEAL_DATA
 86 *&---------------------------------------------------------------------*
 87 *       text
 88 *----------------------------------------------------------------------*
 89 *  -->  p1        text
 90 *  <--  p2        text
 91 *----------------------------------------------------------------------*
 92 FORM F_DEAL_DATA .
 93   DATA: BEGIN OF IT_MAKT OCCURS 0,
 94           MATNR LIKE MAKT-MATNR,
 95           MAKTX LIKE MAKT-MAKTX,
 96         END OF IT_MAKT.
 97   DATA : IT_TSK_TAB TYPE TABLE OF CAPP_TSK WITH HEADER LINE,
 98          IT_OPR_TAB TYPE TABLE OF CAPP_OPR WITH HEADER LINE.
 99 *         lt_phase_tab type standard table of capp_opr with header line,
100 *         lt_SUBOPR_TAB TYPE STANDARD TABLE OF CAPP_OPR WITH HEADER LINE,
101 *         lt_REFERR_TAB TYPE STANDARD TABLE OF CAPP_OPR WITH HEADER LINE,
102 *         lt_REFMIS_TAB TYPE STANDARD TABLE OF CAPP_OPR WITH HEADER LINE.
103   DATA: LTD_TLINE TYPE STANDARD TABLE OF TLINE,
104         LTH_TLINE TYPE TLINE,
105          LWK_NAME TYPE THEAD-TDNAME.
106 
107 *- 物料描述 数据
108   SELECT MAKT~MATNR
109          MAKT~MAKTX
110     INTO CORRESPONDING FIELDS OF TABLE IT_MAKT
111     FROM MAKT
112      FOR ALL ENTRIES IN IT_MAPL
113    WHERE MAKT~MATNR EQ IT_MAPL-MATNR
114      AND MAKT~SPRAS EQ SY-LANGU.
115 *- 内表排序
116   SORT : IT_MAPL BY PLNTY PLNNR PLNAL,
117          IT_MAKT BY MATNR.
118   LOOP AT IT_PLKO.
119     READ TABLE IT_MAPL WITH KEY PLNTY = IT_PLKO-PLNTY
120                                 PLNNR = IT_PLKO-PLNNR
121                                 PLNAL = IT_PLKO-PLNAL BINARY SEARCH.
122     IF SY-SUBRC EQ 0.
123       CALL FUNCTION 'CARO_ROUTING_READ'
124         EXPORTING
125          DATE_FROM                  = '19000101'
126          DATE_TO                    = '99991231'
127          PLNTY                      = IT_PLKO-PLNTY
128          PLNNR                      = IT_PLKO-PLNNR
129          PLNAL                      = IT_PLKO-PLNAL
130          MATNR                      = IT_MAPL-MATNR
131          BUFFER_DEL_FLG             = 'X'
132          DELETE_ALL_CAL_FLG         = 'X'
133          ADAPT_FLG                  = 'X'
134          IV_CREATE_ADD_CHANGE       = ' '
135        TABLES
136         TSK_TAB                    = IT_TSK_TAB
137 *       SEQ_TAB                    =
138         OPR_TAB                    = IT_OPR_TAB
139 *        phase_tab                  = lt_phase_tab
140 *        SUBOPR_TAB                 = lt_SUBOPR_TAB
141 *       REL_TAB                    =
142 *       COM_TAB                    =
143 *        REFERR_TAB                 = lt_REFERR_TAB
144 *        REFMIS_TAB                 = lt_REFMIS_TAB
145        EXCEPTIONS
146          NOT_FOUND                  = 1
147          REF_NOT_EXP                = 2
148          NOT_VALID                  = 3
149          OTHERS                     = 4
150                 .
151       IF SY-SUBRC <> 0.
152         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
153                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
154       ELSE.
155         SORT IT_TSK_TAB BY ZAEHL DESCENDING.
156         SORT IT_OPR_TAB BY PLNKN ASCENDING
157                            ZAEHL DESCENDING.
158         DELETE ADJACENT DUPLICATES FROM IT_OPR_TAB COMPARING PLNNR PLNKN.
159         DELETE ADJACENT DUPLICATES FROM IT_TSK_TAB COMPARING PLNNR.
160         LOOP AT IT_TSK_TAB.
161           MOVE-CORRESPONDING IT_PLKO TO ITAB.
162           MOVE : IT_MAPL-MATNR TO ITAB-MATNR,
163                  IT_MAPL-WERKS TO ITAB-WERKS.
164           MOVE-CORRESPONDING IT_TSK_TAB TO ITAB.
165           READ TABLE IT_MAKT WITH KEY MATNR = ITAB-MATNR BINARY SEARCH.
166           IF SY-SUBRC EQ 0.
167             MOVE IT_MAKT-MAKTX TO ITAB-MAKTX.
168           ENDIF.
169           LOOP AT IT_OPR_TAB.
170 *- 取工作中心
171 *            SELECT SINGLE crhd~arbpl INTO itab-arbpl
172 *              FROM crhd JOIN
173 *                   afvc ON afvc~arbid = crhd~objid
174 *             WHERE plnnr EQ it_opr_tab-plnnr
175 *               AND zaehl EQ it_opr_tab-zaehl.
176             CLEAR ITAB-ARBPL.
177             SELECT SINGLE CRHD~ARBPL INTO ITAB-ARBPL
178               FROM CRHD
179              WHERE CRHD~OBJID EQ IT_OPR_TAB-ARBID.
180 
181             MOVE : IT_OPR_TAB-BMSCH TO ITAB-BMSCH,
182                    IT_OPR_TAB-MEINH TO ITAB-MEINH,
183                    IT_OPR_TAB-VORNR TO ITAB-VORNR,
184                    IT_OPR_TAB-STEUS TO ITAB-STEUS,
185 *                   it_opr_tab-arbpl TO itab-arbpl,
186                    IT_OPR_TAB-VGW01 TO ITAB-VGW01,
187                    IT_OPR_TAB-VGW02 TO ITAB-VGW02,
188                    IT_OPR_TAB-VGW03 TO ITAB-VGW03,
189                    IT_OPR_TAB-VGW04 TO ITAB-VGW04,
190                    IT_OPR_TAB-VGW05 TO ITAB-VGW05,
191                    IT_OPR_TAB-VGW06 TO ITAB-VGW06,
192                    IT_OPR_TAB-VGE01 TO ITAB-VGE01,
193                    IT_OPR_TAB-VGE02 TO ITAB-VGE02,
194                    IT_OPR_TAB-VGE03 TO ITAB-VGE03,
195                    IT_OPR_TAB-VGE04 TO ITAB-VGE04,
196                    IT_OPR_TAB-VGE05 TO ITAB-VGE05,
197                    IT_OPR_TAB-VGE06 TO ITAB-VGE06,
198 *                  原定额
199                    IT_OPR_TAB-USR00 TO ITAB-USR00,
200                    IT_OPR_TAB-ANZMA TO ITAB-ANZMA,
201                    IT_OPR_TAB-SPMUS TO ITAB-SPMUS,
202                    IT_OPR_TAB-SPLIM TO ITAB-SPLIM,
203                    IT_OPR_TAB-UEMUS TO ITAB-UEMUS,
204                    IT_OPR_TAB-MINWE TO ITAB-MINWE,
205                    IT_OPR_TAB-FRDLB TO ITAB-FRDLB,
206                    IT_OPR_TAB-INFNR TO ITAB-INFNR,
207                    IT_OPR_TAB-EKORG TO ITAB-EKORG,
208                    IT_OPR_TAB-MATKL TO ITAB-MATKL,
209                    IT_OPR_TAB-EKGRP    TO ITAB-EKGRP,
210                    IT_OPR_TAB-PLIFZ    TO ITAB-PLIFZ,
211                    IT_OPR_TAB-PEINH    TO ITAB-PEINH,
212                    IT_OPR_TAB-PREIS    TO ITAB-PREIS,
213                    IT_OPR_TAB-SAKTO    TO ITAB-SAKTO,
214                    IT_OPR_TAB-WAERS    TO ITAB-WAERS,
215                    IT_OPR_TAB-KTSCH TO ITAB-KTSCH,
216                    IT_OPR_TAB-LTXA1 TO ITAB-LTXA1,
217                    IT_OPR_TAB-CKSELKZ TO ITAB-CKSELKZ,
218                    IT_OPR_TAB-WERKS TO ITAB-WERKS_OP.   "工序工厂
219             IF IT_OPR_TAB-INFNR IS NOT INITIAL.
220               SELECT SINGLE PEINH NETPR WAERS FROM EINE
221                   INTO (ITAB-PEINH,ITAB-PREIS,ITAB-WAERS)
222                   WHERE INFNR = IT_OPR_TAB-INFNR
223                     AND EKORG = IT_OPR_TAB-EKORG
224                     AND ESOKZ = IT_OPR_TAB-ESOKZ
225                     AND WERKS = IT_OPR_TAB-WERKS.
226             ENDIF.
227             ITAB-VBELN = IT_MAPL-VBELN.
228             ITAB-POSNR = IT_MAPL-POSNR.
229 ********** 工序长文本
230 
231             CONCATENATE SY-MANDT ITAB-PLNTY ITAB-PLNNR IT_OPR_TAB-PLNKN IT_OPR_TAB-ZAEHL INTO LWK_NAME. "对象名
232             CLEAR ITAB-LGTXT.
233             CALL FUNCTION 'READ_TEXT'
234               EXPORTING
235                 CLIENT                        = SY-MANDT
236                 ID                            = 'PLPO'
237                 LANGUAGE                      = '1'
238                 NAME                          = LWK_NAME
239                 OBJECT                        = 'ROUTING'
240 *     ARCHIVE_HANDLE                = 0
241 *     LOCAL_CAT                     = ' '
242 *   IMPORTING
243 *     HEADER                        =
244               TABLES
245                 LINES                         = LTD_TLINE
246              EXCEPTIONS
247                ID                            = 1
248                LANGUAGE                      = 2
249                NAME                          = 3
250                NOT_FOUND                     = 4
251                OBJECT                        = 5
252                REFERENCE_CHECK               = 6
253                WRONG_ACCESS_TO_ARCHIVE       = 7
254                OTHERS                        = 8.
255             IF SY-SUBRC = 0.
256               LOOP AT LTD_TLINE INTO LTH_TLINE FROM 2.
257                 CONCATENATE ITAB-LGTXT  LTH_TLINE-TDLINE INTO ITAB-LGTXT.
258               ENDLOOP.
259             ENDIF.
260 
261 
262 
263             APPEND ITAB.
264             CLEAR IT_OPR_TAB.
265           ENDLOOP.
266           CLEAR : ITAB, IT_TSK_TAB.
267         ENDLOOP.
268 
269       ENDIF.
270     ENDIF.
271   ENDLOOP.
272 *- 释放不再使用内表
273   FREE : IT_MAKT, IT_MAPL, IT_PLKO.
274 
275 ENDFORM.                    " F_DEAL_DATA
276 *&---------------------------------------------------------------------*
277 *&      Form  F_FIELDCAT_BUILD
278 *&---------------------------------------------------------------------*
279 *       text
280 *----------------------------------------------------------------------*
281 *  -->  p1        text
282 *  <--  p2        text
283 *----------------------------------------------------------------------*
284 FORM F_FIELDCAT_BUILD .
285 *- ALV格式输出设置
286   GT_LAYOUT-ZEBRA = 'X'.
287 *  gt_layout-box_fieldname = 'SELKZ'.
288   GT_LAYOUT-DETAIL_POPUP = 'X'.
289   GT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
290   GT_LAYOUT-CELL_MERGE = 'X'.
291   GT_LAYOUT-DETAIL_INITIAL_LINES = 'X'.
292 
293 
294   IF CB_1 = 'X'.
295     PERFORM F_INPUT_FIELDCAT USING:   'MATNR'  '物料号'          'X' 18,
296                                     'MAKTX'  '物料描述'        '' 40,
297                                     "'VBELN'  '销售订单'  '',
298                                     "'POSNR'  '行项目'  '',
299                                     'WERKS'  '工厂'            '' 4,
300                                     'DATUV'  '有效起始日期'    SPACE 10,
301                                     'DATUB'  '有效截止日期'    SPACE 10,
302                                     "'PLNTY'  '任务清单类型'    SPACE,
303                                     'PLNNR'  '任务清单组码'    SPACE 8,
304                                     'PLNAL'  '组计数器'        SPACE 2,
305                                     'KTEXT'  '任务清单描述'    SPACE 40,
306                                     'VERWE'  '任务清单使用'    SPACE 3,
307                                     'STATU'  '状态'            SPACE 3,
308                                     "'BMSCH'  '基本数量'        SPACE,
309                                     "'MEINH'  '作业/工序的计量单位'  SPACE,
310                                    " 'VORNR'  '工序号'          SPACE,
311                                    " 'STEUS'  '控制码'          SPACE,
312                                    " 'WERKS_OP'  '工序工厂'     SPACE,
313                                    " 'ARBPL'  '工作中心'        SPACE,
314                                    " 'KTSCH'  '工序代码'       SPACE,
315                                    " 'LTXA1'  '工序短文本'      SPACE,
316                                    " 'LGTXT' '长文本' SPACE,
317                                     'VGW01'  '准备工时'        SPACE 12,
318                                     "'VGE01'  '人工工时单位'    SPACE,
319                                     'VGW02'  '人工工时'        SPACE 12,
320                                     "'VGE02'  '机器工时单位'    SPACE,
321                                     'VGW04'  '机器工时'        SPACE 12.
322     "'VGE03'  '检验工时单位'    SPACE.
323     "'VGW04'  '物料消耗'          SPACE,
324     "'VGE04'  '物料消耗单位'        SPACE.
325     "'VGW05'  '动力'        SPACE,
326     "'VGE05'  '动力单位'    SPACE,
327     "'VGW06'  '其他'        SPACE,
328     "'VGE06'  '其他单位'    SPACE.
329     " 'USR00'  '原定额'         SPACE,
330     " 'SPMUS'  '所需分解'        SPACE,
331     " 'UEMUS'  '要求重叠'        SPACE,
332     " 'MINWE'  '最小发送数量'    SPACE,
333     " 'CKSELKZ'  '成本核算相关'  SPACE,
334     " 'FRDLB'  '指示符:带外协加工的外部处理工序'  SPACE,
335     " 'INFNR'  '采购信息记录'    SPACE,
336     " 'EKORG'  '采购组织'        SPACE,
337     " 'MATKL'  '物料组'          SPACE,
338     " 'EKGRP'  '采购组'          SPACE,
339     " 'PEINH'  '价格单位'        SPACE,
340     " 'PREIS'  '净价'            SPACE,
341     " 'SAKTO'  '成本要素'        SPACE,
342     " 'WAERS'  '货币码'          SPACE.
343   ELSE.
344     PERFORM F_INPUT_FIELDCAT USING:   'MATNR'  '物料号'          'X' 18,
345                                       'MAKTX'  '物料描述'        '' 40,
346 *                                      'VBELN'  '销售订单'  '',
347 *                                      'POSNR'  '行项目'  '',
348                                       'WERKS'  '工厂'            '' 4,
349                                       'DATUV'  '有效起始日期'    SPACE 10,
350                                       'DATUB'  '有效截止日期'    SPACE 10,
351                                       'PLNTY'  '任务清单类型'    SPACE 1,
352                                       'PLNNR'  '任务清单组码'    SPACE 8,
353                                       'PLNAL'  '组计数器'        SPACE 2,
354                                       'KTEXT'  '任务清单描述'    SPACE 40,
355                                       'VERWE'  '任务清单使用'    SPACE 3,
356                                       'STATU'  '状态'            SPACE 3,
357                                       'BMSCH'  '基本数量'        SPACE 15,
358                                       'MEINH'  '作业/工序的计量单位'  SPACE 3,
359                                       'VORNR'  '工序号'          SPACE 4,
360                                       'STEUS'  '控制码'          SPACE 4,
361                                       'WERKS_OP'  '工序工厂'     SPACE 4,
362                                       'ARBPL'  '工作中心'        SPACE 8,
363                                       'KTSCH'  '工序代码'        SPACE 7,
364                                       'LTXA1'  '工序短文本'      SPACE 40,
365                                       'LGTXT' '长文本' SPACE 200,
366                                       'VGW01'  '准备工时'        SPACE 12,
367                                       'VGE01'  '准备工时单位'    SPACE 3,
368                                       'VGW02'  '人工工时'        SPACE 12,
369                                       'VGE02'  '人工工时单位'    SPACE 3,
370                                       'VGW03'  '间接人工'        SPACE 12,
371                                       'VGE03'  '间接人工单位'    SPACE 3,
372                                       'VGW04'  '机器工时'          SPACE 12,
373                                       'VGE04'  '机器工时进单位'        SPACE 3,
374                                       'VGW05'  '动力'        SPACE 12,
375                                       'VGE05'  '动力单位'    SPACE 3,
376                                       'VGW06'  '物料消耗'        SPACE 12,
377                                       'VGE06'  '物料消耗单位'    SPACE 3,
378 *                                      'USR00'  '原定额'         SPACE,
379                                       'ANZMA'  '雇员数'         SPACE 7,
380                                       'SPMUS'  '所需分解'        SPACE 1,
381                                       'SPLIM'  '分解数'         SPACE 3,
382                                       'UEMUS'  '要求重叠'        SPACE 1,
383                                       'MINWE'  '最小发送数量'    SPACE 15,
384                                       'CKSELKZ'  '成本核算相关'  SPACE 1,
385                                       'FRDLB'  '指示符:带外协加工的外部处理工序'  SPACE 1,
386                                       'INFNR'  '采购信息记录'    SPACE 10,
387                                       'EKORG'  '采购组织'        SPACE 4,
388                                       'MATKL'  '物料组'          SPACE 9,
389                                       'EKGRP'  '采购组'          SPACE 3,
390                                       'PEINH'  '价格单位'        SPACE 5,
391                                       'PREIS'  '净价'            SPACE 13,
392                                       'SAKTO'  '成本要素'        SPACE 10,
393                                       'WAERS'  '货币码'          SPACE 5.
394   ENDIF.
395 
396 ENDFORM.                    " F_FIELDCAT_BUILD
397 *&---------------------------------------------------------------------*
398 *&      Form  F_EVENTCAT_BUILD
399 *&---------------------------------------------------------------------*
400 *       text
401 *----------------------------------------------------------------------*
402 *  -->  p1        text
403 *  <--  p2        text
404 *----------------------------------------------------------------------*
405 FORM F_EVENTCAT_BUILD .
406 
407 ENDFORM.                    " F_EVENTCAT_BUILD
408 *&---------------------------------------------------------------------*
409 *&      Form  F_ALV_DISPLAY
410 *&---------------------------------------------------------------------*
411 *       text
412 *----------------------------------------------------------------------*
413 *  -->  p1        text
414 *  <--  p2        text
415 *----------------------------------------------------------------------*
416 FORM F_ALV_DISPLAY .
417   SORT ITAB BY MATNR WERKS PLNTY PLNNR PLNAL VORNR.
418 *- alv函数输出数据
419 
420   IF CB_1 = ''.
421     CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
422       EXPORTING
423         I_CALLBACK_PROGRAM       = SY-REPID
424 *      i_callback_pf_status_set = g_status_form
425 *      i_callback_user_command  = 'USER_COMMAND'    "g_command_form
426         IS_LAYOUT                = GT_LAYOUT
427         IT_FIELDCAT              = GT_FIELDCAT[]
428 *      it_events                = events[]
429         I_SAVE                   = 'A'
430       TABLES
431         T_OUTTAB                 = ITAB[]
432       EXCEPTIONS
433         PROGRAM_ERROR            = 1
434         OTHERS                   = 2.
435     IF SY-SUBRC <> 0.
436 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
437 *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
438     ENDIF.
439   ELSE.
440     CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
441     EXPORTING
442       I_CALLBACK_PROGRAM       = SY-REPID
443 *      i_callback_pf_status_set = g_status_form
444 *      i_callback_user_command  = 'USER_COMMAND'    "g_command_form
445       IS_LAYOUT                = GT_LAYOUT
446       IT_FIELDCAT              = GT_FIELDCAT[]
447 *      it_events                = events[]
448       I_SAVE                   = 'A'
449     TABLES
450       T_OUTTAB                 = ITAB_1[]
451     EXCEPTIONS
452       PROGRAM_ERROR            = 1
453       OTHERS                   = 2.
454     IF SY-SUBRC <> 0.
455 * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
456 *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
457     ENDIF.
458   ENDIF.
459 ENDFORM.                    " F_ALV_DISPLAY
460 *&---------------------------------------------------------------------*
461 *&      Form  F_INPUT_FIELDCAT
462 *&---------------------------------------------------------------------*
463 *       text
464 *----------------------------------------------------------------------*
465 FORM F_INPUT_FIELDCAT USING  VALUE(P_FIELD)
466                              VALUE(P_NAME)
467                              VALUE(P_KEY)
468                              VALUE(P_LEN).
469   DATA: ST_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
470 
471   ST_FIELDCAT-COL_POS     =   G_POS.
472   ST_FIELDCAT-TABNAME     =   'itab'.
473   ST_FIELDCAT-FIELDNAME   =   P_FIELD.
474   ST_FIELDCAT-SELTEXT_L   =   P_NAME.
475   ST_FIELDCAT-outputlen   =   P_LEN.
476   CASE P_FIELD.
477     WHEN 'WERKS' OR 'WERKS_OP' OR 'USR00'.
478 
479     WHEN OTHERS.
480       ST_FIELDCAT-NO_ZERO     =   'X'.
481   ENDCASE.
482   ST_FIELDCAT-KEY         =   P_KEY.
483   APPEND ST_FIELDCAT TO GT_FIELDCAT.
484   CLEAR ST_FIELDCAT.
485   G_POS = G_POS + 1.
486 ENDFORM.                    "F_INPUT_FIELDCAT
487 *&---------------------------------------------------------------------*
488 *&      Form  F_DOSUM_DATA
489 *&---------------------------------------------------------------------*
490 *       text
491 *----------------------------------------------------------------------*
492 *  -->  p1        text
493 *  <--  p2        text
494 *----------------------------------------------------------------------*
495 FORM F_DOSUM_DATA .
496 
497   CLEAR:ITAB_1,ITAB_1[].
498 
499   "是否删除前加工
500 *  IF CB_2 = 'X'.
501 *    DELETE ITAB WHERE KTSCH = '201001' OR KTSCH = '201006'.
502 *    DELETE ITAB WHERE PLNAL = '02'.
503 *  ENDIF.
504 *-----2012.11.27过滤天线栽线工序 如勾选则过滤 204001工序码
505 *  IF CB_3 = 'X'.
506 *    DELETE ITAB WHERE KTSCH = '204001' .
507 *    DELETE ITAB WHERE PLNAL = '02'.
508 *  ENDIF.
509   SORT ITAB BY MATNR.
510   LOOP AT ITAB.
511     MOVE-CORRESPONDING ITAB TO ITAB_1.
512     COLLECT ITAB_1.
513     CLEAR ITAB.
514   ENDLOOP.
515 
516 
517 ENDFORM.                    " F_DOSUM_DATA

 

ZPPR004:

 1 REPORT ZPPR004.
 2 *&---------------------------------------------------------------------*
 3 *& Report  ZPPR_QROUT01
 4 *&
 5 *&---------------------------------------------------------------------*
 6 *&
 7 *&
 8 *&---------------------------------------------------------------------*
 9 *&--------------------------------------------------------------------*
10 * Include
11 *&--------------------------------------------------------------------*
12 include ZPPRQROUT01TOP.
13 include ZPPRQROUT01S01.
14 include ZPPRQROUT01F01.
15 
16 *&---------------------------------------------------------------------*
17 * 2012.11.27增加报表开发需求信息维护按钮功能
18 *&---------------------------------------------------------------------*
19 "包含程序
20 *include ZABAP01.
21 "初始化事件
22 
23 *INITIALIZATION.
24   "工具栏添加信息标识图标
25 *  PERFORM SUB_INIT.
26   "计算使用次数
27 *  PERFORM SUB_USENO.
28   "屏幕检查事件
29 
30 *AT SELECTION-SCREEN.
31 *  CASE SSCRFIELDS-UCOMM.
32 *   WHEN 'FC01'.
33 *调用3000屏幕
34 *      CALL SCREEN 3000 STARTING AT 20 30 .
35 *    WHEN OTHERS.
36 *  ENDCASE.
37 
38 *  G_POS = 1.
39 
40 **---------------------------------------------------------------------*
41 ** Initialization                                                      *
42 **---------------------------------------------------------------------*
43 *INITIALIZATION.
44 *  G_POS = 1.
45 *---------------------------------------------------------------------*
46 * start of selection                                                  *
47 *---------------------------------------------------------------------*
48 START-OF-SELECTION.
49   PERFORM F_GET_DATA.
50   PERFORM F_DEAL_DATA.
51 ***-----
52   IF CB_1 = 'X'.
53     PERFORM F_DOSUM_DATA.
54 
55   ENDIF.
56 ***-----
57   PERFORM F_FIELDCAT_BUILD.
58   PERFORM F_EVENTCAT_BUILD.
59 
60   PERFORM F_ALV_DISPLAY.
61 
62 END-OF-SELECTION.
63 
64 *Text elements
65 *----------------------------------------------------------
66 * 002 显示方式
67 * T01 请选择运行条件
68 
69 
70 *Selection texts
71 *----------------------------------------------------------
72 * CB_1         工时汇总显示
73 * CB_2         过滤前加工
74 * CB_3         过滤天线栽线
75 * P_PLNTY         工艺类型
76 * P_WERKS         工厂
77 * S_ARBPL         工作中心
78 * S_DATUV         生效日期
79 * S_MATNR         物料编码
80 * S_MVGR1         物料组1
81 
82 
83 *Messages
84 *----------------------------------------------------------
85 *
86 * Message class: Hard coded
87 *   您无权限更改开发信息,只有ABAP工程师可修改!

 

上一篇:01背包


下一篇:【函数学习笔记】编写函数输出一个十进制整数的十六进制形式