ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ZR_FI_003

ZR_FI_003

原创 Linux操作系统 作者:williamzhou 时间:2019-03-07 16:36:05 0 删除 编辑

*===============================基本信息===============================*
* 标题:存货进出分析报表
* 创建日期:2004-12-15       
*===============================定    义===============================*

************************************************************************
* 基本代码
************************************************************************
REPORT ZR_FI_003
NO STANDARD PAGE HEADING
LINE-COUNT 65
LINE-SIZE  125
MESSAGE-ID ZFI1.

************************************************************************
* INCLUDE:包含文件
************************************************************************
INCLUDE OLE2INCL.

************************************************************************
* TABLE: 定义TABLE
************************************************************************
TABLES: T001,  "公司代码
        GLT0,  "总帐科目主记录业务额
        ANLC.  "资产值字段
************************************************************************
*INTERNAL TABLES
************************************************************************
*定义内表ITABS(作为辅助使用)
  DATA: BEGIN OF ITAB OCCURS 10.
        INCLUDE STRUCTURE GLT0.
  DATA: END OF ITAB.

*定义内表ITAB_ZJ1本月增加)
DATA: BEGIN OF ITAB_ZJ1 OCCURS 0,
        YCL TYPE P DECIMALS 2,      "原材料
        BCP TYPE P DECIMALS 2,      "半成品
        ZZP TYPE P DECIMALS 2,      "在制品
        CCP TYPE P DECIMALS 2,      "产成品
        MJ  TYPE P DECIMALS 2,      "产成品-模具
        TOTAL TYPE P DECIMALS 2,    "合计
      END OF ITAB_ZJ1.
*内表(ITAB_JS1本月减少)、(ITAB_ZJCD1资金沉淀)
DATA: ITAB_JS1 LIKE ITAB_ZJ1 OCCURS 10 WITH HEADER LINE.
DATA: ITAB_ZJCD1 LIKE ITAB_ZJ1 OCCURS 10 WITH HEADER LINE.

DATA: ITAB_ZJ2 LIKE ITAB_ZJ1 OCCURS 10 WITH HEADER LINE.
DATA: ITAB_JS2 LIKE ITAB_ZJ1 OCCURS 10 WITH HEADER LINE.
DATA: ITAB_ZJCD2 LIKE ITAB_ZJ1 OCCURS 10 WITH HEADER LINE.

*往数据库增加运行日志
  DATA: BEGIN OF IT_ZREPORTLOG OCCURS  0.
    INCLUDE TYPE ZREPORTLOG.
  DATA: END OF IT_ZREPORTLOG.

************************************************************************
* CONSTANTS : 定义常量
************************************************************************

************************************************************************
* TYPE : 定义数据类型
************************************************************************
TYPE-POOLS: SLIS.

************************************************************************
* DATA : 定义变量
************************************************************************
*单据表格上相关坐标值定义
DATA: A1 TYPE I VALUE 0,
      A2 TYPE I VALUE 0,
      A3 TYPE I VALUE 0,
      A4 TYPE I VALUE 0,
      A5 TYPE I VALUE 0,
      A6 TYPE I VALUE 0,
      A7 TYPE I VALUE 0,
      A8 TYPE I VALUE 0.

DATA: B1 TYPE I VALUE 0,
      B2 TYPE I VALUE 0,
      B3 TYPE I VALUE 0,
      B4 TYPE I VALUE 0,
      B5 TYPE I VALUE 0,
      B6 TYPE I VALUE 0,
      B7 TYPE I VALUE 0.

DATA: NAME_LAST LIKE USER_ADDR-NAME_LAST,
      NAME_FIRST LIKE USER_ADDR-NAME_FIRST,
      NAME(16).

DATA: TAMOUNT1 LIKE GLT0-HSLVT,    "本期数
      TAMOUNT2 LIKE GLT0-HSLVT.    "本年累计数
