生产日报表

---恢复内容开始---

虽然各个公司都不一样,但是这个报表还是可以参考一下的。字段不清楚可以先看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.

---恢复内容结束---

时间: 2024-10-01 00:32:29

生产日报表的相关文章

ABAP 分货日报表

*&---------------------------------------------------------------------* *& Report  ZSDR031 *& *&---------------------------------------------------------------------* *&程序名称:分货日报表导出 *&事物代码: *&导入模板:xls(上传对象名为:ZSD_XLS_011) *&

加料记录日报表的存储过程

USE [ChiefWMS]GO/****** Object: StoredProcedure [dbo].[st_WMS_JobGenRptMaterialPut] Script Date: 03/28/2016 10:47:25 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO/*原存储过程名:Job_GenRptMaterialPut exec [dbo].[st_WMS_JobGenRptMaterialPut] '2016-03-

选择生成日报表,月报表,年报表

传入参数: @Type:类型,是哪一种报表,有year,month,day三种 @Time:时间 根据Type参数分别获取Time的月份数据,日期数据 declare @Type nvarchar(20) ='month'; declare @Time DateTime =getdate(); SELECT distinct CASE WHEN @Type = 'quarter' THEN CONCAT(DATEPART(qq,DATEADD(qq,number,@Time)),'季度') WH

生产环境报表未生成原因排查

从log日志中抓取错误信息,如下: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 月初生成的报表比较多,所以会出现较大数据库访问量,大致是数据库连接缓冲池的问题. 解决办法: (1)使用JDBC URL中使用autoReconnect属性,url添加 &autoReconnect=tru

浅析ERP生产管理系统如何进行工作

随着现代经济不断飞速发展,互联网信息时代已经是人们不可缺少的一部分,特别是在企业当中运用范围越来越广泛.但ERP系统作为企业管理软件之一,我们想要让ERP系统在企业当中能够实施成功,就一定要对ERP管理系统操作流程有个清晰的认识.生产ERP管理系统是企业运营中很重要的一个环节,今天让我们来了解一下ERP生产管理系统是如何工作的. 一.生产计划 1.制定切实可行的生产计划,该计划除了包含由销售环节转来的订单外,用户也可直接输入生产计划,如有紧急订单时,可通过追加临时生产计划,直接生成物料需求计划并

五金配件行业ERP解决方案

五金行业信息化需求分析 “国内竞争国际化,国际竞争国内化”将是近几年我国五金行业发展的特点,中国作为全球五金制造中心的地位将进一步稳固.随着中国融入全球经济环境进程的加快以及经济实力的快速崛起,中国已经成为全球最有活力的经济地区.中国经济设施比较完善,产业发展比较成熟且劳动力成本较低,具有成为全球五金制造中心的比较优势,五金制造业外向型发展特征明显. 中国五金行业地位的加强首先表现在近几年五金产品的出口全面增长:主要五金产品的出口增长率均高于产量的增长率,更高于国内市场销量的增长率:主要五金电器

vc 6.0 生成word报表

可以用于将数据 生产一个报表: // CMDIDemoDlg.cpp : implementation file // #include "stdafx.h" #include "CMDIDemo.h" #include "CMDIDemoDlg.h" #include"comdef.h" #include"atlbase.h" #include"msword.h" #ifdef _DE

喜大普奔:史上最全的报表模板库免费用!

老板再也不用担心我不会做报表了! 史上最全的报表模板库—— ActiveReports 报表模板库,覆盖生产制造,仓储物流,电子商务,煤炭资源等行业报表模板,类型多样且功能丰富,总会满足您的需求,下载即可使用,把报表制作变得如此简单和省事. ActiveReports 报表模板库包含了多种样式的符合行业规范的报表模板,并免费提供. 并不是所有的报表模板库内容丰富而又全面,竟然还免费!一切尽在ActiveReports在线报表模板库! 再也不用因为不会做复杂的报表而愁愁愁! 再也不用因为追求精致的

5、VS2010+ASP.NET MVC4+EF4+JqueryEasyUI+Oracle项目开发之——使用datagrid做报表统计

需要说明一点:数据库访问我使用的是EF框架,但是在报表统计着一块由于使用到了动态表,即根据每一天单独生成了一张数据表,所以不好使用EF进行预先添加,于是我在数据库访问层里面封装了两套数据库访问框架,一个就是EF,一个就是传统的ADO.NET.当设计到使用动态表时,我就调用用ADO.NET进行数据库访问操作了. 先看下View,这里我使用的是jquery easyUI里面的datagrid来做的报表.如下: 单击选中日报: 年报如下: @model YKT.Model.SubCompanyRepo