生产日报表详解编程语言

—恢复内容开始—

虽然各个公司都不一样,但是这个报表还是可以参考一下的。字段不清楚可以先看FIELDCAT。反正就是报工和消耗产出。

*&---------------------------------------------------------------------* 
*&  包含                ZPPR0013_TOP 
*&---------------------------------------------------------------------* 
TABLES:AUFM,AFRU,AFKO,RESB,AFVC,CRHD,CRTX,AUFK,MAKT. 
TYPES:BEGIN OF TY_SHOW, 
SEL(1)   TYPE C, 
WERKS    TYPE AUFM-WERKS,"工厂 
BUDAT    TYPE AUFM-BUDAT,"生产日期 
ARBPL    TYPE CRHD-ARBPL,"生产线编码 
MAKTX    TYPE MAKT-MAKTX,"项目描述 
MOTYP(4) TYPE C, 
MENG1    TYPE AUFM-MENGE,"项目描述 
MENG2    TYPE AUFM-MENGE,"项目描述 
MENG3    TYPE AUFM-MENGE,"项目描述 
MENG4    TYPE AUFM-MENGE,"项目描述 
MENG5    TYPE AUFM-MENGE,"班次为空数量 
KTEXT    TYPE CRTX-KTEXT,"生产线描述 
MATNR    TYPE AUFM-MATNR,"项目编码 
MEINS    TYPE AUFM-MEINS,"项目描述 
END OF TY_SHOW, 
BEGIN OF TY_AUFM, 
MBLNR TYPE AUFM-MBLNR, 
MJAHR TYPE AUFM-MJAHR, 
ZEILE TYPE AUFM-ZEILE, 
BLDAT TYPE AUFM-BLDAT, 
BUDAT TYPE AUFM-BUDAT, 
ABLAD TYPE AUFM-ABLAD, 
BWART TYPE AUFM-BWART, 
MATNR TYPE AUFM-MATNR, 
MAKTX TYPE MAKT-MAKTX, 
WERKS TYPE AUFM-WERKS, 
AUFNR TYPE AUFM-AUFNR, 
MENGE TYPE AUFM-MENGE, 
MEINS TYPE AUFM-MEINS, 
END OF TY_AUFM, 
BEGIN OF TY_AFRU, 
RUECK TYPE AFRU-RUECK, 
RMZHL TYPE AFRU-RMZHL, 
BUDAT TYPE AFRU-BUDAT, 
WERKS TYPE AFRU-WERKS, 
AUFNR TYPE AFRU-AUFNR, 
GRUND TYPE AFRU-GRUND, 
ILE03 TYPE AFRU-ILE03, 
ISM03 TYPE AFRU-ISM03, 
ILE04 TYPE AFRU-ILE04, 
ISM04 TYPE AFRU-ISM04, 
ILE05 TYPE AFRU-ILE05, 
ISM05 TYPE AFRU-ISM05, 
AUFPL TYPE AFRU-AUFPL, 
APLZL TYPE AFRU-APLZL, 
SCSJ  TYPE AFRU-SCSJ, 
TJSJ  TYPE AFRU-TJSJ, 
ZLSYL TYPE AFRU-ZLSYL, 
RSYL  TYPE AFRU-RSYL, 
STOKZ TYPE AFRU-STOKZ, 
END OF TY_AFRU, 
BEGIN OF TY_AFRUD, 
RUECK  TYPE AFRU-RUECK, 
RMZHL  TYPE AFRU-RMZHL, 
BUDAT  TYPE AFRU-BUDAT, 
WABLNR TYPE AFRU-WABLNR, 
GRUND  TYPE AFRU-GRUND, 
END OF TY_AFRUD, 
BEGIN OF TY_RESB, 
AUFNR TYPE AFKO-AUFNR, 
MATNR TYPE AFKO-PLNBEZ, 
RSNUM TYPE RESB-RSNUM, 
RSPOS TYPE RESB-RSPOS, 
AUFPL TYPE RESB-AUFPL, 
APLZL TYPE RESB-APLZL, 
END OF TY_RESB, 
BEGIN OF TY_MARC, 
MATNR TYPE MARC-MATNR, 
WERKS TYPE MARC-WERKS, 
RGEKZ TYPE MARC-RGEKZ, 
DISGR TYPE MARC-DISGR, 
END OF TY_MARC, 
BEGIN OF TY_AFVC, 
AUFPL TYPE AFVC-AUFPL, 
APLZL TYPE AFVC-APLZL, 
ARBID TYPE AFVC-ARBID, 
END OF TY_AFVC, 
BEGIN OF TY_CRHD, 
OBJID TYPE CRHD-OBJID, 
ARBPL TYPE CRHD-ARBPL, 
END OF TY_CRHD, 
BEGIN OF TY_CRTX, 
OBJID TYPE CRTX-OBJID, 
KTEXT TYPE CRTX-KTEXT, 
END OF TY_CRTX. 
"TABLE DEFINE 
DATA:GT_SHOW  TYPE TABLE OF TY_SHOW, 
GS_SHOW  LIKE LINE OF  GT_SHOW, 
GT_AUFM  TYPE TABLE OF TY_AUFM, 
GS_AUFM  LIKE LINE OF  GT_AUFM, 
GT_AFRU  TYPE TABLE OF TY_AFRU, 
GS_AFRU  LIKE LINE OF  GT_AFRU, 
GT_AFRUD TYPE TABLE OF TY_AFRUD, 
GS_AFRUD LIKE LINE OF  GT_AFRUD, 
GT_RESB  TYPE TABLE OF TY_RESB, 
GS_RESB  LIKE LINE OF  GT_RESB, 
GT_AFVC  TYPE TABLE OF TY_AFVC, 
GS_AFVC  LIKE LINE OF  GT_AFVC, 
GT_CRHD  TYPE TABLE OF TY_CRHD, 
GS_CRHD  LIKE LINE OF  GT_CRHD, 
GT_CRTX  TYPE TABLE OF TY_CRTX, 
GS_CRTX  LIKE LINE OF  GT_CRTX, 
GT_MARC  TYPE TABLE OF TY_MARC, 
GS_MARC  LIKE LINE OF  GT_MARC. 
DATA:GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV. 
DATA GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV. 
DATA LS_LAYOUT TYPE SLIS_LAYOUT_ALV. 
DEFINE APPEND_FIELDCAT . 
CLEAR GS_FIELDCAT. 
GS_FIELDCAT-FIELDNAME = &1. 
GS_FIELDCAT-SELTEXT_L = &2. 
GS_FIELDCAT-OUTPUTLEN = &3. 
GS_FIELDCAT-NO_ZERO = &4. 
APPEND GS_FIELDCAT TO GT_FIELDCAT. 
END-OF-DEFINITION. 
DEFINE RANGE. 
&2-LOW = &3. 
&2-SIGN = 'I'. 
&2-OPTION = 'EQ'. 
APPEND &2 TO &1. 
END-OF-DEFINITION. 
SELECTION-SCREEN BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-001. 
SELECT-OPTIONS:S_WERKS FOR AUFM-WERKS, 
S_BUDAT FOR AUFM-BUDAT DEFAULT SY-DATUM, 
S_ARBPL FOR CRHD-ARBPL MATCHCODE OBJECT CRAM. 
SELECTION-SCREEN END OF BLOCK BLK01.
*&---------------------------------------------------------------------* 
*&  包含                ZPPR0013_FRM 
*&---------------------------------------------------------------------* 
*&---------------------------------------------------------------------* 
*&      Form  PRM_GET_DATA 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM PRM_GET_DATA . 
REFRESH:GT_AUFM,GT_AFRU,GT_SHOW,GT_RESB,GT_AFVC,GT_CRHD,GT_CRTX,GT_AFRUD,GT_MARC. 
DATA:RT_BWART TYPE RANGE OF BWART, 
RS_BWART LIKE LINE OF  RT_BWART. 
DATA:LV_VALUE TYPE P VALUE -1. 
DATA:LV_C1 TYPE STRING VALUE '13579'. 
RANGE:RT_BWART RS_BWART '101', 
RT_BWART RS_BWART '102', 
RT_BWART RS_BWART '261', 
RT_BWART RS_BWART '262', 
RT_BWART RS_BWART '531', 
RT_BWART RS_BWART '532'. 
SELECT  A~MBLNR 
A~MJAHR 
A~ZEILE 
A~BLDAT 
A~BUDAT 
A~ABLAD 
A~BWART 
A~MATNR 
B~MAKTX 
A~WERKS 
A~AUFNR 
A~MENGE 
A~MEINS 
INTO CORRESPONDING FIELDS OF TABLE GT_AUFM 
FROM AUFM AS A 
INNER JOIN MAKT AS B 
ON A~MATNR = B~MATNR 
WHERE A~BUDAT IN S_BUDAT 
AND   A~WERKS IN S_WERKS 
AND   A~BWART IN RT_BWART 
AND   B~SPRAS = '1'. 
SELECT 
RUECK 
RMZHL 
WERKS 
BUDAT 
AUFNR 
GRUND 
ILE03 
ISM03 
ILE04 
ISM04 
ILE05 
ISM05 
AUFPL 
APLZL 
SCSJ 
TJSJ 
ZLSYL 
RSYL 
STOKZ 
INTO CORRESPONDING FIELDS OF TABLE GT_AFRU 
FROM AFRU 
WHERE BUDAT IN S_BUDAT 
AND   WERKS IN S_WERKS. 
IF GT_AUFM[] IS INITIAL AND GT_AFRU[] IS INITIAL. 
MESSAGE '选择范围内无结果!' TYPE 'E'. 
EXIT. 
ENDIF. 
IF GT_AUFM IS NOT INITIAL. 
SELECT MATNR WERKS DISGR RGEKZ INTO CORRESPONDING FIELDS OF TABLE GT_MARC 
FROM MARC 
FOR ALL ENTRIES IN GT_AUFM 
WHERE MATNR = GT_AUFM-MATNR 
AND   WERKS = GT_AUFM-WERKS 
AND   RGEKZ = '1'. 
*      AND   DISGR = 'DL02'."change by ly 20150807 
SORT GT_MARC[] BY MATNR. 
DELETE ADJACENT DUPLICATES FROM GT_MARC[] COMPARING MATNR WERKS. 
SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_AFRUD 
FROM AFRU FOR ALL ENTRIES IN GT_AUFM 
WHERE WABLNR = GT_AUFM-MBLNR. 
SELECT RSNUM 
RSPOS 
AUFPL 
APLZL 
AUFNR 
MATNR 
INTO CORRESPONDING FIELDS OF TABLE GT_RESB 
FROM RESB 
FOR ALL ENTRIES IN GT_AUFM 
WHERE AUFNR = GT_AUFM-AUFNR. 
*    AND   MATNR = GT_AUFM-MATNR. 
DELETE GT_RESB[] WHERE AUFPL IS INITIAL. 
SORT GT_RESB BY RSNUM AUFPL APLZL. 
DELETE ADJACENT DUPLICATES FROM GT_RESB COMPARING RSNUM AUFPL APLZL. 
IF GT_RESB[] IS NOT INITIAL. 
SELECT AUFPL 
APLZL 
ARBID 
INTO CORRESPONDING FIELDS OF TABLE GT_AFVC 
FROM AFVC 
FOR ALL ENTRIES IN GT_RESB 
WHERE AUFPL = GT_RESB-AUFPL 
AND   APLZL = GT_RESB-APLZL. 
ENDIF. 
ENDIF. 
IF GT_AFRU[] IS NOT INITIAL. 
SELECT AUFPL 
APLZL 
ARBID 
APPENDING CORRESPONDING FIELDS OF TABLE GT_AFVC 
FROM AFVC 
FOR ALL ENTRIES IN GT_AFRU 
WHERE AUFPL = GT_AFRU-AUFPL 
AND   APLZL = GT_AFRU-APLZL. 
ENDIF. 
SORT GT_AFVC BY AUFPL APLZL. 
DELETE ADJACENT DUPLICATES FROM GT_AFVC COMPARING AUFPL APLZL. 
IF GT_AFVC[] IS NOT INITIAL. 
SELECT OBJID 
ARBPL 
INTO CORRESPONDING FIELDS OF TABLE GT_CRHD 
FROM CRHD 
FOR ALL ENTRIES IN GT_AFVC 
WHERE OBJID = GT_AFVC-ARBID 
AND  ARBPL IN S_ARBPL. 
SELECT OBJID 
KTEXT 
INTO CORRESPONDING FIELDS OF TABLE GT_CRTX 
FROM CRTX 
FOR ALL ENTRIES IN GT_AFVC 
WHERE OBJID = GT_AFVC-ARBID. 
ENDIF. 
LOOP AT GT_AUFM INTO GS_AUFM. 
GS_SHOW-WERKS = GS_AUFM-WERKS. 
GS_SHOW-BUDAT = GS_AUFM-BUDAT. 
GS_SHOW-MAKTX = GS_AUFM-MAKTX. 
GS_SHOW-MATNR = GS_AUFM-MATNR. 
GS_SHOW-MEINS = GS_AUFM-MEINS. 
*    IF GS_AUFM-ABLAD IS INITIAL. 
*      CLEAR:GS_SHOW. 
*      CONTINUE. 
*    ENDIF. 
IF GS_AUFM-BWART+2(1) CO LV_C1. 
ELSE. 
GS_AUFM-MENGE = GS_AUFM-MENGE * -1. 
ENDIF. 
IF GS_AUFM-BWART = '531' OR GS_AUFM-BWART = '532' OR 
GS_AUFM-BWART = '101' OR GS_AUFM-BWART = '102'. 
GS_SHOW-MOTYP = '产出'. 
ELSE. 
GS_SHOW-MOTYP = '消耗'. 
ENDIF. 
READ TABLE GT_MARC INTO GS_MARC WITH KEY MATNR = GS_AUFM-MATNR WERKS = GS_AUFM-WERKS. 
IF SY-SUBRC = 0. 
READ TABLE GT_AFRUD INTO GS_AFRUD WITH KEY WABLNR = GS_AUFM-MBLNR. 
IF SY-SUBRC = 0. 
CASE GS_AFRUD-GRUND. 
WHEN '0001'. 
GS_SHOW-MENG1 = GS_AUFM-MENGE. 
WHEN '0002'. 
GS_SHOW-MENG2 = GS_AUFM-MENGE. 
WHEN '0003'. 
GS_SHOW-MENG3 = GS_AUFM-MENGE. 
WHEN OTHERS. 
GS_SHOW-MENG5 = GS_AUFM-MENGE. 
*            CLEAR:GS_SHOW. 
*            CONTINUE. 
ENDCASE. 
ELSE. 
CASE GS_AUFM-ABLAD. 
WHEN '甲班' OR '1' OR 'A'. 
GS_SHOW-MENG1 = GS_AUFM-MENGE. 
WHEN '乙班' OR '2' OR 'B'. 
GS_SHOW-MENG2 = GS_AUFM-MENGE. 
WHEN '丙班' OR '3' OR 'C'. 
GS_SHOW-MENG3 = GS_AUFM-MENGE. 
WHEN OTHERS. 
GS_SHOW-MENG5 = GS_AUFM-MENGE. 
*            CLEAR:GS_SHOW. 
*            CONTINUE. 
ENDCASE. 
ENDIF. 
ELSE. 
CASE GS_AUFM-ABLAD. 
WHEN '甲班' OR '1' OR 'A'. 
GS_SHOW-MENG1 = GS_AUFM-MENGE. 
WHEN '乙班' OR '2' OR 'B'. 
GS_SHOW-MENG2 = GS_AUFM-MENGE. 
WHEN '丙班' OR '3' OR 'C'. 
GS_SHOW-MENG3 = GS_AUFM-MENGE. 
WHEN OTHERS. 
GS_SHOW-MENG5 = GS_AUFM-MENGE. 
*            CLEAR:GS_SHOW. 
*            CONTINUE. 
ENDCASE. 
ENDIF. 
GS_SHOW-MENG4 = GS_AUFM-MENGE. 
READ TABLE GT_RESB INTO GS_RESB WITH KEY AUFNR = GS_AUFM-AUFNR." MATNR = GS_AUFM-MATNR. 
IF SY-SUBRC = 0. 
READ TABLE GT_AFVC INTO GS_AFVC WITH KEY AUFPL = GS_RESB-AUFPL APLZL = GS_RESB-APLZL. 
IF SY-SUBRC = 0. 
READ TABLE GT_CRHD INTO GS_CRHD WITH KEY OBJID = GS_AFVC-ARBID. 
IF SY-SUBRC = 0. 
GS_SHOW-ARBPL = GS_CRHD-ARBPL. 
ELSE. 
IF S_ARBPL IS NOT INITIAL. 
CLEAR:GS_SHOW. 
CONTINUE. 
ENDIF. 
ENDIF. 
READ TABLE GT_CRTX INTO GS_CRTX WITH KEY OBJID = GS_AFVC-ARBID. 
IF SY-SUBRC = 0. 
GS_SHOW-KTEXT = GS_CRTX-KTEXT. 
ENDIF. 
ENDIF. 
ENDIF. 
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT' 
EXPORTING 
INPUT          = GS_SHOW-MEINS 
LANGUAGE       = SY-LANGU 
IMPORTING 
*       LONG_TEXT      = 
OUTPUT         = GS_SHOW-MEINS 
*       SHORT_TEXT     = 
EXCEPTIONS 
UNIT_NOT_FOUND = 1 
OTHERS         = 2. 
IF SY-SUBRC <> 0. 
* Implement suitable error handling here 
ENDIF. 
COLLECT GS_SHOW INTO GT_SHOW. 
CLEAR:GS_SHOW. 
ENDLOOP. 
LOOP AT GT_AFRU INTO GS_AFRU. 
GS_SHOW-WERKS = GS_AFRU-WERKS. 
GS_SHOW-BUDAT = GS_AFRU-BUDAT. 
READ TABLE GT_AFVC INTO GS_AFVC WITH KEY AUFPL = GS_AFRU-AUFPL APLZL = GS_AFRU-APLZL. 
IF SY-SUBRC = 0. 
READ TABLE GT_CRHD INTO GS_CRHD WITH KEY OBJID = GS_AFVC-ARBID. 
IF SY-SUBRC = 0. 
GS_SHOW-ARBPL = GS_CRHD-ARBPL. 
ELSE. 
IF S_ARBPL IS NOT INITIAL. 
CLEAR:GS_SHOW. 
CONTINUE. 
ENDIF. 
ENDIF. 
READ TABLE GT_CRTX INTO GS_CRTX WITH KEY OBJID = GS_AFVC-ARBID. 
IF SY-SUBRC = 0. 
GS_SHOW-KTEXT = GS_CRTX-KTEXT. 
ENDIF. 
ENDIF. 
IF GS_AFRU-GRUND IS INITIAL. 
CLEAR:GS_SHOW. 
CONTINUE. 
ENDIF. 
IF GS_AFRU-STOKZ = 'X'. 
LV_VALUE = -1. 
ELSE. 
LV_VALUE = 1. 
ENDIF. 
GS_SHOW-MOTYP = '消耗'. 
CASE GS_AFRU-GRUND. 
WHEN '0001'. 
IF GS_AFRU-ISM03 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM03'. 
GS_SHOW-MEINS = 'KWH'. 
IF GS_AFRU-ILE03 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM03 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE03 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM03 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG1 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MAKTX = '电耗'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM04 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM04'. 
GS_SHOW-MEINS = 'KG'. 
IF GS_AFRU-ILE04 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM04 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE04 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM04 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG1 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MAKTX = '蒸汽用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM05 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM05'. 
GS_SHOW-MEINS = 'M3'. 
IF GS_AFRU-ILE05 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM05 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE05 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM05 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG1 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MAKTX = '天然气用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-SCSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'SCSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG1 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MAKTX = '生产时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-TJSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'TJSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG1 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MAKTX = '停机时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ZLSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'ZLSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG1 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MAKTX = '自来水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-RSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'RSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG1 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MAKTX = '软水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
WHEN '0002'. 
IF GS_AFRU-ISM03 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM03'. 
GS_SHOW-MEINS = 'KWH'. 
IF GS_AFRU-ILE03 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM03 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE03 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM03 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG2 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MAKTX = '电耗'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM04 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM04'. 
GS_SHOW-MEINS = 'KG'. 
IF GS_AFRU-ILE04 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM04 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE04 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM04 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG2 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MAKTX = '蒸汽用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM05 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM05'. 
GS_SHOW-MEINS = 'M3'. 
IF GS_AFRU-ILE05 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM05 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE05 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM05 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG2 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MAKTX = '天然气用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-SCSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'SCSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG2 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MAKTX = '生产时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-TJSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'TJSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG2 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MAKTX = '停机时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ZLSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'ZLSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG2 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MAKTX = '自来水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-RSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'RSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG2 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MAKTX = '软水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
WHEN '0003'. 
IF GS_AFRU-ISM03 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM03'. 
GS_SHOW-MEINS = 'KWH'. 
IF GS_AFRU-ILE03 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM03 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE03 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM03 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG3 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MAKTX = '电耗'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM04 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM04'. 
GS_SHOW-MEINS = 'KG'. 
IF GS_AFRU-ILE04 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM04 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE04 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM04 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG3 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MAKTX = '蒸汽用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM05 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM05'. 
GS_SHOW-MEINS = 'M3'. 
IF GS_AFRU-ILE05 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM05 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE05 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM05 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG3 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MAKTX = '天然气用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-SCSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'SCSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG3 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MAKTX = '生产时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-TJSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'TJSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG3 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MAKTX = '停机时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ZLSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'ZLSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG3 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MAKTX = '自来水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-RSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'RSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG3 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MAKTX = '软水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
WHEN OTHERS. 
IF GS_AFRU-ISM03 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM03'. 
GS_SHOW-MEINS = 'KWH'. 
IF GS_AFRU-ILE03 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM03 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE03 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM03 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG5 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM03 * LV_VALUE. 
GS_SHOW-MAKTX = '电耗'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM04 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM04'. 
GS_SHOW-MEINS = 'KG'. 
IF GS_AFRU-ILE04 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM04 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE04 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM04 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG5 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM04 * LV_VALUE. 
GS_SHOW-MAKTX = '蒸汽用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ISM05 IS NOT INITIAL. 
GS_SHOW-MATNR = 'ISM05'. 
GS_SHOW-MEINS = 'M3'. 
IF GS_AFRU-ILE05 <> GS_SHOW-MEINS. 
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE' 
EXPORTING 
INPUT                = GS_AFRU-ISM05 
ROUND_SIGN           = 'X' 
UNIT_IN              = GS_AFRU-ILE05 
UNIT_OUT             = GS_SHOW-MEINS 
IMPORTING 
OUTPUT               = GS_AFRU-ISM05 
EXCEPTIONS 
CONVERSION_NOT_FOUND = 1 
DIVISION_BY_ZERO     = 2 
INPUT_INVALID        = 3 
OUTPUT_INVALID       = 4 
OVERFLOW             = 5 
TYPE_INVALID         = 6 
UNITS_MISSING        = 7 
UNIT_IN_NOT_FOUND    = 8 
UNIT_OUT_NOT_FOUND   = 9 
OTHERS               = 10. 
IF SY-SUBRC <> 0. 
ENDIF. 
ENDIF. 
GS_SHOW-MENG5 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ISM05 * LV_VALUE. 
GS_SHOW-MAKTX = '天然气用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-SCSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'SCSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG5 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-SCSJ * LV_VALUE. 
GS_SHOW-MAKTX = '生产时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-TJSJ IS NOT INITIAL. 
GS_SHOW-MATNR = 'TJSJ'. 
GS_SHOW-MEINS = 'H'. 
GS_SHOW-MENG5 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-TJSJ * LV_VALUE. 
GS_SHOW-MAKTX = '停机时间'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-ZLSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'ZLSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG5 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-ZLSYL * LV_VALUE. 
GS_SHOW-MAKTX = '自来水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
IF GS_AFRU-RSYL IS NOT INITIAL. 
GS_SHOW-MATNR = 'RSYL'. 
GS_SHOW-MEINS = 'T'. 
GS_SHOW-MENG5 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MENG4 = GS_AFRU-RSYL * LV_VALUE. 
GS_SHOW-MAKTX = '软水用量'. 
COLLECT GS_SHOW INTO GT_SHOW. 
ENDIF. 
ENDCASE. 
CLEAR:GS_SHOW. 
ENDLOOP. 
LOOP AT GT_SHOW INTO GS_SHOW. 
IF GS_SHOW-MENG1 IS INITIAL AND GS_SHOW-MENG2 IS INITIAL AND GS_SHOW-MENG3 IS INITIAL AND GS_SHOW-MENG5 IS INITIAL. 
DELETE TABLE GT_SHOW FROM GS_SHOW . 
ENDIF. 
ENDLOOP. 
ENDFORM.                    " PRM_GET_DATA 
*&---------------------------------------------------------------------* 
*&      Form  PRM_SET_FIELDCAT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM PRM_SET_FIELDCAT . 
APPEND_FIELDCAT:   'WERKS'           '工厂'           4   '', 
'BUDAT'           '生产日期'       8   '', 
'ARBPL'           '生产线编码'     8   '', 
'KTEXT'           '生产线描述'     30  '', 
'MATNR'           '项目编码'       10  'X', 
'MAKTX'           '项目描述'       30  '', 
'MOTYP'           '移动类型'       10  '', 
'MEINS'           '单位'           5   '', 
'MENG1'           '甲班数量'       13  '', 
'MENG2'           '乙班数量'       13  '', 
'MENG3'           '丙班数量'       13  '', 
'MENG5'           '未对应班次数量'       13  '', 
'MENG4'           '汇总数量'       13  ''. 
LS_LAYOUT-COLWIDTH_OPTIMIZE    = 'X'. "优化列宽选项是否设置 
LS_LAYOUT-ZEBRA                = 'X'. 
LS_LAYOUT-BOX_FIELDNAME        = 'SEL'. 
LS_LAYOUT-HEADER_TEXT        = '生产日报表'. 
ENDFORM.                    " PRM_SET_FIELDCAT 
*&---------------------------------------------------------------------* 
*&      Form  PRM_SHOW_DATA 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM PRM_SHOW_DATA . 
DATA:GT_SORT TYPE         SLIS_T_SORTINFO_ALV, 
GS_SORT LIKE LINE OF GT_SORT. 
GS_SORT-FIELDNAME = 'WERKS'. 
GS_SORT-UP = 'X'. 
APPEND GS_SORT TO GT_SORT. 
GS_SORT-FIELDNAME = 'BUDAT'. 
GS_SORT-UP = 'X'. 
APPEND GS_SORT TO GT_SORT. 
GS_SORT-FIELDNAME = 'ARBPL'. 
GS_SORT-UP = 'X'. 
APPEND GS_SORT TO GT_SORT. 
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
EXPORTING 
*     I_INTERFACE_CHECK           = ' ' 
*     I_BYPASSING_BUFFER          = ' ' 
*     I_BUFFER_ACTIVE             = ' ' 
I_CALLBACK_PROGRAM          = SY-REPID 
*     I_CALLBACK_PF_STATUS_SET    = ' ' 
*     I_CALLBACK_USER_COMMAND     = ' ' 
*     I_CALLBACK_TOP_OF_PAGE      = 'FRM_TOP_OF_PAGE' 
I_CALLBACK_HTML_TOP_OF_PAGE = 'FRM_HTML_TOP_OF_PAGE' 
*     I_CALLBACK_HTML_END_OF_LIST = ' ' 
*     I_STRUCTURE_NAME            = 
*     I_BACKGROUND_ID             = ' ' 
*     I_GRID_TITLE                = '生产日报表' 
*     I_GRID_SETTINGS             = 
IS_LAYOUT                   = LS_LAYOUT 
IT_FIELDCAT                 = GT_FIELDCAT 
*     IT_EXCLUDING                = 
*     IT_SPECIAL_GROUPS           = 
IT_SORT                     = GT_SORT 
*     IT_FILTER                   = 
*     IS_SEL_HIDE                 = 
*     I_DEFAULT                   = 'X' 
I_SAVE                      = 'A' 
*     IS_VARIANT                  = 
*     IT_EVENTS                   = 
*     IT_EVENT_EXIT               = 
*     IS_PRINT                    = 
*     IS_REPREP_ID                = 
*     I_SCREEN_START_COLUMN       = 0 
*     I_SCREEN_START_LINE         = 0 
*     I_SCREEN_END_COLUMN         = 0 
*     I_SCREEN_END_LINE           = 0 
*     I_HTML_HEIGHT_TOP           = 0 
*     I_HTML_HEIGHT_END           = 0 
*     IT_ALV_GRAPHICS             = 
*     IT_HYPERLINK                = 
*     IT_ADD_FIELDCAT             = 
*     IT_EXCEPT_QINFO             = 
*     IR_SALV_FULLSCREEN_ADAPTER  = 
* IMPORTING 
*     E_EXIT_CAUSED_BY_CALLER     = 
*     ES_EXIT_CAUSED_BY_USER      = 
TABLES 
T_OUTTAB                    = GT_SHOW 
EXCEPTIONS 
PROGRAM_ERROR               = 1 
OTHERS                      = 2. 
IF SY-SUBRC <> 0. 
* Implement suitable error handling here 
ENDIF. 
ENDFORM.                    " PRM_SHOW_DATA 
FORM FRM_HTML_TOP_OF_PAGE USING CL_DD TYPE REF TO CL_DD_DOCUMENT. 
DATA: M_P TYPE I. 
DATA: M_BUFF TYPE STRING. 
DATA:M_WERKS TYPE STRING. 
DATA:LV_FLAG TYPE C. 
LOOP AT S_WERKS. 
IF S_WERKS-LOW = '2001' OR S_WERKS-HIGH = '2001'. 
IF LV_FLAG = '1' OR LV_FLAG IS INITIAL. 
LV_FLAG = '1'. 
ELSEIF LV_FLAG = '2'. 
LV_FLAG = '3'. 
ENDIF. 
ENDIF. 
IF S_WERKS-LOW = '2002' OR S_WERKS-HIGH = '2002'. 
IF LV_FLAG = '2' OR LV_FLAG IS INITIAL. 
LV_FLAG = '2'. 
ELSEIF LV_FLAG = '1'. 
LV_FLAG = '3'. 
ENDIF. 
ENDIF. 
ENDLOOP. 
IF LV_FLAG = '1'. 
M_WERKS = '广州东凌粮油生产日报表'. 
ELSEIF LV_FLAG = '2'. 
M_WERKS = '广州植之元油脂实业生产日报表'. 
ELSE. 
M_WERKS = '生产日报表'. 
ENDIF. 
*表头其实完全可以是一个html文件,自己使用html语言进行格式控制 
 