************************************************************************
* DEFINE: 定义宏
************************************************************************
*普通报表格式的输出宏
DEFINE GRID.               "画表格
  WRITE: AT /A1   SY-VLINE.
  WRITE: AT  B1   &1 RIGHT-JUSTIFIED.
  WRITE: AT  A2   SY-VLINE.
  WRITE: AT  B2   &2 RIGHT-JUSTIFIED.
  WRITE: AT  A3   SY-VLINE.
  WRITE: AT  B3   &3 RIGHT-JUSTIFIED.
  WRITE: AT  A4   SY-VLINE.
  WRITE: AT  B4   &4.
  WRITE: AT  A5   SY-VLINE.
  WRITE: AT  B5   &5 RIGHT-JUSTIFIED.
  WRITE: AT  A6   SY-VLINE.
  WRITE: AT  B6   &6 RIGHT-JUSTIFIED.
  WRITE: AT  A7   SY-VLINE.
  WRITE: AT  B7   &7 RIGHT-JUSTIFIED.
  WRITE: AT  A8   SY-VLINE.
END-OF-DEFINITION.
************************************************************************
*  SELECTION SCREEN : 定义报表筛选条件
************************************************************************
*确定过滤参数
SELECTION-SCREEN BEGIN OF BLOCK BLK_001 WITH FRAME. TITLE BLK_001 .
    PARAMETERS : P_BUKRS LIKE GLT0-BUKRS OBLIGATORY DEFAULT '1000'."公司代码
    PARAMETERS : P_RYEAR(4) TYPE C OBLIGATORY DEFAULT SY-DATUM+0(4)."报表年度
    PARAMETERS : P_PERID(2) TYPE C OBLIGATORY DEFAULT SY-DATUM+4(2)."报表期间
SELECTION-SCREEN END OF BLOCK BLK_001.

*选择报表类型
SELECTION-SCREEN BEGIN OF BLOCK BLK_002 WITH FRAME. TITLE BLK_002 .
PARAMETERS: P_REPORT RADIOBUTTON GROUP R1 DEFAULT 'X',
            P_ALV RADIOBUTTON GROUP R1 ,
            P_FORM. RADIOBUTTON GROUP R1.
SELECTION-SCREEN END OF BLOCK BLK_002.

*选择文件
*代码“NO-DISPLAY”的作用:隐藏参数
SELECTION-SCREEN BEGIN OF BLOCK BLK_003 WITH FRAME. TITLE BLK_003 .
PARAMETERS: P_FILE LIKE CFFILE-FILENAME NO-DISPLAY  .
SELECTION-SCREEN END OF BLOCK BLK_003.

*===============================事    件===============================*
************************************************************************
* INITIALIZATION.启动程序开始执行
************************************************************************
INITIALIZATION.
  BLK_001 = '检索参数'.
  BLK_002 = '报表类型'.
  BLK_003 = '文件参数'.
  PERFORM. SUB_INI.
************************************************************************
* AT SELECTION SCREEN:
************************************************************************
AT SELECTION-SCREEN.
  PERFORM. F_CHECK_INPUT.          "检查用户输入
************************************************************************
* START OF SELECTION:
************************************************************************
START-OF-SELECTION.
*往数据库增加运行日志
  IT_ZREPORTLOG-MANDT = SY-MANDT.
  IT_ZREPORTLOG-TCODE = SY-TCODE.
  IT_ZREPORTLOG-DATUM = SY-DATUM.
  IT_ZREPORTLOG-UZEIT = SY-UZEIT.
  IT_ZREPORTLOG-UNAME = SY-UNAME.
  IT_ZREPORTLOG-TITLE = SY-TITLE.
  APPEND IT_ZREPORTLOG.
  INSERT INTO ZREPORTLOG VALUES IT_ZREPORTLOG .

  PERFORM. F_READ_DATA.
  PERFORM. F_PRINT_REPORT.
************************************************************************
* END OF SELECTION
************************************************************************
END-OF-SELECTION.

