首页 > 代码库 > abap 获取生产订单标准工时和实际报工工时的报表

abap 获取生产订单标准工时和实际报工工时的报表

*&---------------------------------------------------------------------*
*& REPORT  ZMM_PO_QUERY
*&
*& REPORTNAME   :生产订单查询系统
*&---------------------------------------------------------------------*
*& CREATED BY   : LIUXINYUAN
*& CREATED DATE : 2015-07-15
*&---------------------------------------------------------------------*

REPORT  ZPP_CO_QUERY.

INCLUDE ZPP_CO_QUERY_TOP.


**选择屏幕
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:S_AUFNR FOR CAUFV-AUFNR.

    SELECT-OPTIONS:S_WERKS FOR CAUFV-WERKS.


    SELECT-OPTIONS:S_GSTRI FOR CAUFV-GSTRI.

    SELECT-OPTIONS:S_GLTRI FOR CAUFV-GLTRI.


SELECTION-SCREEN END OF BLOCK MAIN.



AT SELECTION-SCREEN.

*  LOOP AT S_WERKS.
*        AUTHORITY-CHECK OBJECT ‘Z_MM_003‘
*                            ID ‘WERKS‘ FIELD S_WERKS-LOW.
*        IF SY-SUBRC <> 0.
*            MESSAGE E019(ZMM001) WITH S_WERKS-LOW.
*        ENDIF.
*  ENDLOOP.


AT SELECTION-SCREEN OUTPUT.

**主程序
START-OF-SELECTION.

PERFORM FRM_SELECT_DATA.
PERFORM FRM_DISPLAY.

*&---------------------------------------------------------------------*
*&      FORM  FRM_SELECT_DATA
*&---------------------------------------------------------------------*
*       TEXT
*----------------------------------------------------------------------*
*  -->  P1        TEXT
*  <--  P2        TEXT
*----------------------------------------------------------------------*
FORM FRM_SELECT_DATA .

CALL FUNCTION ‘SAPGUI_PROGRESS_INDICATOR‘
  EXPORTING
    TEXT = ‘数据读取中.................‘.

REFRESH ITAB.
CLEAR ITAB.


"机器 作业类型 1001
"工资 作业类型 1000
"其它 作业类型 1003
 SELECT AUFNR
        WERKS
        AUART
        KDAUF      "销售订单编号
        KDPOS      "销售订单行项目
        PLNBEZ
        GAMNG
        AUFPL
        OBJNR
        FTRMI
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        FROM CAUFV
        WHERE AUFNR IN S_AUFNR
          AND WERKS IN S_WERKS
          AND GSTRI IN S_GSTRI
          AND GLTRI IN S_GLTRI.



IF ITAB[] IS NOT INITIAL.
   REFRESH IT_AFVV.
   CLEAR IT_AFVV.
   SELECT AUFPL
          APLZL
          VGW01
          VGW02
          VGW03
          INTO TABLE IT_AFVV
          FROM AFVV
          FOR ALL ENTRIES IN ITAB
          WHERE AUFPL = ITAB-AUFPL.

   REFRESH IT_AFVC.
   CLEAR IT_AFVC.
   SELECT AUFPL
          APLZL
          RUECK
          ARBID
          INTO TABLE IT_AFVC
          FROM AFVC
          FOR ALL ENTRIES IN ITAB
          WHERE  AUFPL = ITAB-AUFPL.


   IF IT_AFVC[] IS NOT INITIAL.
      REFRESH IT_AFRU.
      CLEAR IT_AFRU.
      SELECT RUECK
             RMZHL
             ISM01
             ISM02
             ISM03
             STOKZ
             INTO TABLE IT_AFRU
             FROM AFRU
             FOR ALL ENTRIES IN IT_AFVC
             WHERE RUECK = IT_AFVC-RUECK.

      REFRESH TIT_AFRU.
      CLEAR TIT_AFRU.

      LOOP AT IT_AFRU.
           TIT_AFRU-RUECK = IT_AFRU-RUECK.
           IF IT_AFRU-STOKZ = ‘X‘.
               TIT_AFRU-ISM01 = 0 - IT_AFRU-ISM01.
               TIT_AFRU-ISM02 = 0 - IT_AFRU-ISM02.
               TIT_AFRU-ISM03 = 0 - IT_AFRU-ISM03.
           ELSE.
               TIT_AFRU-ISM01 = IT_AFRU-ISM01.
               TIT_AFRU-ISM02 = IT_AFRU-ISM02.
               TIT_AFRU-ISM03 = IT_AFRU-ISM03.
           ENDIF.
           COLLECT TIT_AFRU.
           CLEAR TIT_AFRU.
      ENDLOOP.

      REFRESH IT_AFRU_VV.
      CLEAR IT_AFRU_VV.
      LOOP AT TIT_AFRU.
               CLEAR IT_AFVC.
               READ TABLE IT_AFVC WITH KEY RUECK = TIT_AFRU-RUECK.
               IF SY-SUBRC EQ 0.
                   IT_AFRU_VV-AUFPL = IT_AFVC-AUFPL.
                   IT_AFRU_VV-APLZL = IT_AFVC-APLZL.
                   IT_AFRU_VV-ISM01 = TIT_AFRU-ISM01.
                   IT_AFRU_VV-ISM02 = TIT_AFRU-ISM02.
                   IT_AFRU_VV-ISM03 = TIT_AFRU-ISM03.
                   APPEND IT_AFRU_VV.
                   CLEAR IT_AFRU_VV.
               ENDIF.
      ENDLOOP.

   ENDIF.


   DATA:LV_ARBID TYPE AFVC-ARBID,
        LV_ARBPL TYPE CRHD-ARBPL.
   LOOP AT ITAB.

