• *&---------------------------------------------------------------------*
    *&  包括                ZCNPCRP620Y
    *&---------------------------------------------------------------------*
    **&---------------------------------------------------------------------*
    **&  包括                ZCNPCRP600Y
    **&---------------------------------------------------------------------*
    **&---------------------------------------------------------------------*
    **&      Form  QSYDW_CHANGED
    **&---------------------------------------------------------------------*
    **       text
    **----------------------------------------------------------------------*
    **  -->  p1        text
    **  <--  p2        text
    **----------------------------------------------------------------------*
    FORM qsydw_changed .
      DATA l_num(2TYPE c.             "制度报表表号
      DATA l_itab_alv_all(25TYPE c.   "存储表T_ITAB_ALV_%的名称
      DATA l_wa_itab_alv_all(25TYPE c."存储表T_ITAB_ALV_%的工作区名称
      DATA l_wa_all(15TYPE c.          "存储工作区WA_%的名称
      DATA l_dtablename(15TYPE c.     "数据库实表名
      DATA: l_row LIKE sy-index.
      DATA: l_col TYPE i.

      DATA: BEGIN OF t_itab OCCURS 0, "存储表名
              name(25TYPE c,
      END OF t_itab.

      FIELD-SYMBOLS: <t_itab_alv_all> TYPE STANDARD TABLE,
                     <wa_itab_alv_all>.                         "081110 wz
      FIELD-SYMBOLS: <wa_all> TYPE ANY.
      FIELD-SYMBOLS: <field_col> TYPE ANY.
      FIELD-SYMBOLS: <field_row> TYPE ANY.
      FIELD-SYMBOLS: <field_c0> TYPE ANY.

      """"""""设置表各项数据
      l_num t_bm-zz_bbbm+4(2).
      "1.读取提取数据用到的表名并配置各项
      READ TABLE t_nbm WITH KEY zz_year p_year zz_bh t_bm-zz_bbbm zz_cj 1.
      IF sy-subrc <> 0.
        PERFORM sub_alv_yi USING '' t_bm-zz_bbbm '' 'T_NBM'.
        EXIT.
      ENDIF.
      l_wa_itab_alv_all t_nbm-zz_nb."存储提取数据存放的表名(工作区)
      CONCATENATE l_wa_itab_alv_all '[]' INTO l_itab_alv_all.  "存储提取数据存放的表名
      ASSIGN (l_itab_alv_allTO <t_itab_alv_all>.
      t_itab-name l_wa_itab_alv_all.
      APPEND t_itab.

      "2.读取将要写入的数据库表名并配置各项
      READ TABLE t_ccb WITH KEY zz_year p_year zz_bh t_bm-zz_bbbm.
      IF sy-subrc <> 0.
        PERFORM sub_alv_yi USING '' t_bm-zz_bbbm '' 'T_CCB'.
        EXIT.
      ENDIF.
    *  IF t_ccb-zz_ccb+4(4) = 'R3BW'.
    *    l_dtablename = 'WA_R3BW'.
    *    ASSIGN (l_dtablename) TO <wa_all>."存储将要写入的数据库表用的工作区
    *    l_dtablename = t_ccb-zz_ccb. "存储将要写入的数据库表名
    *  ELSE.
      l_dtablename t_ccb-zz_ccb. "存储将要写入的数据库表名以及所用工作区
      ASSIGN (l_dtablenameTO <wa_all>.
    *  ENDIF.



      """""""处理该表内容
      REFRESH <t_itab_alv_all>.
      CLEAR <t_itab_alv_all>.

      IMPORT (t_itabFROM DATABASE zhr_bb001(20ID srtfd_ej.  "快报与制度报表使用02
      REFRESH t_itab.
      IF NOT <t_itab_alv_all> IS INITIAL.
        CLEAR: <wa_all>,l_row .
        l_row 1.
        LOOP AT <t_itab_alv_all> ASSIGNING  <wa_itab_alv_all>.  "081110 wz 行循环
          ASSIGN COMPONENT 'C0' OF STRUCTURE <wa_itab_alv_all> TO <field_c0>.  "用于出错时判定
          ASSIGN COMPONENT 'ZZ_SRTFD' OF STRUCTURE <wa_all> TO <field_col>.    "记录标识ID
          <field_col> srtfd_ej.
          ASSIGN COMPONENT 'ZZ_QSYBM' OF STRUCTURE <wa_all> TO <field_col>.    "企事业单位编码
          <field_col> persa_tab-zz_qsybm.
          ASSIGN COMPONENT 'ZZ_TBZQ' OF STRUCTURE <wa_all> TO <field_col>.     "报送周期
          <field_col> p_tbzq.
          ASSIGN COMPONENT 'ZZ_BSSJ' OF STRUCTURE <wa_all> TO <field_col>.     "报表截止日期
          <field_col> l_year_end.
    *      IF t_ccb-zz_ccb+6(1) = 'K'.
    *      ASSIGN COMPONENT 'ZZ_KJIA' OF STRUCTURE <wa_all> TO <field_col>.      "行项目名称
    *      ELSE.
          ASSIGN COMPONENT 'ZZ_JIA' OF STRUCTURE <wa_all> TO <field_col>.      "行项目名称
    *      ENDIF.
          READ TABLE t_by WITH KEY zz_bh t_bm-zz_bbbm zz_hl zz_num l_row.
          IF sy-subrc NE 0.
            PERFORM sub_alv_yi USING <field_c0> l_num '' ''.
            CLEAR <wa_all>.
            CONTINUE.
          ENDIF.
          <field_col> t_by-zz_domin.
          LOOP AT t_by WHERE zz_bh t_bm-zz_bbbm AND zz_hl 1.
            "20100416zhenxd增加
            IF t_by-zz_sign 'X'.
              CONTINUE.
            ENDIF.
            "20100416END
            l_col + t_by-zz_num.
    *        IF t_ccb-zz_ccb+6(1) = 'K'.
    *        ASSIGN COMPONENT 'ZZ_KJIALIE' OF STRUCTURE <wa_all> TO <field_col>.   "列项目名称
    *        ELSE.
            ASSIGN COMPONENT 'ZZ_JIALIE' OF STRUCTURE <wa_all> TO <field_col>.   "列项目名称
    *        ENDIF.
            <field_col> =  t_by-zz_domin.
            ASSIGN COMPONENT l_col OF STRUCTURE <wa_itab_alv_all> TO <field_row>."081110 wz 列值
            ASSIGN COMPONENT 'ZZ_SHULIANG' OF STRUCTURE <wa_all> TO <field_col>. "数量
            <field_col> =  <field_row>.
            ASSIGN COMPONENT 'MANDT' OF STRUCTURE <wa_all> TO <field_col>.
            <field_col> sy-mandt.
            MODIFY (l_dtablenameFROM <wa_all> .
            IF sy-subrc NE 0.
              PERFORM sub_alv_yi USING <field_c0> l_num t_by-zz_num ''.
            ENDIF.
          ENDLOOP.
          l_row l_row + 1.
        ENDLOOP.
      ELSE.
        PERFORM sub_alv_yi USING '' l_num '' ''.
      ENDIF.

    ENDFORM.                    " QSYDW_CHANGED

    *&---------------------------------------------------------------------*
    *&      Form  SUB_ALV_YI
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->FIELD_C0   text
    *      -->FIELD_SIGN text
    *----------------------------------------------------------------------*
    FORM sub_alv_yi USING field_c0                      "出错行显示
                           field_sign TYPE i            "调用值,1:没有导入成功  其他:空表
                           l_num                        "制度报表表号
                           l_counter                   "出错列显示
                           l_table.                           "维护错误的配置表
      t_err_tab-err_c0 field_c0.
      t_err_tab-zz_qsybm =  persa_tab-zz_qsybm.
      t_err_tab-p_tabna t_bm-zz_bbbm.
      t_err_tab-row_c0 l_counter.
      CASE field_sign.
        WHEN 1.
          CONCATENATE   persa_tab-zz_qsymc '的制度报表' l_num '表数据没有导入成功' INTO message.
        WHEN 2.
          CONCATENATE   persa_tab-zz_qsymc '的制度报表' l_num '表是空表' INTO message.
        WHEN 3.
          CONCATENATE   persa_tab-zz_qsymc '的制度报表' l_num '配置表' l_table '维护出错!' INTO message.
      ENDCASE.
      t_err_tab-p_msg =  message.
      APPEND t_err_tab.
      CLEAR  t_err_tab.
    ENDFORM.                    "SUB_ALV

  • 相关阅读:
    November 13th 2016 Week 47th Sunday The 1st Day
    November 12th 2016 Week 46th Saturday
    November 11th 2016 Week 46th Friday
    November 10th 2016 Week 46th Thursday
    November 9th 2016 Week 46th Wednesday
    November 8th 2016 Week 46th Tuesday
    windows 7文件共享方法
    Win7无线网络共享设置方法
    常量指针和指针常量
    如何查找局域网的外网ip
  • 原文地址:https://www.cnblogs.com/purehunter/p/2332024.html
Copyright © 2020-2023  润新知