SAP资产明细报表详解编程语言

前两年别人写的,无自定义表字段。。。直接使用:

*&---------------------------------------------------------------------* 
*& Report  ZFIR026 
*& 
*&---------------------------------------------------------------------* 
*& 
*& 
*&---------------------------------------------------------------------* 
REPORT ZFIR026. 
*&---------------------------------------------------------------------* 
*&  包含                ZFIR101_TOP 
*&---------------------------------------------------------------------* 
TABLES : ANLA,BKPF,KNA1,CSKT, ANLZ,ANLC,ANLB,LFA1,T006A,ANLH,ANEP,T091P,T090NA,ANLP . 
TYPE-POOLS:SLIS. 
DATA : BEGIN OF GT_OUT OCCURS 0 , 
         BUKRS   TYPE ANLA-BUKRS, "公司代码 
         ANLKL   TYPE ANLA-ANLKL, 
         TXK50   TYPE ANKT-TXK50, 
         ANLN1   TYPE ANLA-ANLN1, 
         ANLN2   TYPE ANLA-ANLN2, 
         TXT50   TYPE ANLA-TXT50, 
         TXA50   TYPE ANLA-TXA50, 
         ANLHTXT TYPE ANLH-ANLHTXT, 
         INVZU   TYPE ANLA-INVZU, 
         RAUMN   TYPE ANLZ-RAUMN, 
         SERNR   TYPE ANLA-SERNR, 
         AKTIV   TYPE ANLA-AKTIV, 
         MENGE   TYPE ANLA-MENGE, 
         UNIT    TYPE T006A-MSEHT, 
         KOSTL   TYPE ANLZ-KOSTL, 
         LTEXT   TYPE CSKT-LTEXT, 
         FKBTX   TYPE TFKBT-FKBTX, 
         BELNR   TYPE ANEP-BELNR, 
         ORD42   TYPE ANLA-ORD42, 
         ORD41   TYPE ANLA-ORD41, 
         LIFNR   TYPE ANLA-LIFNR, 
         LIEFE   TYPE LFA1-NAME1, 
         HERST   TYPE ANLA-HERST, 
         XZSRZPZ TYPE ANEP-BELNR,   "新增时入账凭证 
         SYNX    TYPE ANLB-NDJAR ,  "使用年限(月) 
         YTJYF   TYPE ANLA-ORD44 ,  "已计提月份 
         ZCYZ    TYPE ANLC-KANSW ,  "资产原值 
         LJZJ    TYPE ANLC-KNAFA ,  "累计折旧 
         YTJZ    TYPE ANLC-AUFWB ,  "已提减值 
         SYYF    TYPE ANLC-KANSW,   "剩余月份 
         DQJTJE  TYPE ANLP-NAFAZ ,   "当期计提金额 
         ZCJZ    TYPE ANLC-KANSW ,   "资产净值 
         CZ      TYPE ANLC-KANSW,   "残值 
         XSTIL   TYPE ANLZ-XSTIL, 
       END OF GT_OUT . 
 
DATA : GS_OUT LIKE LINE OF GT_OUT . 
 
DATA : GT_ANLA   TYPE TABLE OF ANLA WITH HEADER LINE, 
       GS_ANLA   LIKE LINE OF  GT_ANLA, 