************************************************************************
* TOP OF PAGE
************************************************************************
TOP-OF-PAGE.
  PERFORM. SUB_HEAD.
************************************************************************
* END OF PAGE
************************************************************************
END-OF-PAGE.
  PERFORM. SUB_BOTTOM.
************************************************************************
* LINE SELECTION
************************************************************************
AT LINE-SELECTION .

************************************************************************
* AT PFXX:
************************************************************************
  AT PFXX.

************************************************************************
* AT USER-COMMAND
************************************************************************
AT USER-COMMAND.


*===============================子 例 程===============================*
*&---------------------------------------------------------------------*
*过滤条件有效性检查
*&---------------------------------------------------------------------*
FORM. F_CHECK_INPUT.
  IF P_PERID+1(1) = ''.
    CONCATENATE '0' P_PERID INTO P_PERID.
  ENDIF.

  IF ( P_PERID < '01' ) OR ( P_PERID > '16' ).
    MESSAGE E000.    "该会计期间不存在!
  ENDIF.
ENDFORM.                    " F_CHECK_INPUT
*&---------------------------------------------------------------------*
*从数据库中读取数据,填充报表输出时所用的内表
*&---------------------------------------------------------------------*
FORM. F_READ_DATA .
  SELECT *
    FROM GLT0
    INTO CORRESPONDING FIELDS OF TABLE ITAB
   WHERE BUKRS = P_BUKRS AND RYEAR = P_RYEAR  "公司代码、会计年度
    AND ( RACCT = '0012110001' OR RACCT = '0012410001' OR
          RACCT = '0012430001' OR RACCT = '0012430003' OR
          RACCT = '0012430004' OR RACCT = '0012430005' OR
          RACCT = '0012450001' OR RACCT = '0012450002' OR
          RACCT = '0012450003').

*开始循环
  LOOP AT ITAB.
   CASE P_PERID.
    WHEN '01'.
      TAMOUNT1 = ITAB-HSL01.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01.
    WHEN '02'.
      TAMOUNT1 = ITAB-HSL02.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02.
    WHEN '03'.
      TAMOUNT1 = ITAB-HSL03.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03.
    WHEN '04'.
      TAMOUNT1 = ITAB-HSL04.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04.
    WHEN '05'.
      TAMOUNT1 = ITAB-HSL05.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05.
    WHEN '06'.
      TAMOUNT1 = ITAB-HSL06.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06.
    WHEN '07'.
      TAMOUNT1 = ITAB-HSL07.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07.
    WHEN '08'.
      TAMOUNT1 = ITAB-HSL08.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08.
    WHEN '09'.
      TAMOUNT1 = ITAB-HSL09.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09.
    WHEN '10'.
      TAMOUNT1 = ITAB-HSL10.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09 + ITAB-HSL10.
    WHEN '11'.
      TAMOUNT1 = ITAB-HSL11.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09 + ITAB-HSL10 + ITAB-HSL11.
    WHEN '12'.
      TAMOUNT1 = ITAB-HSL12.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09 + ITAB-HSL10 + ITAB-HSL11
                   + ITAB-HSL12.
    WHEN '13'.
      TAMOUNT1 = ITAB-HSL13.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09 + ITAB-HSL10 + ITAB-HSL11
                   + ITAB-HSL12 + ITAB-HSL13.
    WHEN '14'.
      TAMOUNT1 = ITAB-HSL14.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09 + ITAB-HSL10 + ITAB-HSL11
                   + ITAB-HSL12 + ITAB-HSL13 + ITAB-HSL14.
    WHEN '15'.
      TAMOUNT1 = ITAB-HSL15.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09 + ITAB-HSL10 + ITAB-HSL11
                   + ITAB-HSL12 + ITAB-HSL13 + ITAB-HSL14 + ITAB-HSL15.
    WHEN '16'.
      TAMOUNT1 = ITAB-HSL16.
      TAMOUNT2 = ITAB-HSLVT + ITAB-HSL01 + ITAB-HSL02 + ITAB-HSL03
                   + ITAB-HSL04 + ITAB-HSL05 + ITAB-HSL06 + ITAB-HSL07
                   + ITAB-HSL08 + ITAB-HSL09 + ITAB-HSL10 + ITAB-HSL11
                   + ITAB-HSL12 + ITAB-HSL13 + ITAB-HSL14 + ITAB-HSL15
                   + ITAB-HSL16.
   ENDCASE.