*       获取标准工时
        LOOP AT IT_AFVV WHERE AUFPL = ITAB-AUFPL.
           CLEAR LV_ARBID.
           CLEAR IT_AFVC.
           READ TABLE IT_AFVC WITH KEY AUFPL = IT_AFVV-AUFPL APLZL = IT_AFVV-APLZL.
           IF SY-SUBRC EQ 0.
              LV_ARBID = IT_AFVC-ARBID.
           ENDIF.


           CLEAR LV_ARBPL.
           SELECT SINGLE
                  ARBPL
                  INTO LV_ARBPL
                  FROM CRHD
                  WHERE OBJTY = ‘A‘
                    AND OBJID = LV_ARBID.



           DATA:LV_KOSTL TYPE CRCO-KOSTL.
           CLEAR LV_KOSTL.

           SELECT SINGLE
                  KOSTL
                  INTO LV_KOSTL
                  FROM CRCO
                  WHERE OBJTY = ‘A‘
                     AND OBJID = LV_ARBID.

           IF LV_ARBPL = ‘STRZP‘ OR LV_ARBPL+0(2) = ‘ZP‘.
              ITAB-ZPVGW01 = IT_AFVV-VGW01 * ITAB-GAMNG.
              ITAB-ZPVGW02 = IT_AFVV-VGW02 * ITAB-GAMNG.
              ITAB-ZPVGW03 = IT_AFVV-VGW03 * ITAB-GAMNG.
              ITAB-ZPKOSTL = LV_KOSTL.
           ELSEIF LV_ARBPL = ‘STRTS‘ OR LV_ARBPL+0(2) = ‘TS‘.
              ITAB-TSVGW01 = IT_AFVV-VGW01 * ITAB-GAMNG.
              ITAB-TSVGW02 = IT_AFVV-VGW02 * ITAB-GAMNG.
              ITAB-TSVGW03 = IT_AFVV-VGW03 * ITAB-GAMNG.
              ITAB-TSKOSTL = LV_KOSTL.
           ELSEIF LV_ARBPL = ‘STRLH‘ OR LV_ARBPL+0(2) = ‘LH‘.
              ITAB-LHVGW01 = IT_AFVV-VGW01 * ITAB-GAMNG.
              ITAB-LHVGW02 = IT_AFVV-VGW02 * ITAB-GAMNG.
              ITAB-LHVGW03 = IT_AFVV-VGW03 * ITAB-GAMNG.
              ITAB-LHKOSTL = LV_KOSTL.
           ELSEIF LV_ARBPL = ‘STRYJ‘ OR LV_ARBPL+0(2) = ‘YJ‘.
              ITAB-JYVGW01 = IT_AFVV-VGW01 * ITAB-GAMNG.
              ITAB-JYVGW02 = IT_AFVV-VGW02 * ITAB-GAMNG.
              ITAB-JYVGW03 = IT_AFVV-VGW03 * ITAB-GAMNG.
              ITAB-JYKOSTL = LV_KOSTL.
           ELSEIF LV_ARBPL = ‘STRBZ‘ OR LV_ARBPL+0(2) = ‘BZ‘.
              ITAB-BZVGW01 = IT_AFVV-VGW01 * ITAB-GAMNG.
              ITAB-BZVGW02 = IT_AFVV-VGW02 * ITAB-GAMNG.
              ITAB-BZVGW03 = IT_AFVV-VGW03 * ITAB-GAMNG.
              ITAB-BZKOSTL = LV_KOSTL.
           ENDIF.