M_BUFF = '<html>'. 
CALL METHOD CL_DD->HTML_INSERT 
EXPORTING 
CONTENTS = M_BUFF 
CHANGING 
POSITION = M_P. 
CONCATENATE '<center><H2>' M_WERKS  '</H2></Center>' INTO M_BUFF. 
*  M_BUFF = '<center><H2>生产日报表</H2></Center>'. 
CALL METHOD CL_DD->HTML_INSERT 
EXPORTING 
CONTENTS = M_BUFF 
CHANGING 
POSITION = M_P. 
CONCATENATE '<center>报表日期:' SY-DATUM+0(4) '' SY-DATUM+4(2) ''  SY-DATUM+6(2) '' '</Center>' INTO M_BUFF. 
*  CONCATENATE '报表日期:' S_DATE-LOW ' TO ' S_DATE-HIGH  '<BR>' INTO M_BUFF. 
CALL METHOD CL_DD->HTML_INSERT 
EXPORTING 
CONTENTS = M_BUFF 
CHANGING 
POSITION = M_P. 
M_BUFF = '</html>'. 
CALL METHOD CL_DD->HTML_INSERT 
EXPORTING 
CONTENTS = M_BUFF 
CHANGING 
POSITION = M_P. 
*  DATA: LV_TOP      TYPE STRING, 
*        LV_HTML     TYPE STRING, 
*        LV_LINE     TYPE I, 
*        LV_MONTH(2), 
*        LV_DAY(2). 
*  LV_HTML = '<html><body style="font-family:微软雅黑;font-size:12pt;font-weight:bold;margin:0;padding:0;line-height:25px;text-align:left">'. 
*  LV_HTML = LV_HTML && '<div style="font-size:14pt;margin-left:2CM;margin-top:2MM;">'. 
*  IF P_YEAR EQ 'X'. 
*    LV_TOP = LV_HTML && P_PYEAR && TEXT-013 && TEXT-014. 
*  ELSEIF P_MONT EQ 'X'. 
*    LV_MONTH = P_PMONT. 
*    SHIFT LV_MONTH LEFT DELETING LEADING '0'. 
*    LV_TOP = LV_HTML && P_PYEAR && TEXT-013 && LV_MONTH && TEXT-006 && TEXT-016 && TEXT-014. 
*  ENDIF. 
*  LV_MONTH = SY-DATUM+4(2). 
*  SHIFT LV_MONTH LEFT DELETING LEADING '0'. 
*  LV_DAY = SY-DATUM+6(2). 
*  SHIFT LV_DAY LEFT DELETING LEADING '0'. 
*  LV_TOP = LV_TOP && '</div><div style="margin-left:8CM;margin-top:3MM">' && TEXT-015 && 
*           SY-DATUM(4) && '/' && LV_MONTH && '/' && LV_DAY && '</div></body></html>'. 
*  LV_TOP = '生产日报表'. 
* 
*  CALL METHOD CL_DD->HTML_INSERT 
*    EXPORTING 
*      CONTENTS = LV_TOP 
*    CHANGING 
*      POSITION = LV_LINE. 
ENDFORM. 

—恢复内容结束—

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/18715.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论