*  汇总明细科目
   "取松霖、易洁的数据
   IF ( P_BUKRS = '1000' ) OR ( P_BUKRS = '3000' ) OR ( P_BUKRS = '5000' ).
     PERFORM. F_SOLEXDATA.
   ELSEIF P_BUKRS = '2000'.
   "取精周的数据
     PERFORM. F_MPSDATA.
   ENDIF.

   MODIFY ITAB_ZJ1 INDEX SY-TABIX.
   MODIFY ITAB_ZJ2 INDEX SY-TABIX.
   MODIFY ITAB_JS1 INDEX SY-TABIX.
   MODIFY ITAB_JS2 INDEX SY-TABIX.
  ENDLOOP.

  PERFORM. SUB_TOTAL.         "最终数据合计及总计
ENDFORM.                    " F_READ_DATA
*&---------------------------------------------------------------------*
*&      取松霖、易洁的数据
*&---------------------------------------------------------------------*
FORM. F_SOLEXDATA.
   CASE ITAB-RACCT.
      "原材料
      WHEN '0012110001'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-YCL = ITAB_ZJ1-YCL + TAMOUNT1 ."本月
          ITAB_ZJ2-YCL = ITAB_ZJ2-YCL + TAMOUNT2."本年
        ELSE.
          ITAB_JS1-YCL = ITAB_JS1-YCL + TAMOUNT1 .
          ITAB_JS2-YCL = ITAB_JS2-YCL + TAMOUNT2 .
        ENDIF.
      "半成品
      WHEN '0012410001'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-BCP = ITAB_ZJ1-BCP + TAMOUNT1 .
          ITAB_ZJ2-BCP = ITAB_ZJ2-BCP + TAMOUNT2 .
        ELSE.
          ITAB_JS1-BCP = ITAB_JS1-BCP + TAMOUNT1 .
          ITAB_JS2-BCP = ITAB_JS2-BCP + TAMOUNT2 .
        ENDIF.
      "在制品
      WHEN '0012450001' OR '0012450002' OR '0012450003'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-ZZP = ITAB_ZJ1-ZZP + TAMOUNT1 .
          ITAB_ZJ2-ZZP = ITAB_ZJ2-ZZP + TAMOUNT2 .
        ELSE.
          ITAB_JS1-ZZP = ITAB_JS1-ZZP + TAMOUNT1 .
          ITAB_JS2-ZZP = ITAB_JS2-ZZP + TAMOUNT2 .
        ENDIF.
      "产成品
      WHEN '0012430001' OR '0012430003' OR '0012430004'
           OR '0012430005'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-CCP = ITAB_ZJ1-CCP + TAMOUNT1 .
          ITAB_ZJ2-CCP = ITAB_ZJ2-CCP + TAMOUNT2 .
        ELSE.
          ITAB_JS1-CCP = ITAB_JS1-CCP + TAMOUNT1 .
          ITAB_JS2-CCP = ITAB_JS2-CCP + TAMOUNT2 .
        ENDIF.
   ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*&      取精周的数据