***********下面代码依据工单下单的工时,查找标准工时的成本的单位价格,以及计算成本
*           CLEAR LV_GJAHR. CLEAR LV_MONTH.
*           LV_GJAHR = ITAB-FTRMI+0(4).
*           LV_MONTH = ITAB-FTRMI+4(2).

*           REFRESH IT_CRCO.
*           CLEAR IT_CRCO.
*
*           SELECT KOKRS
*                  KOSTL
*                  LSTAR
*                  INTO TABLE IT_CRCO
*                  FROM CRCO
*                  WHERE OBJTY = ‘A‘
*                     AND OBJID = LV_ARBID.
*           LOOP AT IT_CRCO.
*                CONCATENATE ‘KL‘ IT_CRCO-KOKRS IT_CRCO-KOSTL IT_CRCO-LSTAR INTO IT_CRCO-OBJNR.
*                MODIFY IT_CRCO.
*                CLEAR IT_CRCO.
*           ENDLOOP.
*
*
*
*           IF IT_CRCO[] IS NOT INITIAL.
*              SELECT  LEDNR
*                      OBJNR
*                      GJAHR
*                      WRTTP
*                      VERSN
*                      TARKZ
*                      PERBL
*
*                      TKG001
*                      TKG002
*                      TKG003
*                      TKG004
*                      TKG005
*                      TKG006
*                      TKG007
*                      TKG008
*                      TKG009
*                      TKG010
*                      TKG011
*                      TKG012
*
*                      TKE001
*                      TKE002
*                      TKE003
*                      TKE004
*                      TKE005
*                      TKE006
*                      TKE007
*                      TKE008
*                      TKE009
*                      TKE010
*                      TKE011
*                      TKE012
*                      INTO TABLE IT_COST
*                      FROM COST
*                      FOR ALL ENTRIES IN IT_CRCO
*                      WHERE LEDNR = ‘00‘
*                        AND OBJNR = IT_CRCO-OBJNR
*                        AND GJAHR = LV_GJAHR
*                        AND TARKZ = ‘001‘.
*
*              CLEAR LV_TKG01.
*              CLEAR LV_TKE01.
*              CLEAR LV_TKG02.
*              CLEAR LV_TKE02.
*              CLEAR LV_TKG03.
*              CLEAR LV_TKE03.
*
*              LOOP AT IT_COST.
*                    IF IT_COST+17(4) = ‘1001‘.
*                       IF LV_MONTH = ‘01‘.
*                           LV_TKG01 = IT_COST-TKG001.
*                           LV_TKE01 = IT_COST-TKE001.
*                       ELSEIF LV_MONTH = ‘02‘.
*                           LV_TKG01 = IT_COST-TKG002.
*                           LV_TKE01 = IT_COST-TKE002.
*                       ELSEIF LV_MONTH = ‘03‘.
*                           LV_TKG01 = IT_COST-TKG003.
*                           LV_TKE01 = IT_COST-TKE003.
*                       ELSEIF LV_MONTH = ‘04‘.
*                           LV_TKG01 = IT_COST-TKG004.
*                           LV_TKE01 = IT_COST-TKE004.
*                       ELSEIF LV_MONTH = ‘05‘.
*                           LV_TKG01 = IT_COST-TKG005.
*                           LV_TKE01 = IT_COST-TKE005.
*                       ELSEIF LV_MONTH = ‘06‘.
*                           LV_TKG01 = IT_COST-TKG006.
*                           LV_TKE01 = IT_COST-TKE006.
*                       ELSEIF LV_MONTH = ‘07‘.
*                           LV_TKG01 = IT_COST-TKG007.
*                           LV_TKE01 = IT_COST-TKE007.
*                       ELSEIF LV_MONTH = ‘08‘.
*                           LV_TKG01 = IT_COST-TKG008.
*                           LV_TKE01 = IT_COST-TKE008.
*                       ELSEIF LV_MONTH = ‘09‘.
*                           LV_TKG01 = IT_COST-TKG009.
*                           LV_TKE01 = IT_COST-TKE009.
*                       ELSEIF LV_MONTH = ‘10‘.
*                           LV_TKG01 = IT_COST-TKG010.
*                           LV_TKE01 = IT_COST-TKE010.
*                       ELSEIF LV_MONTH = ‘11‘.
*                           LV_TKG01 = IT_COST-TKG011.
*                           LV_TKE01 = IT_COST-TKE011.
*                       ELSEIF LV_MONTH = ‘12‘.
*                           LV_TKG01 = IT_COST-TKG012.
*                           LV_TKE01 = IT_COST-TKE012.
*                       ENDIF.
*
*                    ELSEIF IT_COST+17(4) = ‘1000‘.
*                       IF LV_MONTH = ‘01‘.
*                           LV_TKG02 = IT_COST-TKG001.
*                           LV_TKE02 = IT_COST-TKE001.
*                       ELSEIF LV_MONTH = ‘02‘.
*                           LV_TKG02 = IT_COST-TKG002.
*                           LV_TKE02 = IT_COST-TKE002.
*                       ELSEIF LV_MONTH = ‘03‘.
*                           LV_TKG02 = IT_COST-TKG003.
*                           LV_TKE02 = IT_COST-TKE003.
*                       ELSEIF LV_MONTH = ‘04‘.
*                           LV_TKG02 = IT_COST-TKG004.
*                           LV_TKE02 = IT_COST-TKE004.
*                       ELSEIF LV_MONTH = ‘05‘.
*                           LV_TKG02 = IT_COST-TKG005.
*                           LV_TKE02 = IT_COST-TKE005.
*                       ELSEIF LV_MONTH = ‘06‘.
*                           LV_TKG02 = IT_COST-TKG006.
*                           LV_TKE02 = IT_COST-TKE006.
*                       ELSEIF LV_MONTH = ‘07‘.
*                           LV_TKG02 = IT_COST-TKG007.
*                           LV_TKE02 = IT_COST-TKE007.
*                       ELSEIF LV_MONTH = ‘08‘.
*                           LV_TKG02 = IT_COST-TKG008.
*                           LV_TKE02 = IT_COST-TKE008.
*                       ELSEIF LV_MONTH = ‘09‘.
*                           LV_TKG02 = IT_COST-TKG009.
*                           LV_TKE02 = IT_COST-TKE009.
*                       ELSEIF LV_MONTH = ‘10‘.
*                           LV_TKG02 = IT_COST-TKG010.
*                           LV_TKE02 = IT_COST-TKE010.
*                       ELSEIF LV_MONTH = ‘11‘.
*                           LV_TKG02 = IT_COST-TKG011.
*                           LV_TKE02 = IT_COST-TKE011.
*                       ELSEIF LV_MONTH = ‘12‘.
*                           LV_TKG02 = IT_COST-TKG012.
*                           LV_TKE02 = IT_COST-TKE012.
*                       ENDIF.
*                    ELSEIF IT_COST+17(4) = ‘1003‘.
*                       IF LV_MONTH = ‘01‘.
*                           LV_TKG03 = IT_COST-TKG001.
*                           LV_TKE03 = IT_COST-TKE001.
*                       ELSEIF LV_MONTH = ‘02‘.
*                           LV_TKG03 = IT_COST-TKG002.
*                           LV_TKE03 = IT_COST-TKE002.
*                       ELSEIF LV_MONTH = ‘03‘.
*                           LV_TKG03 = IT_COST-TKG003.
*                           LV_TKE03 = IT_COST-TKE003.
*                       ELSEIF LV_MONTH = ‘04‘.
*                           LV_TKG03 = IT_COST-TKG004.
*                           LV_TKE03 = IT_COST-TKE004.
*                       ELSEIF LV_MONTH = ‘05‘.
*                           LV_TKG03 = IT_COST-TKG005.
*                           LV_TKE03 = IT_COST-TKE005.
*                       ELSEIF LV_MONTH = ‘06‘.
*                           LV_TKG03 = IT_COST-TKG006.
*                           LV_TKE03 = IT_COST-TKE006.
*                       ELSEIF LV_MONTH = ‘07‘.
*                           LV_TKG03 = IT_COST-TKG007.
*                           LV_TKE03 = IT_COST-TKE007.
*                       ELSEIF LV_MONTH = ‘08‘.
*                           LV_TKG03 = IT_COST-TKG008.
*                           LV_TKE03 = IT_COST-TKE008.
*                       ELSEIF LV_MONTH = ‘09‘.
*                           LV_TKG03 = IT_COST-TKG009.
*                           LV_TKE03 = IT_COST-TKE009.
*                       ELSEIF LV_MONTH = ‘10‘.
*                           LV_TKG03 = IT_COST-TKG010.
*                           LV_TKE03 = IT_COST-TKE010.
*                       ELSEIF LV_MONTH = ‘11‘.
*                           LV_TKG03 = IT_COST-TKG011.
*                           LV_TKE03 = IT_COST-TKE011.
*                       ELSEIF LV_MONTH = ‘12‘.
*                           LV_TKG03 = IT_COST-TKG012.
*                           LV_TKE03 = IT_COST-TKE012.
*                       ENDIF.
*                    ENDIF.
*              ENDLOOP.
*           ENDIF.
*
*
*              ITAB-ZPVGW01 * LV_TKG01 / LV_TKE01
*              ITAB-ZPVGW02 * LV_TKG02 / LV_TKE01
*              ITAB-ZPVGW03 * LV_TKG03 / LV_TKE01
*
*              ITAB-TSVGW01 * LV_TKG01 / LV_TKE01
*              ITAB-TSVGW02 * LV_TKG02 / LV_TKE01
*              ITAB-TSVGW03 * LV_TKG03 / LV_TKE01
*
*              ITAB-LHVGW01 * LV_TKG01 / LV_TKE01
*              ITAB-LHVGW02 * LV_TKG02 / LV_TKE01
*              ITAB-LHVGW03 * LV_TKG03 / LV_TKE01
*
*              ITAB-JYVGW01 * LV_TKG01 / LV_TKE01
*              ITAB-JYVGW02 * LV_TKG02 / LV_TKE01
*              ITAB-JYVGW03 * LV_TKG03 / LV_TKE01
*
*              ITAB-BZVGW01 * LV_TKG01 / LV_TKE01
*              ITAB-BZVGW02 * LV_TKG02 / LV_TKE01
*              ITAB-BZVGW03 * LV_TKG03 / LV_TKE01
*
************下面代码依据工单下单的工时,查找标准工时的成本的单位价格,以及计算成本



        ENDLOOP.