*       GT_ANLA_T  TYPE TABLE OF ANLA WITH HEADER LINE , 
*       GS_ANLA_S  LIKE LINE OF  GT_ANLA_T , 
       GT_ANLB   TYPE TABLE OF ANLB WITH HEADER LINE, 
       GS_ANLB   LIKE LINE OF  GT_ANLB, 
       GT_ANLC   TYPE TABLE OF ANLC WITH HEADER LINE, 
       GS_ANLC   LIKE LINE OF  GT_ANLC, 
       GT_ANLP   TYPE TABLE OF ANLP WITH HEADER LINE, 
       GS_ANLP   LIKE LINE OF  GT_ANLP, 
       GT_ANKT   TYPE TABLE OF ANKT WITH HEADER LINE, 
       GS_ANKT   LIKE LINE OF  GT_ANKT, 
       GT_TFKBT  TYPE TABLE OF TFKBT WITH HEADER LINE, 
       GS_TFKBT  LIKE LINE OF  GT_TFKBT, 
       GT_CSKS   TYPE TABLE OF CSKS WITH HEADER LINE, 
       GS_CSKS   LIKE LINE OF  GT_CSKS, 
       GT_CSKT   TYPE TABLE OF CSKT WITH HEADER LINE, 
       GS_CSKT   LIKE LINE OF  GT_CSKT, 
       GT_BKPF   TYPE TABLE OF BKPF WITH HEADER LINE, 
       GS_BKPF   LIKE LINE OF  GT_BKPF, 
*       GT_BKPF_T  TYPE TABLE OF BKPF WITH HEADER LINE , 
*       GS_BKPF_S  LIKE LINE OF  GT_BKPF_T , 
       GT_LFA1   TYPE TABLE OF LFA1 WITH HEADER LINE, 
       GS_LFA1   LIKE LINE OF  GT_LFA1, 
       GT_T006A  TYPE TABLE OF T006A WITH HEADER LINE, 
       GS_T006A  LIKE LINE OF  GT_T006A, 
*       GT_ANLZ_T  TYPE TABLE OF ANLZ WITH HEADER LINE , 
*       GS_ANLZ_S  LIKE LINE OF  GT_ANLZ_T , 
       GT_ANLZ   TYPE TABLE OF ANLZ WITH HEADER LINE, 
       GS_ANLZ   LIKE LINE OF  GT_ANLZ, 
       GT_ANLH   TYPE TABLE OF ANLH WITH HEADER LINE, 
       GS_ANLH   LIKE LINE OF  GT_ANLH, 
       GT_ANEP   TYPE TABLE OF ANEP WITH HEADER LINE, 
       GS_ANEP   LIKE LINE OF  GT_ANEP, 
       GT_T091P  TYPE TABLE OF T091P WITH HEADER LINE, 
       GS_T091P  LIKE LINE OF  GT_T091P, 
       GT_T090NA TYPE TABLE OF T090NA WITH HEADER LINE, 
       GS_T090NA LIKE LINE OF  GT_T090NA. 
 
 
 
DATA:GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV, 
 
     GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, 
 
     GS_LAYOUT   TYPE SLIS_LAYOUT_ALV. 
 
SELECTION-SCREEN BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-001 . 
*PARAMETERS : P_GJAHR LIKE BKPF-GJAHR . 
SELECT-OPTIONS : 
            S_BUKRS FOR ANLA-BUKRS OBLIGATORY, 
            S_GJAHR FOR BKPF-GJAHR OBLIGATORY NO-EXTENSION NO INTERVALS, 
            S_MONAT FOR ANLP-PERAF , 
            S_ANLKL FOR ANLA-ANLKL , 
            S_ANLN1 FOR ANLA-ANLN1 , 
            S_ANLN2 FOR ANLA-ANLN2 , 
            S_KOSTL FOR ANLZ-KOSTL , 
            S_ORD41 FOR ANLA-ORD41  . 
PARAMETERS P_CH01 AS CHECKBOX DEFAULT 'X'. 
SELECTION-SCREEN END OF BLOCK BLK01 . 
 
 
 
INITIALIZATION . 
 
START-OF-SELECTION . 
 
  PERFORM FRM_GET_DATA . 
 
END-OF-SELECTION . 
 
  PERFORM FRM_FILL_FIELDCAT . 
  PERFORM FRM_FILL_LAYOUT . 
  PERFORM FRM_LIST_DISPLAY . 
 
 
