***************************************************************** * System : XXXXXXXXX * Module : QM * Program ID : ZQMR001 * Program : IQC来料检验报表 * Author : XXXXXX * Date : 20160224 * Description : ***************************************************************** * Modified Recorder : * Date C#NO Author Content * ----------- ------- ------------------ --------------- * 修改日期 C票或变更文档ID 修改者 修改内容 REPORT ZQMR004. TABLES:QALS,MAKT,QASE,QAVE,QPCT,QMEL,QMFE,QAMR,MSEG. "structure define TYPES:BEGIN OF TY_SHOW, SEL(1), ENSTEHDAT TYPE QALS-ENSTEHDAT, WERK TYPE QALS-WERK, ART TYPE QALS-ART, LIFNR TYPE QALS-LIFNR, MATNR TYPE QALS-MATNR, KTEXTMAT TYPE QALS-KTEXTMAT, "检验对象的短文本 物料名称 WRKST TYPE MARA-WRKST, "基本物料 LOSMENGE TYPE QALS-LOSMENGE, "检验批数量 LMENGESCH TYPE QALS-LMENGESCH, "检验数量中的缺陷数量 GESSTICHPR TYPE QALS-GESSTICHPR, "采样大小 VCODE TYPE QAVE-VCODE, "使用决策代码 VTEXT TYPE QPCT-KURZTEXT, "使用决策代码文本 PRUEFER TYPE QASE-PRUEFER, "检验员 BLTXT(100) TYPE C, "不良描述 BLTYP(20) TYPE C, "不良分类 PRUEFLOS TYPE QALS-PRUEFLOS, " EBELN TYPE QALS-EBELN, " EKGRP TYPE EKKO-EKGRP, " EKNAM TYPE T024-EKNAM, " MJAHR TYPE QALS-MJAHR, " MBLNR TYPE QALS-MBLNR, " ZEILE TYPE QALS-ZEILE, " QMNUM TYPE QMEL-QMNUM, "通知编号 PZTXT(100) TYPE C, "品质异常处理结果 ARTPR TYPE QMEL-ARTPR, "优先级类型 PRIOK TYPE QMEL-PRIOK, "优先级PRIOK PRIOKX TYPE T356_T-PRIOKX, "优先级PRIOK SGTXT TYPE MSEG-SGTXT, "机型 KTEXTLOS TYPE QALS-KTEXTLOS, " VDATUM TYPE QAVE-VDATUM, "使用决定使用的代码日期 PLNTY TYPE QALS-PLNTY, PLNNR TYPE QALS-PLNNR, PLNAL TYPE QALS-PLNAL, ZAEHL TYPE QALS-ZAEHL, ZNUM(15) TYPE C, ZFEI(17) TYPE C, END OF TY_SHOW, BEGIN OF TY_QMEL, QMNUM TYPE QMEL-QMNUM, "通知编号 PRUEFLOS TYPE QALS-PRUEFLOS, " ARTPR TYPE QMEL-ARTPR, "优先级类型 PRIOK TYPE QMEL-PRIOK, "优先级PRIOK END OF TY_QMEL, BEGIN OF TY_QAVE, PRUEFLOS TYPE QAVE-PRUEFLOS, "检验批编号 VAUSWAHLMG TYPE QAVE-VAUSWAHLMG, "使用决定的选择集 ZAEHLER TYPE QAVE-ZAEHLER, VKATART TYPE QAVE-VKATART, VCODEGRP TYPE QAVE-VCODEGRP, "使用决定的代码组 VCODE TYPE QAVE-VCODE, "使用决定的代码组 VDATUM TYPE QAVE-VDATUM, "使用决定使用的代码日期 VERSIONAM TYPE QAVE-VERSIONAM, END OF TY_QAVE, BEGIN OF TY_QASE,"抽样结果 PRUEFLOS TYPE QASE-PRUEFLOS, "检验批编号 VORGLFNR TYPE QASE-VORGLFNR, "当前节点号码 MERKNR TYPE QASE-MERKNR, "检验特性编号 DETAILERG TYPE QASE-DETAILERG, "单个结果编号 PRUEFER TYPE QASE-PRUEFER, "检验员姓名 MBEWERTG TYPE QASE-MBEWERTG, "检验结果评估(A 已接受的 R 拒收的 F 失败) PRUEFBEMKT TYPE QASE-PRUEFBEMKT, "短文本 PRLTEXTKZ TYPE QASE-PRLTEXTKZ, "检验特性长文本存在 ORIGINAL TYPE QASE-ORIGINAL_INPUT, "记录的检验结果(抽样) END OF TY_QASE, BEGIN OF TY_QAMR,"单个抽样结果 PRUEFLOS TYPE QAMR-PRUEFLOS, "检验批编号 VORGLFNR TYPE QAMR-VORGLFNR, "当前节点号码 MERKNR TYPE QAMR-MERKNR, "检验特性编号 SATZSTATUS TYPE QAMR-SATZSTATUS, "结果记录状态 5 KATALGART1 TYPE QAMR-KATALGART1, "结果记录状态 5 GRUPPE1 TYPE QAMR-GRUPPE1, "结果记录状态 5 CODE1 TYPE QAMR-CODE1, "结果记录状态 5 VERSION1 TYPE QAMR-VERSION1, "结果记录状态 5 PRUEFER TYPE QAMR-PRUEFER, "检验员姓名 MBEWERTG TYPE QAMR-MBEWERTG, "检验结果评估 PRUEFBEMKT TYPE QAMR-PRUEFBEMKT, "短文本 PRLTEXTKZ TYPE QAMR-PRLTEXTKZ, "检验特性长文本存在 ORIGINAL TYPE QAMR-ORIGINAL_INPUT, ""记录的检验结果(单检) END OF TY_QAMR, BEGIN OF TY_QAMV, PRUEFLOS TYPE QAMV-PRUEFLOS, "检验批编号 VORGLFNR TYPE QAMV-VORGLFNR, "订单计数器 APLZL 的当前节点号码 MERKNR TYPE QAMV-MERKNR, "检验特性编号 KATAB1 TYPE QAMV-KATAB1, "目录条目是一个选择集 KATALGART1 TYPE QAMV-KATALGART1, "分配的代码组或选择集的目录类型 AUSWMENGE1 TYPE QAMV-AUSWMENGE1, "分配的代码组或选择集 AUSWMGWRK1 TYPE QAMV-AUSWMGWRK1, "分配的选择集的工厂 TOLERANZUN TYPE QAMV-TOLERANZUN, "容差下限 TOLERANZOB TYPE QAMV-TOLERANZOB, "规范上限 KURZTEXT TYPE QAMV-KURZTEXT, "检验特性的短文本 VERWMERKM TYPE QAMV-VERWMERKM, "检验特性 STICHPRVER TYPE QAMV-STICHPRVER, "检验特性中的采样程序 DUMMY40 TYPE QAMV-DUMMY40, "检验特性中的采样程序 END OF TY_QAMV, BEGIN OF TY_PLMK, PLNTY TYPE PLMK-PLNTY, PLNNR TYPE PLMK-PLNNR, PLNKN TYPE PLMK-PLNKN, KZEINSTELL TYPE PLMK-KZEINSTELL, MERKNR TYPE PLMK-MERKNR, ZAEHL TYPE PLMK-ZAEHL, PMETHODE TYPE PLMK-PMETHODE, END OF TY_PLMK, BEGIN OF TY_QMFE,"质量通知->缺陷记录 QMNUM TYPE QMFE-QMNUM, "通知编号 FENUM TYPE QMFE-FENUM, "项目记录中的项目号 FEKAT TYPE QMFE-FEKAT, "目录类型 - 问题/缺陷 FEGRP TYPE QMFE-FEGRP, "代码组 - 问题 FECOD TYPE QMFE-FECOD, "问题或损坏代码 FEQKLAS TYPE QMFE-FEQKLAS, "缺陷类别 END OF TY_QMFE. DATA:GT_SHOW TYPE TABLE OF TY_SHOW, GT_QAVE TYPE TABLE OF TY_QAVE, GT_QASE TYPE TABLE OF TY_QASE, GT_QPAM TYPE TABLE OF QPAM, GS_QPAM LIKE LINE OF GT_QPAM, GT_PLAS TYPE TABLE OF PLAS, GS_PLAS LIKE LINE OF GT_PLAS, GT_QDSVT TYPE TABLE OF QDSVT, GS_QDSVT TYPE QDSVT, GT_PLMK TYPE TABLE OF TY_PLMK, GS_PLMK LIKE LINE OF GT_PLMK, GT_QAMV TYPE TABLE OF TY_QAMV, GT_QAMV_DX TYPE TABLE OF TY_QAMV, GS_QAMV LIKE LINE OF GT_QAMV, GT_QAMR TYPE TABLE OF TY_QAMR, GT_QAMR_DX TYPE TABLE OF TY_QAMR, GT_QMEL TYPE TABLE OF TY_QMEL, GT_QMFE TYPE TABLE OF TY_QMFE. DATA:LT_SHOW TYPE TABLE OF TY_SHOW. DATA:GT_QPCT TYPE TABLE OF QPCT WITH HEADER LINE. DATA:GT_FIELDCAT TYPE LVC_T_FCAT. DATA:GW_SHOW LIKE LINE OF GT_SHOW, GW_QAVE LIKE LINE OF GT_QAVE, GW_QASE LIKE LINE OF GT_QASE, GW_QAMR LIKE LINE OF GT_QAMR, GW_QMEL LIKE LINE OF GT_QMEL, GW_QMFE LIKE LINE OF GT_QMFE. DATA GS_FIELDCAT LIKE LINE OF GT_FIELDCAT. DATA LS_LAYOUT TYPE LVC_S_LAYO. "define DEFINE APPEND_FIELDCAT . clear gs_fieldcat. gs_fieldcat-fieldname = &1. gs_fieldcat-scrtext_l = &2. gs_fieldcat-outputlen = &3. gs_fieldcat-no_zero = &4. append gs_fieldcat to gt_fieldcat. END-OF-DEFINITION. SELECTION-SCREEN:BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-001. PARAMETERS:P_WERKS TYPE QALS-WERK OBLIGATORY, P_ART TYPE QALS-ART NO-DISPLAY DEFAULT '01'. SELECT-OPTIONS:S_MATNR FOR QALS-MATNR, S_MAKTX FOR MAKT-MAKTX, S_LIFNR FOR QALS-LIFNR, S_PRLOT FOR QALS-PRUEFLOS, S_ENDAT FOR QALS-ENSTEHDAT, S_PRDAT FOR QALS-PASTRTERM, S_EBELN FOR QALS-EBELN, S_MBLNR FOR QALS-MBLNR, S_PRUER FOR QASE-PRUEFER NO-DISPLAY, S_VDATUM FOR QAVE-VDATUM,"UD日期 S_VCODE FOR QAVE-VCODE MATCHCODE OBJECT ZSHVCODE. "使用决策代码. SELECTION-SCREEN END OF BLOCK BLK01. INITIALIZATION. P_ART = '01'. START-OF-SELECTION. AUTHORITY-CHECK OBJECT 'Q_INSPTYPE' ID 'WERKS' FIELD P_WERKS. IF SY-SUBRC <> 0. MESSAGE '没有该工厂的查询权限!' TYPE 'S' DISPLAY LIKE 'E'. LEAVE LIST-PROCESSING. ENDIF. PERFORM PRM_GET_MAIN."查询QALS等相关主要数据 PERFORM PRM_GET_DETAIL."检验批的结果,不良描述, PERFORM PRM_GET_QMFE."缺陷代码 PERFORM PRM_PROCESS. PERFORM PRM_SET_FIELD. PERFORM PRM_SHOW_DATA. *&---------------------------------------------------------------------* *& Form PRM_GET_MAIN *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PRM_GET_MAIN . SELECT A~ENSTEHDAT A~WERK A~ART A~LIFNR A~MATNR A~KTEXTMAT "检验对象的短文本 物料名称 E~WRKST A~LOSMENGE "检验批数量 A~LMENGESCH "检验数量中的缺陷数量 A~GESSTICHPR B~VCODE" TYPE qave-vcode, "使用决策代码 D~KURZTEXT AS VTEXT " TYPE qpct-kurztext, "使用决策代码文本 * pruefer TYPE qase-pruefer, "检验员 * bltxt(100) TYPE c, "不良描述 * bltyp(20) TYPE c, "不良分类 A~PRUEFLOS" TYPE qals-prueflos, " A~EBELN " TYPE qals-ebeln, " A~MJAHR A~MBLNR " TYPE qals-mblnr, " A~ZEILE * c~qmnum " TYPE qmel-qmnum, "通知编号 ** pztxt(100) TYPE c, "品质异常处理结果 * c~artpr " TYPE qmel-artpr, "优先级类型 * c~priok " TYPE qmel-priok, "优先级 A~KTEXTLOS A~PLNTY" TYPE qals-plnty, A~PLNNR " TYPE qals-plnnr, A~PLNAL " TYPE qals-plnal, A~ZAEHL " TYPE qals-zaehl, B~VDATUM INTO CORRESPONDING FIELDS OF TABLE GT_SHOW FROM QALS AS A INNER JOIN QAVE AS B ON A~PRUEFLOS = B~PRUEFLOS AND A~WERK = B~VWERKS AND B~VKATART = '3' AND B~VCODEGRP = 'ZY' * INNER JOIN qmel AS c * ON a~prueflos = c~prueflos INNER JOIN QPCT AS D ON D~CODE = B~VCODE AND D~KATALOGART = '3' AND D~CODEGRUPPE = 'ZY' AND D~SPRACHE = '1' LEFT JOIN MARA AS E ON A~MATNR = E~MATNR WHERE A~PRUEFLOS IN S_PRLOT AND A~WERK = P_WERKS AND A~ART = P_ART AND A~STAT35 = 'X' AND A~MATNR IN S_MATNR AND A~KTEXTMAT IN S_MAKTX AND A~LIFNR IN S_LIFNR AND A~ENSTEHDAT IN S_ENDAT AND A~PASTRTERM IN S_PRDAT AND A~EBELN IN S_EBELN AND A~MBLNR IN S_MBLNR AND B~VCODE IN S_VCODE AND B~VDATUM IN S_VDATUM. ENDFORM. *&---------------------------------------------------------------------* *& Form PRM_GET_DETAIL *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PRM_GET_DETAIL . * DATA:VT_SHOW TYPE TABLE OF TY_SHOW. * * APPEND LINES OF GT_SHOW TO VT_SHOW. * SORT VT_SHOW[] BY PLNTY PLNNR PLNAL. * DELETE ADJACENT DUPLICATES FROM VT_SHOW[] COMPARING PLNTY PLNNR PLNAL. * IF VT_SHOW[] IS NOT INITIAL."检验计划 * SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_PLAS * FROM PLAS * FOR ALL ENTRIES IN GT_SHOW * WHERE PLNTY = GT_SHOW-PLNTY * AND PLNNR = GT_SHOW-PLNNR * AND PLNAL = GT_SHOW-PLNAL. * * IF GT_PLAS[] IS NOT INITIAL. * SELECT * PLNTY * PLNNR * PLNKN * KZEINSTELL * MERKNR * ZAEHL * PMETHODE * INTO CORRESPONDING FIELDS OF TABLE GT_PLMK * FROM PLMK * FOR ALL ENTRIES IN GT_PLAS * WHERE PLNTY = GT_PLAS-PLNTY * AND PLNNR = GT_PLAS-PLNNR * AND PLNKN = GT_PLAS-PLNKN * AND LOEKZ = ''. * ENDIF. * * CLEAR:VT_SHOW[]. * ENDIF. IF GT_SHOW[] IS NOT INITIAL. "GET 检验处理的特性说明 SELECT PRUEFLOS"检验批编号 VORGLFNR "订单计数器 APLZL 的当前节点号码 MERKNR "检验特性编号 KATAB1 "目录条目是一个选择集 KATALGART1"分配的代码组或选择集的目录类型 AUSWMENGE1"分配的代码组或选择集 AUSWMGWRK1 "分配的选择集的工厂 TOLERANZUN "容差下限 TOLERANZOB "规范上限 KURZTEXT "检验特性的短文本 VERWMERKM STICHPRVER DUMMY40 INTO CORRESPONDING FIELDS OF TABLE GT_QAMV FROM QAMV FOR ALL ENTRIES IN GT_SHOW WHERE PRUEFLOS = GT_SHOW-PRUEFLOS. SELECT PRUEFLOS " TYPE qase-prueflos, "检验批编号 VORGLFNR " TYPE qase-vorglfnr, "当前节点号码 MERKNR " TYPE qase-merknr, "检验特性编号 DETAILERG " TYPE qase-detailerg, "单个结果编号 PRUEFER MBEWERTG " TYPE qase-mbewertg, "检验结果评估(A 已接受的 R 拒收的 F 失败) PRUEFBEMKT" TYPE qase-pruefbemkt, "短文本 PRLTEXTKZ " TYPE qase-prltextkz, "检验特性长文本存在 ORIGINAL_INPUT AS ORIGINAL " TYPE qase-original_input, "记录的检验结果(抽样) INTO CORRESPONDING FIELDS OF TABLE GT_QASE FROM QASE FOR ALL ENTRIES IN GT_SHOW WHERE PRUEFLOS = GT_SHOW-PRUEFLOS AND PRUEFER IN S_PRUER. * "GET 检验处理的特性说明 定性 APPEND LINES OF GT_QAMV TO GT_QAMV_DX. DELETE GT_QAMV_DX WHERE AUSWMENGE1 IS INITIAL. IF GT_QAMV_DX[] IS NOT INITIAL. SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_QPAM FROM QPAM FOR ALL ENTRIES IN GT_QAMV_DX WHERE WERKS = GT_QAMV_DX-AUSWMGWRK1 AND KATALOGART = GT_QAMV_DX-KATALGART1 AND AUSWAHLMGE = GT_QAMV_DX-AUSWMENGE1. CLEAR:GT_QAMV_DX[]. ENDIF. SELECT PRUEFLOS " TYPE qamr-prueflos, "检验批编号 VORGLFNR " TYPE qamr-vorglfnr, "当前节点号码 MERKNR " TYPE qamr-merknr, "检验特性编号 PRUEFER SATZSTATUS" TYPE qamr-satzstatus, "结果记录状态 5 KATALGART1" TYPE QAMR-KATALGART1, "结果记录状态 5 GRUPPE1" TYPE QAMR-GRUPPE1, "结果记录状态 5 CODE1 " TYPE QAMR-CODE1, "结果记录状态 5 VERSION1 " TYPE QAMR-VERSION1, "结果记录状态 5 MBEWERTG " TYPE qamr-mbewertg, "检验结果评估 PRUEFBEMKT" TYPE qamr-pruefbemkt, "短文本 PRLTEXTKZ "TYPE qamr-prltextkz, "检验特性长文本存在 ORIGINAL_INPUT AS ORIGINAL "TYPE qamr-original_input, ""记录的检验结果(单检) INTO CORRESPONDING FIELDS OF TABLE GT_QAMR FROM QAMR FOR ALL ENTRIES IN GT_SHOW WHERE PRUEFLOS = GT_SHOW-PRUEFLOS AND PRUEFER IN S_PRUER. "处理定性的检验结果文本 APPEND LINES OF GT_QAMR TO GT_QAMR_DX. DELETE GT_QAMR_DX WHERE KATALGART1 IS INITIAL. IF GT_QAMR_DX[] IS NOT INITIAL. SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_QPCT FROM QPCT FOR ALL ENTRIES IN GT_QAMR_DX WHERE KATALOGART = GT_QAMR_DX-KATALGART1 AND CODEGRUPPE = GT_QAMR_DX-GRUPPE1 AND CODE = GT_QAMR_DX-CODE1 AND SPRACHE = '1' AND VERSION = GT_QAMR_DX-VERSION1. CLEAR:GT_QAMR_DX[]. ENDIF. * SELECT QMNUM " TYPE qmel-qmnum, "通知编号 * PRUEFLOS "TYPE qals-prueflos, " * ARTPR "TYPE qmel-artpr, "优先级类型 * PRIOK "TYPE qmel-priok, "优先级PRIOK * INTO CORRESPONDING FIELDS OF TABLE GT_QMEL * FROM QMEL * FOR ALL ENTRIES IN GT_SHOW * WHERE PRUEFLOS = GT_SHOW-PRUEFLOS * AND KZLOESCH = ''. "************************************************QAVE SELECT PRUEFLOS KZART ZAEHLER VKATART VCODEGRP VCODE VERSIONAM INTO CORRESPONDING FIELDS OF TABLE GT_QAVE FROM QAVE FOR ALL ENTRIES IN GT_SHOW WHERE PRUEFLOS = GT_SHOW-PRUEFLOS. IF GT_QAVE[] IS NOT INITIAL. SELECT * APPENDING CORRESPONDING FIELDS OF TABLE GT_QPCT FROM QPCT FOR ALL ENTRIES IN GT_QAVE WHERE KATALOGART = GT_QAVE-VKATART AND CODEGRUPPE = GT_QAVE-VCODEGRP AND CODE = GT_QAVE-VCODE AND SPRACHE = '1' AND VERSION = GT_QAVE-VERSIONAM. ENDIF. SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_QDSVT FROM QDSVT WHERE SPRACHE = '1'. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form PRM_GET_QMFE *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PRM_GET_QMFE . * IF GT_QMEL[] IS NOT INITIAL. * SELECT QMNUM" TYPE qmfe-qmnum, "通知编号 * FENUM " TYPE qmfe-fenum, "项目记录中的项目号 * FEKAT " TYPE qmfe-fekat, "目录类型 - 问题/缺陷 * FEGRP" TYPE qmfe-fegrp, "代码组 - 问题 * FECOD " TYPE qmfe-fecod, "问题或损坏代码 * FEQKLAS" TYPE qmfe-feqklas, "缺陷类别 * INTO CORRESPONDING FIELDS OF TABLE GT_QMFE * FROM QMFE * FOR ALL ENTRIES IN GT_QMEL * WHERE QMNUM = GT_QMEL-QMNUM * AND KZLOESCH = ''. * ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form PRM_PROCESS *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PRM_PROCESS . DATA:LV_NAME TYPE THEAD-TDNAME, LT_TLINE TYPE TABLE OF TLINE, LS_TLINE LIKE LINE OF LT_TLINE. DATA:LV_FLAG TYPE C. DATA:LS_NAME TYPE ADRP-NAME_TEXT. SORT GT_QMFE[] BY QMNUM FEQKLAS FEGRP. DELETE ADJACENT DUPLICATES FROM GT_QMFE[] COMPARING QMNUM FEQKLAS FEGRP. LOOP AT GT_SHOW INTO GW_SHOW. "不良描述,检验员姓名 抽检 LOOP AT GT_QASE INTO GW_QASE WHERE PRUEFLOS = GW_SHOW-PRUEFLOS. CLEAR:LS_NAME. "get neme of the IF GW_QASE-PRUEFER IS NOT INITIAL AND GW_SHOW-PRUEFER IS INITIAL. SELECT SINGLE NAME_TEXT INTO LS_NAME FROM ADRP INNER JOIN USR21 ON ADRP~PERSNUMBER = USR21~PERSNUMBER WHERE USR21~BNAME = GW_QASE-PRUEFER. GW_SHOW-PRUEFER = LS_NAME. ENDIF. * SEARCH gw_show-pruefer FOR ls_name. * IF sy-subrc = 0. * ELSE. * CONCATENATE gw_show-pruefer ls_name INTO gw_show-pruefer SEPARATED BY '/'. * ENDIF. * gw_show-pruefer = gw_qase-pruefer. IF GW_QASE-PRLTEXTKZ = 'X'. REFRESH:LT_TLINE. CONCATENATE GW_QASE-PRUEFLOS GW_QASE-VORGLFNR GW_QASE-MERKNR GW_QASE-DETAILERG INTO LV_NAME. CALL FUNCTION 'READ_TEXT' EXPORTING ID = 'QMEP' LANGUAGE = '1' NAME = LV_NAME OBJECT = 'QEEMERKMAL' TABLES LINES = LT_TLINE EXCEPTIONS ID = 1 LANGUAGE = 2 NAME = 3 NOT_FOUND = 4 OBJECT = 5 REFERENCE_CHECK = 6 WRONG_ACCESS_TO_ARCHIVE = 7 OTHERS = 8. IF SY-SUBRC <> 0. ENDIF. LOOP AT LT_TLINE INTO LS_TLINE. CONCATENATE GW_SHOW-BLTXT LS_TLINE-TDLINE INTO GW_SHOW-BLTXT. ENDLOOP. ELSE. * gw_show-bltxt = gw_qase-pruefbemkt. IF GW_QASE-PRUEFBEMKT <> ''. CONCATENATE GW_SHOW-BLTXT GW_QASE-PRUEFBEMKT INTO GW_SHOW-BLTXT SEPARATED BY '/'. ENDIF. ENDIF. ENDLOOP. "不良描述,检验员姓名 单检 LOOP AT GT_QAMR INTO GW_QAMR WHERE PRUEFLOS = GW_SHOW-PRUEFLOS. CLEAR:LS_NAME. "get neme of the IF GW_QAMR-PRUEFER IS NOT INITIAL AND GW_SHOW-PRUEFER IS INITIAL. SELECT SINGLE NAME_TEXT INTO LS_NAME FROM ADRP INNER JOIN USR21 ON ADRP~PERSNUMBER = USR21~PERSNUMBER WHERE USR21~BNAME = GW_QAMR-PRUEFER. GW_SHOW-PRUEFER = LS_NAME. ENDIF. * gw_show-pruefer = gw_qamr-pruefer. * SEARCH gw_show-pruefer FOR ls_name. ** SEARCH gw_show-pruefer FOR gw_qamr-pruefer. * IF sy-subrc = 0. * ELSE. * CONCATENATE gw_show-pruefer ls_name INTO gw_show-pruefer SEPARATED BY '/'. * ENDIF. IF GW_QAMR-PRLTEXTKZ = 'X'. REFRESH:LT_TLINE. CONCATENATE GW_QAMR-PRUEFLOS GW_QAMR-VORGLFNR GW_QAMR-MERKNR INTO LV_NAME. CALL FUNCTION 'READ_TEXT' EXPORTING ID = 'QMEP' LANGUAGE = '1' NAME = LV_NAME OBJECT = 'QEEMERKMAL' TABLES LINES = LT_TLINE EXCEPTIONS ID = 1 LANGUAGE = 2 NAME = 3 NOT_FOUND = 4 OBJECT = 5 REFERENCE_CHECK = 6 WRONG_ACCESS_TO_ARCHIVE = 7 OTHERS = 8. IF SY-SUBRC <> 0. ENDIF. LOOP AT LT_TLINE INTO LS_TLINE. CONCATENATE GW_SHOW-BLTXT LS_TLINE-TDLINE INTO GW_SHOW-BLTXT SEPARATED BY ';'. ENDLOOP. ELSE. * gw_show-bltxt = gw_qamr-pruefbemkt. IF GW_QAMR-PRUEFBEMKT <> ''. CONCATENATE GW_SHOW-BLTXT GW_QAMR-PRUEFBEMKT INTO GW_SHOW-BLTXT SEPARATED BY ';'. ENDIF. ENDIF. ENDLOOP. * READ TABLE GT_QMEL INTO GW_QMEL WITH KEY PRUEFLOS = GW_SHOW-PRUEFLOS. * IF SY-SUBRC = 0. * GW_SHOW-QMNUM = GW_QMEL-QMNUM. * GW_SHOW-ARTPR = GW_QMEL-ARTPR. * GW_SHOW-PRIOK = GW_QMEL-PRIOK. * ENDIF. "不良分类 * CLEAR:LV_FLAG. * LOOP AT GT_QMFE INTO GW_QMFE WHERE QMNUM = GW_SHOW-QMNUM. ** IF lv_flag = 'X'. ** ELSE. * IF GW_QMFE-FEQKLAS = '01' AND GW_SHOW-WERK = '1010'. * LV_FLAG = 'X'. * SEARCH GW_SHOW-BLTYP FOR GW_QMFE-FEGRP. * IF SY-SUBRC = 0. * ELSE. * CONCATENATE GW_SHOW-BLTYP GW_QMFE-FEGRP INTO GW_SHOW-BLTYP SEPARATED BY '/'. * ENDIF. ** gw_show-bltyp = gw_qmfe-fegrp. * ELSE. * IF LV_FLAG <> 'X'. * SEARCH GW_SHOW-BLTYP FOR GW_QMFE-FEGRP. * IF SY-SUBRC = 0. * ELSE. * CONCATENATE GW_SHOW-BLTYP GW_QMFE-FEGRP INTO GW_SHOW-BLTYP SEPARATED BY '/'. * ENDIF. * ENDIF. * ENDIF. ** ENDIF. * ENDLOOP. * "品质异常处理结果 * IF GW_SHOW-QMNUM IS NOT INITIAL. * REFRESH:LT_TLINE. * LV_NAME = GW_SHOW-QMNUM. * CALL FUNCTION 'READ_TEXT' * EXPORTING * ID = 'LTQM' * LANGUAGE = '1' * NAME = LV_NAME * OBJECT = 'QMEL' * TABLES * LINES = LT_TLINE * EXCEPTIONS * ID = 1 * LANGUAGE = 2 * NAME = 3 * NOT_FOUND = 4 * OBJECT = 5 * REFERENCE_CHECK = 6 * WRONG_ACCESS_TO_ARCHIVE = 7 * OTHERS = 8. * IF SY-SUBRC <> 0. * ENDIF. * LOOP AT LT_TLINE INTO LS_TLINE. * CONCATENATE GW_SHOW-PZTXT LS_TLINE-TDLINE INTO GW_SHOW-PZTXT. * ENDLOOP. * ENDIF. * "处理进度 优先级 * IF GW_SHOW-PRIOK IS NOT INITIAL. * SELECT SINGLE PRIOKX INTO GW_SHOW-PRIOKX * FROM T356_T * WHERE SPRAS = '1' * AND ARTPR = 'QM' * AND PRIOK = GW_SHOW-PRIOK. * ENDIF. "采购组 * IF GW_SHOW-EBELN IS NOT INITIAL. * SELECT SINGLE A~EKGRP B~EKNAM INTO (GW_SHOW-EKGRP,GW_SHOW-EKNAM) * FROM EKKO AS A * INNER JOIN T024 AS B * ON A~EKGRP = B~EKGRP * WHERE A~EBELN = GW_SHOW-EBELN. * ENDIF. * * IF GW_SHOW-MBLNR IS NOT INITIAL. * SELECT SINGLE SGTXT INTO GW_SHOW-SGTXT * FROM MSEG * WHERE MBLNR = GW_SHOW-MBLNR * AND MJAHR = GW_SHOW-MJAHR * AND ZEILE = GW_SHOW-ZEILE. * ENDIF. IF GW_SHOW-WERK = '1010'. SEARCH GW_SHOW-KTEXTLOS FOR '&'. IF SY-SUBRC = 0. SPLIT GW_SHOW-KTEXTLOS AT '&' INTO GW_SHOW-ZNUM GW_SHOW-ZFEI. ENDIF. ENDIF. MODIFY GT_SHOW FROM GW_SHOW. ENDLOOP. ENDFORM. *&---------------------------------------------------------------------* *& Form PRM_SET_FIELD *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PRM_SET_FIELD . LS_LAYOUT-CWIDTH_OPT = 'X'. "优化列宽选项是否设置 LS_LAYOUT-ZEBRA = 'X'. LS_LAYOUT-BOX_FNAME = 'SEL'. APPEND_FIELDCAT:'VDATUM' 'UD代码日期' 10 '', 'WERK' '工厂' 4 '', 'ART' '检验类型' 8 '', 'LIFNR' '供应商代号' 10 'X', * 'EKNAM' '采购组' 10 'X', 'MATNR' '物料' 18 'X', 'KTEXTMAT' '物料描述' 40 '', 'LOSMENGE' '检验批数量' 17 '', 'LMENGESCH' '不合格数量' 17 '', 'GESSTICHPR' '采样大小' 17 '', 'VCODE' '使用决策代码' 4 '', 'VTEXT' '使用决策文本' 40 '', 'PRUEFER' '检验员' 12 '', 'BLTXT' '备注不良描述' 100 '', * 'BLTYP' '不良分类' 20 '', 'PRUEFLOS' '检验批号' 12 'X', 'EBELN' '采购凭证' 10 'X', 'MBLNR' '物料凭证' 10 'X', * 'SGTXT' '机型' 50 '', * 'QMNUM' '通知单编号' 12 'X', * 'PZTXT' '品质异常处理结果' 100 '', * 'PRIOKX' '处理进度' 20 '', * 'ZNUM' '不合格报告编号' 20 'X', 'ZFEI' '复检工时费用' 20 ''. ENDFORM. *&---------------------------------------------------------------------* *& Form PRM_SHOW_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM PRM_SHOW_DATA . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING I_CALLBACK_PROGRAM = SY-REPID IS_LAYOUT_LVC = LS_LAYOUT IT_FIELDCAT_LVC = GT_FIELDCAT[] I_CALLBACK_PF_STATUS_SET = 'FRM_SET_PF_STATUS' I_CALLBACK_USER_COMMAND = 'USER_COMMAND' * i_grid_title = lv_title I_DEFAULT = 'X' I_SAVE = 'A' TABLES T_OUTTAB = GT_SHOW[] EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. IF SY-SUBRC <> 0. ENDIF. ENDFORM. FORM FRM_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB. SET PF-STATUS 'ZQMR004'. ENDFORM. FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM P_SELFIELD TYPE SLIS_SELFIELD. DATA:GT_ZQMR004H TYPE TABLE OF ZQMR004H, GW_ZQMR004H TYPE ZQMR004H, GT_ZQMR004I TYPE TABLE OF ZQMR004I, GW_ZQMR004I TYPE ZQMR004I, GS_ZQMR004I TYPE ZQMR004I. "结果行,单独处理 DATA:LV_INDEX TYPE I. DATA:LV_INDEX_LINE TYPE I. DATA:LV_INDEX_LINE2 TYPE I. DATA:LV_JG(2) TYPE C. DATA:LV_FNAME TYPE RS38L_FNAM. DATA:LV_SFNAME TYPE TDSFNAME VALUE 'ZQMR004'. DATA:LS_CONTROL TYPE SSFCTRLOP. DATA:LV_P(4) TYPE P DECIMALS 1. CHECK P_UCOMM EQ 'PRNT'. "打印控制参数 LS_CONTROL-NO_OPEN = 'X'. LS_CONTROL-NO_CLOSE = 'X'. "获取打印函数 CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING FORMNAME = LV_SFNAME IMPORTING FM_NAME = LV_FNAME EXCEPTIONS NO_FORM = 1 NO_FUNCTION_MODULE = 2 OTHERS = 3. IF SY-SUBRC <> 0. ENDIF. CALL FUNCTION 'SSF_OPEN'. IF SY-SUBRC <> 0. ENDIF. SORT GT_QAMV[] BY PRUEFLOS. SORT GT_QASE[] BY PRUEFLOS VORGLFNR MERKNR. SORT GT_QAMR[] BY PRUEFLOS VORGLFNR MERKNR. LOOP AT GT_SHOW INTO GW_SHOW WHERE SEL = 'X'. REFRESH:GT_ZQMR004I. CLEAR:GW_ZQMR004H,GW_ZQMR004I."head item GW_ZQMR004H-PRUEFLOS = GW_SHOW-PRUEFLOS. GW_ZQMR004H-WERKS = GW_SHOW-WERK. GW_ZQMR004H-KTEXTMAT = GW_SHOW-KTEXTMAT. GW_ZQMR004H-LIFNR = GW_SHOW-LIFNR. GW_ZQMR004H-MBLNR = GW_SHOW-MBLNR. GW_ZQMR004H-VDATUM = GW_SHOW-VDATUM. GW_ZQMR004H-LOSMENGE = GW_SHOW-LOSMENGE. GW_ZQMR004H-GESSTICHPR = GW_SHOW-GESSTICHPR. GW_ZQMR004H-ZJCJG = GW_SHOW-VTEXT. GW_ZQMR004H-PRUEFER = GW_SHOW-PRUEFER. GW_ZQMR004H-ZBZ = GW_SHOW-BLTXT. CONCATENATE GW_SHOW-KTEXTMAT GW_SHOW-WRKST INTO GW_ZQMR004H-ZBCMS. SEARCH GW_ZQMR004H-ZBCMS FOR ','. IF SY-SUBRC = 0. SPLIT GW_ZQMR004H-ZBCMS AT ',' INTO GW_ZQMR004H-KTEXTMAT GW_ZQMR004H-ZBCMS. ELSE. SEARCH GW_ZQMR004H-ZBCMS FOR ','. IF SY-SUBRC = 0. SPLIT GW_ZQMR004H-ZBCMS AT ',' INTO GW_ZQMR004H-KTEXTMAT GW_ZQMR004H-ZBCMS. ENDIF. ENDIF. READ TABLE GT_QAMV INTO GS_QAMV WITH KEY PRUEFLOS = GW_SHOW-PRUEFLOS BINARY SEARCH. IF SY-SUBRC = 0. LV_INDEX_LINE = SY-TABIX. ELSE. CONTINUE. ENDIF. CLEAR:LV_INDEX_LINE. LOOP AT GT_QAMV INTO GS_QAMV FROM LV_INDEX_LINE WHERE PRUEFLOS = GW_SHOW-PRUEFLOS. READ TABLE GT_QDSVT INTO GS_QDSVT WITH KEY STICHPRVER = GS_QAMV-STICHPRVER. IF SY-SUBRC = 0. GW_ZQMR004H-ZCYSZ = GS_QDSVT-KURZTEXT. ENDIF. "line item GW_ZQMR004I-PRUEFLOS = GW_SHOW-PRUEFLOS. GW_ZQMR004I-MERKNR = GS_QAMV-MERKNR. GW_ZQMR004I-KURZTEXT = GS_QAMV-KURZTEXT. GW_ZQMR004I-KURZTEXT2 = GS_QAMV-DUMMY40. CLEAR:LV_INDEX,LV_INDEX_LINE2. READ TABLE GT_QASE INTO GW_QASE WITH KEY PRUEFLOS = GS_QAMV-PRUEFLOS VORGLFNR = GS_QAMV-VORGLFNR MERKNR = GS_QAMV-MERKNR BINARY SEARCH. IF SY-SUBRC = 0. LV_INDEX_LINE2 = SY-TABIX. * ELSE. * CONTINUE. ENDIF. LOOP AT GT_QASE INTO GW_QASE FROM LV_INDEX_LINE2 WHERE PRUEFLOS = GS_QAMV-PRUEFLOS AND VORGLFNR = GS_QAMV-VORGLFNR AND MERKNR = GS_QAMV-MERKNR. LV_INDEX = LV_INDEX + 1. CLEAR:LV_JG. CASE GW_QASE-MBEWERTG. WHEN 'A'. LV_JG = 'OK'. WHEN OTHERS. LV_JG = 'NG'. ENDCASE. CASE GW_QASE-DETAILERG. WHEN '00000001'. GW_ZQMR004I-ZJCJG01 = LV_JG. IF GS_ZQMR004I-ZJCJG01 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG01 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000002'. GW_ZQMR004I-ZJCJG02 = LV_JG. IF GS_ZQMR004I-ZJCJG02 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG02 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000003'. GW_ZQMR004I-ZJCJG03 = LV_JG. IF GS_ZQMR004I-ZJCJG03 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG03 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000004'. GW_ZQMR004I-ZJCJG04 = LV_JG. IF GS_ZQMR004I-ZJCJG04 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG04 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000005'. GW_ZQMR004I-ZJCJG05 = LV_JG. IF GS_ZQMR004I-ZJCJG05 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG05 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000006'. GW_ZQMR004I-ZJCJG06 = LV_JG. IF GS_ZQMR004I-ZJCJG06 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG06 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000007'. GW_ZQMR004I-ZJCJG07 = LV_JG. IF GS_ZQMR004I-ZJCJG07 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG07 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000008'. GW_ZQMR004I-ZJCJG08 = LV_JG. IF GS_ZQMR004I-ZJCJG08 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG08 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000009'. GW_ZQMR004I-ZJCJG09 = LV_JG. IF GS_ZQMR004I-ZJCJG09 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG09 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN '00000010'. GW_ZQMR004I-ZJCJG10 = LV_JG. IF GS_ZQMR004I-ZJCJG10 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG10 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. WHEN OTHERS. ENDCASE. ENDLOOP. IF SY-SUBRC <> 0."非抽样 READ TABLE GT_QAMR INTO GW_QAMR WITH KEY PRUEFLOS = GS_QAMV-PRUEFLOS VORGLFNR = GS_QAMV-VORGLFNR MERKNR = GS_QAMV-MERKNR BINARY SEARCH. IF SY-SUBRC = 0. CASE GW_QAMR-MBEWERTG. WHEN 'A'. LV_JG = 'OK'. WHEN OTHERS. LV_JG = 'NG'. ENDCASE. GW_ZQMR004I-ZJCJG01 = LV_JG. IF GS_ZQMR004I-ZJCJG01 = 'NG'. ELSE. GS_ZQMR004I-ZJCJG01 = LV_JG. IF LV_JG = 'NG'. GW_ZQMR004H-ZBLSL = GW_ZQMR004H-ZBLSL + 1. ENDIF. ENDIF. ENDIF. ENDIF. APPEND GW_ZQMR004I TO GT_ZQMR004I. CLEAR:GW_ZQMR004I. ENDLOOP. IF GS_ZQMR004I IS NOT INITIAL. GS_ZQMR004I-PRUEFLOS = GW_SHOW-PRUEFLOS. GS_ZQMR004I-MERKNR = GS_QAMV-MERKNR. GS_ZQMR004I-KURZTEXT = '检验结果'. APPEND GS_ZQMR004I TO GT_ZQMR004I. CLEAR:GS_ZQMR004I. IF GW_ZQMR004H-LOSMENGE <> 0. LV_P = GW_ZQMR004H-ZBLSL / GW_ZQMR004H-LOSMENGE * 100. MOVE LV_P TO GW_ZQMR004H-ZBLV. CONCATENATE GW_ZQMR004H-ZBLV '%' INTO GW_ZQMR004H-ZBLV. ENDIF. ENDIF. CALL FUNCTION LV_FNAME EXPORTING * ARCHIVE_INDEX = * ARCHIVE_INDEX_TAB = * ARCHIVE_PARAMETERS = CONTROL_PARAMETERS = LS_CONTROL * MAIL_APPL_OBJ = * MAIL_RECIPIENT = * MAIL_SENDER = * OUTPUT_OPTIONS = * USER_SETTINGS = 'X' I_HEAD = GW_ZQMR004H * IMPORTING * DOCUMENT_OUTPUT_INFO = * JOB_OUTPUT_INFO = * JOB_OUTPUT_OPTIONS = TABLES T_ITEM = GT_ZQMR004I[] EXCEPTIONS FORMATTING_ERROR = 1 INTERNAL_ERROR = 2 SEND_ERROR = 3 USER_CANCELED = 4. * APPEND GW_ZQMR004H TO GT_ZQMR004H. ENDLOOP. CALL FUNCTION 'SSF_CLOSE'. IF SY-SUBRC <> 0. ENDIF. ENDFORM.
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18608.html