*       获取实际工时
        LOOP AT IT_AFRU_VV WHERE AUFPL = ITAB-AUFPL.
           CLEAR LV_ARBID.
           CLEAR IT_AFVC.
           READ TABLE IT_AFVC WITH KEY AUFPL = IT_AFRU_VV-AUFPL APLZL = IT_AFRU_VV-APLZL.
           IF SY-SUBRC EQ 0.
              LV_ARBID = IT_AFVC-ARBID.
           ENDIF.


           CLEAR LV_ARBPL.
           SELECT SINGLE
                  ARBPL
                  INTO LV_ARBPL
                  FROM CRHD
                  WHERE OBJTY = ‘A‘
                    AND OBJID = LV_ARBID.

           IF LV_ARBPL = ‘STRZP‘ OR LV_ARBPL+0(2) = ‘ZP‘.
              ITAB-BZPVGW01 = IT_AFRU_VV-ISM01.
              ITAB-BZPVGW02 = IT_AFRU_VV-ISM02.
              ITAB-BZPVGW03 = IT_AFRU_VV-ISM03.
           ELSEIF LV_ARBPL = ‘STRTS‘ OR LV_ARBPL+0(2) = ‘TS‘.
              ITAB-BTSVGW01 = IT_AFRU_VV-ISM01.
              ITAB-BTSVGW02 = IT_AFRU_VV-ISM02.
              ITAB-BTSVGW03 = IT_AFRU_VV-ISM03.
           ELSEIF LV_ARBPL = ‘STRLH‘ OR LV_ARBPL+0(2) = ‘LH‘.
              ITAB-BLHVGW01 = IT_AFRU_VV-ISM01.
              ITAB-BLHVGW02 = IT_AFRU_VV-ISM02.
              ITAB-BLHVGW03 = IT_AFRU_VV-ISM03.
           ELSEIF LV_ARBPL = ‘STRYJ‘ OR LV_ARBPL+0(2) = ‘YJ‘.
              ITAB-BJYVGW01 = IT_AFRU_VV-ISM01.
              ITAB-BJYVGW02 = IT_AFRU_VV-ISM02.
              ITAB-BJYVGW03 = IT_AFRU_VV-ISM03.
           ELSEIF LV_ARBPL = ‘STRBZ‘ OR LV_ARBPL+0(2) = ‘BZ‘.
              ITAB-BBZVGW01 = IT_AFRU_VV-ISM01.
              ITAB-BBZVGW02 = IT_AFRU_VV-ISM02.
              ITAB-BBZVGW03 = IT_AFRU_VV-ISM03.
           ENDIF.
        ENDLOOP.



        MODIFY ITAB.
        CLEAR ITAB.
   ENDLOOP.