*&---------------------------------------------------------------------* 
*&  包含                ZFIR101_F01 
*&---------------------------------------------------------------------* 
*&---------------------------------------------------------------------* 
*&      Form  FRM_GET_DATA 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM FRM_GET_DATA . 
 
  CLEAR :GT_ANLA[] ,GT_BKPF[] ,GT_ANLZ[], GT_ANLB[],GT_ANLC[], GT_ANLP[],GT_CSKT[],GT_TFKBT[],GT_LFA1[],GT_CSKS[],GT_ANKT[],GT_T006A[],GT_ANLH[],GT_ANEP[],GT_T090NA[],GT_T091P[] . 
 
  DATA:LINE  TYPE I VALUE 0, 
       SUM   TYPE P DECIMALS 2 VALUE 0, 
       YEAR  TYPE BKPF-GJAHR VALUE 0, 
       MONTH TYPE BKPF-MONAT VALUE 0, 
       BZDAT TYPE ANEP-BZDAT VALUE '99991230'. 
 
  IF P_CH01 ='X'. 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANLA 
      FROM ANLA 
*    FOR ALL ENTRIES IN GT_ANLP 
      WHERE BUKRS IN S_BUKRS 
*      BUKRS IN S_BUKRS 
      AND   ANLN1 IN S_ANLN1 
      AND   ANLN2 IN S_ANLN2 
      AND   ANLKL IN S_ANLKL 
      AND   ORD41 IN S_ORD41 . 
  ELSEIF P_CH01 =''. 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANLA 
   FROM ANLA 
*    FOR ALL ENTRIES IN GT_ANLP 
   WHERE BUKRS IN S_BUKRS 
*      BUKRS IN S_BUKRS 
   AND   ANLN1 IN S_ANLN1 
   AND   ANLN2 IN S_ANLN2 
   AND   ANLKL IN S_ANLKL 
   AND   ORD41 IN S_ORD41 
   AND   AKTIV NE 0 . 
  ENDIF . 
 
  IF GT_ANLA[] IS NOT INITIAL. 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANLP 
      FROM ANLP FOR ALL ENTRIES IN GT_ANLA 
      WHERE GJAHR IN S_BUKRS 
      AND   BUKRS EQ GT_ANLA-BUKRS 
      AND   PERAF IN S_MONAT 
      AND   ANLN1 EQ GT_ANLA-ANLN1 
      AND   ANLN2 EQ GT_ANLA-ANLN2. 
 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANLH 
      FROM ANLH FOR ALL ENTRIES IN GT_ANLA 
      WHERE BUKRS EQ GT_ANLA-BUKRS 
      AND ANLN1 EQ GT_ANLA-ANLN1 . 
 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANEP 
      FROM ANEP FOR ALL ENTRIES IN GT_ANLA 
      WHERE  BUKRS EQ GT_ANLA-BUKRS 
       AND   ANLN1 EQ GT_ANLA-ANLN1 
       AND   ANLN2 EQ GT_ANLA-ANLN2. 
 
* 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANKT 
      FROM ANKT FOR ALL ENTRIES IN GT_ANLA 
      WHERE ANLKL = GT_ANLA-ANLKL. 
*    WHERE ANLKL = S_ANLKL . 
* 
* 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_T006A"1 
       FROM T006A FOR ALL ENTRIES IN GT_ANLA 
       WHERE MSEHI = GT_ANLA-MEINS . 
* 
* 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_LFA1 
       FROM LFA1 FOR ALL ENTRIES IN GT_ANLA 
       WHERE LIFNR = GT_ANLA-LIFNR . 
* 
* 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANLZ 
       FROM ANLZ FOR ALL ENTRIES IN GT_ANLA 
       WHERE BUKRS =  GT_ANLA-BUKRS 
       AND   ANLN1 =  GT_ANLA-ANLN1 
       AND   ANLN2 =  GT_ANLA-ANLN2. 
**    去掉成本中心不在选择范围内的值  * 
    IF S_KOSTL IS NOT INITIAL AND GT_ANLZ[] IS NOT INITIAL. 
      DELETE GT_ANLZ WHERE KOSTL NOT IN S_KOSTL. 
      DELETE GT_ANLZ WHERE KOSTL IS INITIAL. 
    ENDIF. 