*&---------------------------------------------------------------------*
FORM. F_MPSDATA.
   CASE ITAB-RACCT.
      "原材料
      WHEN '0012110001'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-YCL = ITAB_ZJ1-YCL + TAMOUNT1 ."本月
          ITAB_ZJ2-YCL = ITAB_ZJ2-YCL + TAMOUNT2."本年
        ELSE.
          ITAB_JS1-YCL = ITAB_JS1-YCL + TAMOUNT1 .
          ITAB_JS2-YCL = ITAB_JS2-YCL + TAMOUNT2 .
        ENDIF.
      "半成品
      WHEN '0012410001'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-BCP = ITAB_ZJ1-BCP + TAMOUNT1 .
          ITAB_ZJ2-BCP = ITAB_ZJ2-BCP + TAMOUNT2 .
        ELSE.
          ITAB_JS1-BCP = ITAB_JS1-BCP + TAMOUNT1 .
          ITAB_JS2-BCP = ITAB_JS2-BCP + TAMOUNT2 .
        ENDIF.
      "在制品
      WHEN '0012450001' OR '0012450002' OR '0012450003'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-ZZP = ITAB_ZJ1-ZZP + TAMOUNT1 .
          ITAB_ZJ2-ZZP = ITAB_ZJ2-ZZP + TAMOUNT2 .
        ELSE.
          ITAB_JS1-ZZP = ITAB_JS1-ZZP + TAMOUNT1 .
          ITAB_JS2-ZZP = ITAB_JS2-ZZP + TAMOUNT2 .
        ENDIF.
      "产成品
      WHEN '0012430001' OR '0012430003' OR '0012430004'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-CCP = ITAB_ZJ1-CCP + TAMOUNT1 .
          ITAB_ZJ2-CCP = ITAB_ZJ2-CCP + TAMOUNT2 .
        ELSE.
          ITAB_JS1-CCP = ITAB_JS1-CCP + TAMOUNT1 .
          ITAB_JS2-CCP = ITAB_JS2-CCP + TAMOUNT2 .
        ENDIF.
     WHEN '0012430005'.
        IF ITAB-DRCRK = 'S'.   "本月增加(借方数据)
          ITAB_ZJ1-MJ = ITAB_ZJ1-MJ + TAMOUNT1 .
          ITAB_ZJ2-MJ = ITAB_ZJ2-MJ + TAMOUNT2 .
        ELSE.
          ITAB_JS1-MJ = ITAB_JS1-MJ + TAMOUNT1 .
          ITAB_JS2-MJ = ITAB_JS2-MJ + TAMOUNT2 .
        ENDIF.
   ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*&      最终数据合计及总计