ENDIF.





DATA: T_STATUS LIKE BSVX-STTXT.

LOOP AT ITAB.

    CALL FUNCTION ‘STATUS_TEXT_EDIT‘
                 EXPORTING
*                   CLIENT        = SY-MANDT
*                   FLG_USER_STAT = ‘ ‘
                   OBJNR         = ITAB-OBJNR               " 单据号码
*                   ONLY_ACTIVE   = ‘X‘
                   SPRAS         = ‘E‘
*                   BYPASS_BUFFER = ‘ ‘
                 IMPORTING
                   LINE          =  ITAB-XTZT.            " 返回状态


   SELECT SINGLE
          MAKTX
          INTO ITAB-MAKTX
          FROM MAKT
          WHERE MATNR = ITAB-PLNBEZ
            AND SPRAS = SY-LANGU.

   SELECT SINGLE
          BKLAS
          INTO ITAB-BKLAS
          FROM MBEW
          WHERE MATNR = ITAB-PLNBEZ
            AND BWKEY = ITAB-WERKS.

   SELECT SINGLE
          MTART
          INTO ITAB-MTART
          FROM MARA
          WHERE MATNR = ITAB-PLNBEZ.

   SELECT SINGLE
          VKBUR
          INTO ITAB-VKBUR
          FROM VBAK
          WHERE VBELN = ITAB-KDAUF.


   SELECT SINGLE
          WEMNG
          INTO ITAB-GWEMG
          FROM AFPO
          WHERE AUFNR = ITAB-AUFNR.

   CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT‘
      EXPORTING
        INPUT  = ITAB-AUFNR
      IMPORTING
       OUTPUT = ITAB-AUFNR.

   CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_OUTPUT‘
      EXPORTING
        INPUT  = ITAB-PLNBEZ
      IMPORTING
       OUTPUT = ITAB-PLNBEZ.

   MODIFY ITAB.
   CLEAR ITAB.