* 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANLB 
      FROM ANLB FOR ALL ENTRIES IN GT_ANLA 
      WHERE BUKRS =  GT_ANLA-BUKRS 
      AND   ANLN1 =  GT_ANLA-ANLN1 
      AND   ANLN2 =  GT_ANLA-ANLN2. 
* 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_ANLC 
        FROM ANLC 
        FOR ALL ENTRIES IN GT_ANLA 
        WHERE BUKRS =  GT_ANLA-BUKRS 
        AND   ANLN1 =  GT_ANLA-ANLN1 
        AND   ANLN2 =  GT_ANLA-ANLN2. 
 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_CSKS 
        FROM CSKS FOR ALL ENTRIES IN GT_ANLZ 
*      WHERE KOSTL IN S_KOSTL . 
        WHERE KOSTL =  GT_ANLZ-KOSTL . 
 
    IF GT_CSKS[] IS NOT INITIAL. 
      SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_CSKT 
        FROM CSKT FOR ALL ENTRIES IN GT_CSKS 
        WHERE KOSTL =  GT_CSKS-KOSTL 
        AND KOKRS = GT_CSKS-KOKRS . 
 
      SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_TFKBT 
         FROM TFKBT FOR ALL ENTRIES IN GT_CSKS 
         WHERE FKBER =  GT_CSKS-FUNC_AREA . 
    ENDIF. 
 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_T090NA 
      FROM T090NA FOR ALL ENTRIES IN GT_ANLB 
      WHERE AFASL =  GT_ANLB-AFASL . 
 
    SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_T091P 
      FROM T091P FOR ALL ENTRIES IN GT_T090NA 
      WHERE ANHWSL =  GT_T090NA-ANHWSL . 
  ENDIF. 
  SORT GT_ANLZ BY KOSTL DESCENDING ADATU DESCENDING . 
  LOOP AT GT_ANLA INTO GS_ANLA. 
    GS_OUT-BUKRS  = GS_ANLA-BUKRS . 
    GS_OUT-ANLKL  = GS_ANLA-ANLKL . 
    GS_OUT-ANLN1  = GS_ANLA-ANLN1 . 
    GS_OUT-ANLN2  = GS_ANLA-ANLN2 . 
    GS_OUT-TXT50  = GS_ANLA-TXT50 . 
    GS_OUT-TXA50  = GS_ANLA-TXA50 . 
    GS_OUT-SERNR  = GS_ANLA-SERNR . 
    GS_OUT-AKTIV  = GS_ANLA-AKTIV . 
    GS_OUT-MENGE  = GS_ANLA-MENGE . 
*    GS_OUT-MEINS  = GS_ANLA-MEINS . 
    GS_OUT-INVZU = GS_ANLA-INVZU . 
    GS_OUT-ORD42  = GS_ANLA-ORD42 . 
    GS_OUT-ORD41  = GS_ANLA-ORD41 . 
    GS_OUT-LIFNR  = GS_ANLA-LIFNR . 