*&---------------------------------------------------------------------*
FORM. SUB_TOTAL.
  "计算资金沉淀
  ITAB_ZJCD1-YCL = ITAB_ZJ1-YCL + ITAB_JS1-YCL.
  ITAB_ZJCD1-BCP = ITAB_ZJ1-BCP + ITAB_JS1-BCP.
  ITAB_ZJCD1-ZZP = ITAB_ZJ1-ZZP + ITAB_JS1-ZZP.
  ITAB_ZJCD1-CCP = ITAB_ZJ1-CCP + ITAB_JS1-CCP.
  ITAB_ZJCD1-MJ = ITAB_ZJ1-MJ + ITAB_JS1-MJ.

  ITAB_ZJCD2-YCL = ITAB_ZJ2-YCL + ITAB_JS2-YCL.
  ITAB_ZJCD2-BCP = ITAB_ZJ2-BCP + ITAB_JS2-BCP.
  ITAB_ZJCD2-ZZP = ITAB_ZJ2-ZZP + ITAB_JS2-ZZP.
  ITAB_ZJCD2-CCP = ITAB_ZJ2-CCP + ITAB_JS2-CCP.
  ITAB_ZJCD2-MJ = ITAB_ZJ2-MJ + ITAB_JS2-MJ.
  "计算合计
  ITAB_ZJ1-TOTAL = ITAB_ZJ1-YCL + ITAB_ZJ1-BCP + ITAB_ZJ1-ZZP +
                   ITAB_ZJ1-CCP + ITAB_ZJ1-MJ.
  ITAB_JS1-TOTAL = ITAB_JS1-YCL + ITAB_JS1-BCP + ITAB_JS1-ZZP +
                   ITAB_JS1-CCP + ITAB_JS1-MJ.
  ITAB_ZJCD1-TOTAL = ITAB_ZJCD1-YCL + ITAB_ZJCD1-BCP +
                   ITAB_ZJCD1-ZZP + ITAB_ZJCD1-CCP + ITAB_ZJCD1-MJ.

  ITAB_ZJ2-TOTAL = ITAB_ZJ2-YCL + ITAB_ZJ2-BCP + ITAB_ZJ2-ZZP +
                   ITAB_ZJ2-CCP + ITAB_ZJ2-MJ.
  ITAB_JS2-TOTAL = ITAB_JS2-YCL + ITAB_JS2-BCP + ITAB_JS2-ZZP +
                   ITAB_JS2-CCP + ITAB_JS2-MJ.
  ITAB_ZJCD2-TOTAL = ITAB_ZJCD2-YCL + ITAB_ZJCD2-BCP +
                   ITAB_ZJCD2-ZZP + ITAB_ZJCD2-CCP + ITAB_ZJCD2-MJ.

  MODIFY ITAB_ZJ1 INDEX SY-TABIX.
  MODIFY ITAB_ZJ2 INDEX SY-TABIX.
  MODIFY ITAB_JS1 INDEX SY-TABIX.
  MODIFY ITAB_JS2 INDEX SY-TABIX.
  MODIFY ITAB_ZJCD1 INDEX SY-TABIX.
  MODIFY ITAB_ZJCD2 INDEX SY-TABIX.
ENDFORM.
*&---------------------------------------------------------------------*
*普通报表格式的打印
*&---------------------------------------------------------------------*
FORM. F_PRINT_REPORT.
  ULINE.
  ITAB_JS1-YCL = 0 - ITAB_JS1-YCL.
  ITAB_JS2-YCL = 0 - ITAB_JS2-YCL.
  GRID ITAB_ZJ1-YCL ITAB_JS1-YCL ITAB_ZJCD1-YCL '     原材料'
       ITAB_ZJ2-YCL ITAB_JS2-YCL ITAB_ZJCD2-YCL.
  ULINE.

  ITAB_JS1-BCP = 0 - ITAB_JS1-BCP.
  ITAB_JS2-BCP = 0 - ITAB_JS2-BCP.
  GRID ITAB_ZJ1-BCP ITAB_JS1-BCP ITAB_ZJCD1-BCP '     半成品'
       ITAB_ZJ2-BCP ITAB_JS2-BCP ITAB_ZJCD2-BCP.
  ULINE.

  ITAB_JS1-ZZP = 0 - ITAB_JS1-ZZP.
  ITAB_JS2-ZZP = 0 - ITAB_JS2-ZZP.
  GRID ITAB_ZJ1-ZZP ITAB_JS1-ZZP ITAB_ZJCD1-ZZP '     在制品'
       ITAB_ZJ2-ZZP ITAB_JS2-ZZP ITAB_ZJCD2-ZZP.
  ULINE.

  ITAB_JS1-CCP = 0 - ITAB_JS1-CCP.
  ITAB_JS2-CCP = 0 - ITAB_JS2-CCP.
  GRID ITAB_ZJ1-CCP ITAB_JS1-CCP ITAB_ZJCD1-CCP '     产成品'
       ITAB_ZJ2-CCP ITAB_JS2-CCP ITAB_ZJCD2-CCP.
  ULINE.

  IF P_BUKRS = '2000'.
    ITAB_JS1-MJ = 0 - ITAB_JS1-MJ.
    ITAB_JS2-MJ = 0 - ITAB_JS2-MJ.
    GRID ITAB_ZJ1-MJ ITAB_JS1-MJ ITAB_ZJCD1-MJ '  产成品-模具'
         ITAB_ZJ2-MJ ITAB_JS2-MJ ITAB_ZJCD2-MJ.
    ULINE.
  ENDIF.

  ITAB_JS1-TOTAL = 0 - ITAB_JS1-TOTAL.
  ITAB_JS2-TOTAL = 0 - ITAB_JS2-TOTAL.
  GRID ITAB_ZJ1-TOTAL ITAB_JS1-TOTAL ITAB_ZJCD1-TOTAL '     合计'
       ITAB_ZJ2-TOTAL ITAB_JS2-TOTAL ITAB_ZJCD2-TOTAL.
  ULINE.

  PERFORM. SUB_BOTTOM.