ENDLOOP.




ENDFORM.                    " FRM_SELECT_DATA



*&---------------------------------------------------------------------*
*&      FORM  DISPLAY_DATA
*&---------------------------------------------------------------------*
*       TEXT
*----------------------------------------------------------------------*
*  -->  P1        TEXT
*  <--  P2        TEXT
*----------------------------------------------------------------------*
FORM FRM_DISPLAY .



    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘AUFNR‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘生产订单编号‘.
    FIELDCAT-SELTEXT_M     = ‘生产订单编号‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘XTZT‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘系统状态‘.
    FIELDCAT-SELTEXT_M     = ‘系统状态‘.
    FIELDCAT-OUTPUTLEN     = 20.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘WERKS‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘工厂‘.
    FIELDCAT-SELTEXT_M     = ‘工厂‘.
    FIELDCAT-OUTPUTLEN     = 10.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘AUART‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘订单类型‘.
    FIELDCAT-SELTEXT_M     = ‘订单类型‘.
    FIELDCAT-OUTPUTLEN     = 8.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘KDAUF‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘销售订单编号‘.
    FIELDCAT-SELTEXT_M     = ‘销售订单编号‘.
    FIELDCAT-OUTPUTLEN     = 12.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘KDPOS‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘销售订单行项目‘.
    FIELDCAT-SELTEXT_M     = ‘销售订单行项目‘.
    FIELDCAT-OUTPUTLEN     = 12.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘VKBUR‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘办事处‘.
    FIELDCAT-SELTEXT_M     = ‘办事处‘.
    FIELDCAT-OUTPUTLEN     = 12.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘PLNBEZ‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘物料编号‘.
    FIELDCAT-SELTEXT_M     = ‘物料编号‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘MAKTX‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘物料描写叙述‘.
    FIELDCAT-SELTEXT_M     = ‘物料描写叙述‘.
    FIELDCAT-OUTPUTLEN     = 35.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘GAMNG‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘订单数量‘.
    FIELDCAT-SELTEXT_M     = ‘订单数量‘.
    FIELDCAT-OUTPUTLEN     = 12.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘GWEMG‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘确认数量‘.
    FIELDCAT-SELTEXT_M     = ‘确认数量‘.
    FIELDCAT-OUTPUTLEN     = 12.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BKLAS‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘评估类‘.
    FIELDCAT-SELTEXT_M     = ‘评估类‘.
    FIELDCAT-OUTPUTLEN     = 10.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘MTART‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘物料类型‘.
    FIELDCAT-SELTEXT_M     = ‘物料类型‘.
    FIELDCAT-OUTPUTLEN     = 10.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘ZPVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘装配-折旧标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘装配-折旧标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘ZPVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘装配-工资标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘装配-工资标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘ZPVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘装配-其它标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘装配-其它标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BZPVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘装配-折旧实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘装配-折旧实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BZPVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘装配-工资实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘装配-工资实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BZPVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘装配-其它实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘装配-其它实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.



    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘ZPKOSTL‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘装配-成本中心‘.
    FIELDCAT-SELTEXT_M     = ‘装配-成本中心‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.









    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘TSVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘调试-折旧标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘调试-折旧标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘TSVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘调试-工资标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘调试-工资标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘TSVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘调试-其它标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘调试-其它标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BTSVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘调试-折旧实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘调试-折旧实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BTSVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘调试-工资实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘调试-工资实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BTSVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘调试-其它实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘调试-其它实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.




    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘TSKOSTL‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘调试-成本中心‘.
    FIELDCAT-SELTEXT_M     = ‘调试-成本中心‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.






    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘LHVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘老化-折旧标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘老化-折旧标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘LHVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘老化-工资标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘老化-工资标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘LHVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘老化-其它标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘老化-其它标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BLHVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘老化-折旧实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘老化-折旧实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BLHVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘老化-工资实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘老化-工资实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BLHVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘老化-其它实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘老化-其它实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.




    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘LHKOSTL‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘老化-成本中心‘.
    FIELDCAT-SELTEXT_M     = ‘老化-成本中心‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.





    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘JYVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘检验-折旧标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘检验-折旧标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘JYVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘检验-工资标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘检验-工资标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘JYVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘检验-其它标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘检验-其它标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BJYVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘检验-折旧实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘检验-折旧实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BJYVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘检验-工资实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘检验-工资实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BJYVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘检验-其它实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘检验-其它实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.



    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘JYKOSTL‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘检验-成本中心‘.
    FIELDCAT-SELTEXT_M     = ‘检验-成本中心‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BZVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘包装-折旧标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘包装-折旧标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BZVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘包装-工资标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘包装-工资标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BZVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘包装-其它标准工时‘.
    FIELDCAT-SELTEXT_M     = ‘包装-其它标准工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BBZVGW01‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘包装-折旧实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘包装-折旧实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BBZVGW02‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘包装-工资实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘包装-工资实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.

    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BBZVGW03‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘包装-其它实际工时‘.
    FIELDCAT-SELTEXT_M     = ‘包装-其它实际工时‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.


    CLEAR FIELDCAT.
    FIELDCAT-FIELDNAME     = ‘BZKOSTL‘.
    FIELDCAT-TABNAME       = ‘ITAB‘.
    FIELDCAT-SELTEXT_S     = ‘包装-成本中心‘.
    FIELDCAT-SELTEXT_M     = ‘包装-成本中心‘.
    FIELDCAT-OUTPUTLEN     = 18.
    APPEND FIELDCAT.