*    GS_OUT-LIEFE  = GS_ANLA-LIEFE . 
    GS_OUT-HERST  = GS_ANLA-HERST . 
    READ TABLE GT_ANKT INTO GS_ANKT WITH  KEY ANLKL = GS_ANLA-ANLKL  . 
    IF SY-SUBRC = 0 . 
      GS_OUT-TXK50 = GS_ANKT-TXK50 . 
    ENDIF. 
    READ TABLE GT_ANLH INTO GS_ANLH WITH  KEY BUKRS = GS_ANLA-BUKRS 
                                              ANLN1 = GS_ANLA-ANLN1   . 
    IF SY-SUBRC = 0 . 
      GS_OUT-ANLHTXT = GS_ANLH-ANLHTXT. 
    ENDIF. 
 
    READ TABLE GT_LFA1 INTO GS_LFA1 WITH  KEY LIFNR = GS_ANLA-LIFNR . 
    IF SY-SUBRC = 0. 
      GS_OUT-LIEFE = GS_LFA1-NAME1 . 
    ENDIF. 
 
    READ TABLE GT_ANLZ INTO GS_ANLZ WITH  KEY BUKRS = GS_ANLA-BUKRS 
                                              ANLN1 = GS_ANLA-ANLN1 
                                              ANLN2 = GS_ANLA-ANLN2 . 
    IF SY-SUBRC = 0. 
 
      READ TABLE GT_CSKS INTO GS_CSKS WITH  KEY KOSTL = GS_ANLZ-KOSTL . 
      IF SY-SUBRC = 0. 
        GS_OUT-KOSTL = GS_ANLZ-KOSTL . 
        GS_OUT-XSTIL = GS_ANLZ-XSTIL . 
        GS_OUT-RAUMN = GS_ANLZ-RAUMN . 
        READ TABLE GT_CSKT INTO GS_CSKT WITH  KEY KOSTL = GS_ANLZ-KOSTL . 
        IF SY-SUBRC = 0 . 
          GS_OUT-LTEXT = GS_CSKT-LTEXT . 
        ENDIF. 
        READ TABLE GT_TFKBT INTO GS_TFKBT WITH  KEY FKBER = GS_CSKS-FUNC_AREA . 
        IF SY-SUBRC = 0. 
          GS_OUT-FKBTX = GS_TFKBT-FKBTX . 
        ENDIF. 
      ELSE. 
        IF S_KOSTL IS NOT INITIAL. 
          CLEAR GS_OUT. 
          CONTINUE. 
        ENDIF. 
      ENDIF . 
    ELSE. 
      CLEAR GS_OUT. 
      CONTINUE. 
    ENDIF . 
 
    READ TABLE GT_ANLB INTO GS_ANLB WITH  KEY BUKRS = GS_ANLA-BUKRS 
                                              ANLN1 = GS_ANLA-ANLN1 
                                              ANLN2 = GS_ANLA-ANLN2 
                                              AFABE = '01'. 
    IF SY-SUBRC = 0. 
      GS_OUT-SYNX = GS_ANLB-NDJAR * 12 + GS_ANLB-NDPER . 
    ENDIF. 
 
    LOOP AT GT_ANEP INTO GS_ANEP WHERE  BUKRS = GS_ANLA-BUKRS 
                                         AND  ANLN1 = GS_ANLA-ANLN1 
                                         AND  ANLN2 = GS_ANLA-ANLN2 
                                         AND  AFABE = '01' 
                                         AND  BWASL = '100'. 
      IF SY-SUBRC = 0. 
        IF GS_ANEP-LNSAN IS INITIAL . 
          IF GS_ANEP-BZDAT < BZDAT . 
            GS_OUT-XZSRZPZ = GS_ANEP-BELNR. 
            BZDAT = GS_ANEP-BZDAT . 
          ENDIF. 
        ENDIF. 
      ENDIF. 
    ENDLOOP . 
 
 
 
    SORT GT_ANLP BY GJAHR PERAF . 
    LOOP AT  GT_ANLP INTO GS_ANLP WHERE BUKRS = GS_ANLA-BUKRS AND 
                                         ANLN1 = GS_ANLA-ANLN1 AND 
                                         ANLN2 = GS_ANLA-ANLN2 AND 
                                         AFABER = '01' . 
      IF SY-SUBRC = 0. 
        IF YEAR NE GS_ANLP-GJAHR OR MONTH NE GS_ANLP-PERAF. 
          YEAR = GS_ANLP-GJAHR . 
          MONTH = GS_ANLP-PERAF . 
          LINE = LINE + 1 . 
        ENDIF. 
      ENDIF. 
 
    ENDLOOP . 
    IF  SY-SUBRC = 0. 
      GS_OUT-YTJYF = LINE + GS_ANLA-ORD44 . 
    ELSE . 
      GS_OUT-YTJYF = GS_ANLA-ORD44 . 
    ENDIF. 
 
    READ TABLE GT_T006A INTO GS_T006A WITH  KEY MSEHI = GS_ANLA-MEINS. 
    IF SY-SUBRC = 0. 
      GS_OUT-UNIT = GS_T006A-MSEHT . 
    ENDIF. 
    READ TABLE GT_ANLC INTO GS_ANLC WITH  KEY BUKRS = GS_ANLA-BUKRS 
                                              ANLN1 = GS_ANLA-ANLN1 
                                              ANLN2 = GS_ANLA-ANLN2 
                                              AFABE = '01' . 
    IF  SY-SUBRC = 0. 
      GS_OUT-ZCYZ = GS_ANLC-KANSW + GS_ANLC-ANSWL . 