ENDFORM.                     " F_PRINT_REPORT
*&---------------------------------------------------------------------*
*&      单据表头显示
*&---------------------------------------------------------------------*
FORM. SUB_HEAD.
DATA:L_COMP(16).

  "取公司名称
  IF P_BUKRS = '1000'.
    L_COMP = '松霖卫浴管理报表'.
  ELSEIF P_BUKRS = '2000'.
    L_COMP = '益周塑胶管理报表'.
  ELSEIF P_BUKRS = '3000'.
    L_COMP = '易洁卫浴管理报表'.
  ELSEIF P_BUKRS = '4000'.
    L_COMP = '玩铜五金管理报表'.
 ELSEIF P_BUKRS = '5000'.
    L_COMP = '松霖科技管理报表'.
 ENDIF.

  WRITE: /50 P_RYEAR,'年',P_PERID,'月',L_COMP.
  SKIP.
  WRITE: 60 '存货进出分析'.
  WRITE: AT 105 '单位:不含税人民币元'.
  ULINE.

  GRID '    本月增加' '     本月减少' '  本月资金沉淀' '     存货项目'
       '  本年累计增加' '  本年累计减少' '本年累计资金沉淀'.
ENDFORM.                    " SUB_OUTPUTHEAD
*&---------------------------------------------------------------------
*&      单据表尾显示
*&---------------------------------------------------------------------
FORM. SUB_BOTTOM.
*取制单人
 CLEAR NAME_LAST.
 CLEAR NAME_FIRST.
 CLEAR NAME.
 SELECT NAME_LAST NAME_FIRST
      FROM USER_ADDR
   INTO (NAME_LAST, NAME_FIRST)
   WHERE BNAME = SY-UNAME .   "取logon 帐号
 ENDSELECT.
 CONCATENATE NAME_LAST(4) NAME_FIRST(8) INTO NAME.

 WRITE: AT 70  '操作员:',NAME+0(10) LEFT-JUSTIFIED .
 WRITE: AT 95 '打印时间:',SY-DATUM,SY-UZEIT.
ENDFORM.                    "SUB_BOTTOM
*&---------------------------------------------------------------------*
*&      单据表格上相关坐标值初始
*&---------------------------------------------------------------------*
FORM. SUB_INI .
  MOVE 1   TO  A1.   "本月增加
  MOVE 2   TO  B1.
  MOVE 18  TO  A2.   "本月减少
  MOVE 19  TO  B2.
  MOVE 36  TO  A3.   "资金沉淀
  MOVE 37  TO  B3.
  MOVE 54  TO  A4.   "存货项目
  MOVE 55  TO  B4.
  MOVE 72  TO  A5.   "本年累计增加
  MOVE 73  TO  B5.
  MOVE 90  TO  A6.   "本年累计减少
  MOVE 91  TO  B6.
  MOVE 108  TO  A7.   "本年累计资金沉淀
  MOVE 109 TO  B7.
  MOVE 125 TO  A8.
ENDFORM.                    " SUB_INI

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/765243/viewspace-253285/,如需转载,请注明出处,否则将追究法律责任。

上一篇: ZR_FI_001
下一篇: ZR_FI_005
请登录后发表评论 登录
全部评论

注册时间:2006-03-01

  • 博文量
    28
  • 访问量
    19808