*    CLEAR FIELDCAT.
*    FIELDCAT-FIELDNAME     = ‘ZJVGW01‘.
*    FIELDCAT-TABNAME       = ‘ITAB‘.
*    FIELDCAT-SELTEXT_S     = ‘折旧标准成本‘.
*    FIELDCAT-SELTEXT_M     = ‘折旧标准成本‘.
*    FIELDCAT-OUTPUTLEN     = 18.
*    APPEND FIELDCAT.
*
*
*    CLEAR FIELDCAT.
*    FIELDCAT-FIELDNAME     = ‘GZVGW02‘.
*    FIELDCAT-TABNAME       = ‘ITAB‘.
*    FIELDCAT-SELTEXT_S     = ‘工资标准成本‘.
*    FIELDCAT-SELTEXT_M     = ‘工资标准成本‘.
*    FIELDCAT-OUTPUTLEN     = 18.
*    APPEND FIELDCAT.
*
*    CLEAR FIELDCAT.
*    FIELDCAT-FIELDNAME     = ‘QTVGW03‘.
*    FIELDCAT-TABNAME       = ‘ITAB‘.
*    FIELDCAT-SELTEXT_S     = ‘其它标准成本‘.
*    FIELDCAT-SELTEXT_M     = ‘其它标准成本‘.
*    FIELDCAT-OUTPUTLEN     = 18.
*    APPEND FIELDCAT.
*
*
*
*    CLEAR FIELDCAT.
*    FIELDCAT-FIELDNAME     = ‘BZJVGW01‘.
*    FIELDCAT-TABNAME       = ‘ITAB‘.
*    FIELDCAT-SELTEXT_S     = ‘折旧实际成本‘.
*    FIELDCAT-SELTEXT_M     = ‘折旧实际成本‘.
*    FIELDCAT-OUTPUTLEN     = 18.
*    APPEND FIELDCAT.
*
*
*    CLEAR FIELDCAT.
*    FIELDCAT-FIELDNAME     = ‘BGZVGW02‘.
*    FIELDCAT-TABNAME       = ‘ITAB‘.
*    FIELDCAT-SELTEXT_S     = ‘工资实际成本‘.
*    FIELDCAT-SELTEXT_M     = ‘工资实际成本‘.
*    FIELDCAT-OUTPUTLEN     = 18.
*    APPEND FIELDCAT.
*
*    CLEAR FIELDCAT.
*    FIELDCAT-FIELDNAME     = ‘BQTVGW03‘.
*    FIELDCAT-TABNAME       = ‘ITAB‘.
*    FIELDCAT-SELTEXT_S     = ‘其它实际成本‘.
*    FIELDCAT-SELTEXT_M     = ‘其它实际成本‘.
*    FIELDCAT-OUTPUTLEN     = 18.
*    APPEND FIELDCAT.



*  LAYOUT-colwidth_optimize = ‘X‘.
  CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY‘
    EXPORTING
      I_CALLBACK_PROGRAM       = SY-REPID
      IT_FIELDCAT              = FIELDCAT[]
      I_CALLBACK_PF_STATUS_SET = ‘SET_PF‘
      I_CALLBACK_USER_COMMAND  = ‘USER_COMMAND‘
      I_BACKGROUND_ID          = ‘ALV_BACKGROUND‘
      IS_LAYOUT                = LAYOUT
      I_DEFAULT                = ‘X‘
      I_SAVE                   = ‘A‘
    TABLES
      T_OUTTAB                 = ITAB
    EXCEPTIONS
      OTHERS                   = 2.



ENDFORM.                    " DISPLAY_DATA

*&---------------------------------------------------------------------*
*&      FORM  STANDARD_FULLSCREEN
*&---------------------------------------------------------------------*
*       TEXT
*----------------------------------------------------------------------*
FORM SET_PF USING RT_EXTAB TYPE SLIS_T_EXTAB.

  SET PF-STATUS ‘STANDARD_FULLSCREEN‘.

ENDFORM.                    "SET_STATUS

abap 获取生产订单标准工时和实际报工工时的报表