*             GS_OUT-LJZJ = ABSs(GS_ANLC-KNAFA + GS_ANLC-NAFAG)+(GS_ANLC-KAAFA + GS_ANLC-AAFAG) 
      GS_OUT-LJZJ = ABS( GS_ANLC-KNAFA + GS_ANLC-NAFAG + GS_ANLC-KAAFA + GS_ANLC-AAFAG ) . 
      GS_OUT-YTJZ = ABS( GS_ANLC-KAUFW + GS_ANLC-AUFWB ). 
 
    ENDIF. 
 
*    READ TABLE GT_BKPF INTO GS_BKPF WITH KEY  MONAT = GS_ANLA-MONAT 
*                                              BUKRS = GS_ANLA-BUKRS . 
 
 
    LOOP AT  GT_ANLP INTO GS_ANLP WHERE BUKRS = GS_ANLA-BUKRS AND 
                                         ANLN1 = GS_ANLA-ANLN1  AND 
                                         ANLN2 = GS_ANLA-ANLN2. 
      SUM = SUM + GS_ANLP-NAFAZ . 
    ENDLOOP. 
    GS_OUT-DQJTJE = ABS( SUM ) . 
    IF  GS_OUT-ZCYZ - GS_OUT-YTJZ > 0 . 
      GS_OUT-ZCJZ = GS_OUT-ZCYZ - GS_OUT-LJZJ - GS_OUT-YTJZ . 
    ELSE . 
      GS_OUT-ZCJZ = 0 . 
    ENDIF. 
 
    GS_OUT-SYYF = GS_OUT-SYNX - GS_OUT-YTJYF . 
 
    READ TABLE GT_T090NA INTO GS_T090NA WITH  KEY AFASL = GS_ANLB-AFASL . 
    IF SY-SUBRC = 0 . 
      READ TABLE GT_T091P INTO GS_T091P WITH  KEY ANHWSL = GS_T090NA-ANHWSL . 
      IF SY-SUBRC = 0 . 
        GS_OUT-CZ = GS_T091P-AHPROZ / 100 * ( GS_ANLC-KANSW + GS_ANLC-ANSWL ) . 
      ENDIF . 
    ENDIF . 
    APPEND GS_OUT TO  GT_OUT . 
    CLEAR :GS_OUT,GS_ANLA ,GS_BKPF ,GS_ANLZ, GS_ANLB,GS_ANLC, GS_ANLP,GS_CSKT,GS_TFKBT,GS_LFA1,GS_CSKS,GS_ANKT,GS_T006A,GS_ANLH,GS_ANEP,GS_T090NA,GS_T091P . 
    SUM = 0. 
    LINE = 0. 
    YEAR = 0 . 
    MONTH = 0 . 
    BZDAT = '99991230'. 
 
  ENDLOOP . 
  SORT GT_OUT BY ANLN1. 
ENDFORM.                    " FRM_GET_DATA 
*&---------------------------------------------------------------------* 
*&      Form  FRM_LIST_DISPLAY 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM FRM_LIST_DISPLAY . 
*  CHECK GT_OUT[] IS NOT INITIAL . 
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
    EXPORTING 
*     I_INTERFACE_CHECK  = ' ' 
*     I_BYPASSING_BUFFER = ' ' 
*     I_BUFFER_ACTIVE    = 'X' 
      I_CALLBACK_PROGRAM = SY-REPID 
      IS_LAYOUT          = GS_LAYOUT 
      IT_FIELDCAT        = GT_FIELDCAT 
*     IT_EXCLUDING       = 
*     IT_SPECIAL_GROUPS  = 
*     IT_SORT            = 
*     IT_FILTER          = 
*     IS_SEL_HIDE        = 
*     I_DEFAULT          = 'X' 
      I_SAVE             = 'A' 
    TABLES 
      T_OUTTAB           = GT_OUT 
*   EXCEPTIONS 
*     PROGRAM_ERROR      = 1 
*     OTHERS             = 2 
    . 
  IF SY-SUBRC <> 0. 
* Implement suitable error handling here 
  ENDIF. 
 
 
ENDFORM.                    " FRM_LIST_DISPLAY 
 
 
DEFINE SET_FIELDCAT. 
  gs_fieldcat-FIELDNAME = &1. 
  gs_fieldcat-COL_POS = &2. 
  gs_fieldcat-seltext_l = &3. 
  gs_fieldcat-ICON = &4. 
  gs_fieldcat-no_zero = &5. 
  gs_fieldcat-DECIMALS_OUT = &6. 
  APPEND gs_fieldcat to gt_fieldcat. 
END-OF-DEFINITION. 
 
FORM FRM_FILL_FIELDCAT  . 
  CLEAR GS_FIELDCAT . 
  SET_FIELDCAT: 
      'BUKRS' 1 '公司代码' '' '' '', 
      'ANLKL' 2 '资产类别' '' '' '', 
      'TXK50' 3 '资产类别名称' '' '' '', 
      'ANLN1' 4 '资产编号' '' 'X' '', 
      'ANLN2' 5 '资产次级编号' '' 'X' '', 
      'TXT50' 6 '资产名称' '' '' '', 
      'TXA50' 7 '型号' '' '' '', 
      'SERNR' 8 '原资产编号' '' '' '', 
      'AKTIV' 9 '资本化日期' '' '' '', 
      'MENGE' 10 '数量' '' '' '0', 
      'UNIT' 11 '单位' '' '' '', 
      'KOSTL' 12 '成本中心' '' '' '', 
      'LTEXT' 13 '成本中心描述' '' '' '', 
      'FKBTX' 14 '功能范围' '' '' '', 
      'ORD42' 15 '经济用途' '' '' '', 
      'XSTIL' 16 '是否停用' '' '' '', 
      'ORD41' 17 '变动方式' '' '' '', 
      'LIFNR' 18 '供应商编码' '' '' '', 
      'LIEFE' 19 '供应商描述' '' '' '', 
      'HERST' 20 '制造商' '' '' '', 
      'SYNX' 21 '使用年限(月)' '' '' '', 
      'YtjYF' 22 '已计提月份' '' '' '', 
      'ZCYZ' 23 '资产原值' '' '' '', 
      'LJZJ' 24 '累计折旧' '' '' '', 
      'YTJZ' 25 '已提减值' '' '' '', 
      'DQJTJE' 26 '当期计提金额' '' '' '', 
      'ANLHTXT' 27 '文本' '' '' '' , 
      'INVZU' 28 '存放地' '' '' '' , 
      'RAUMN' 29 '保管人' '' '' '' , 
      'XZSRZPZ' 30 '新增时入账凭证' '' '' ''  , 
      'syyf' 31 '剩余月份' '' ''  '0', 
      'CZ' 33 '残值' '' '' '' , 
      'ZCJZ' 32 '资产净值' '' '' ''. 
 
ENDFORM. 
 
*&---------------------------------------------------------------------* 
*&      Form  FRM_FILL_LAYOUT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM FRM_FILL_LAYOUT . 
  GS_LAYOUT-ZEBRA = 'X'. 
  "is_layout-no_keyfix = ''. 
  GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'. 
 
ENDFORM.                    " FRM_FILL_LAYOUT

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/18627.html

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

相关推荐

发表回复

登录后才能评论