SAP 取得因为折旧价值变动的固定资产的方法

由于需要将固定资产价值变动后的数据实时传送给OA系统,找了很多都只到期间,最后想了个间接的方法,通过科目变动去判断固定资产价值有没有变动。

目前使用折旧科目进行判断,后期可以加入固定资产价值变动的其他科目。

 DATA:LT_ASSET_INFO TYPE STANDARD TABLE OF    ZSFI008,
       LS_ASSET_INFO TYPE ZSFI008.
  FIELD-SYMBOLS  : <LT_PAY_DATA>   TYPE ANY TABLE .
  FIELD-SYMBOLS : <LT_TEST> TYPE ANY . "LIKE LINE OF  it_tab .
  DATA LR_PAY_DATA  TYPE REF TO DATA.
RANGES:LR_SAKNR FOR SKA1-SAKNR."定义折旧科目
"根据折旧科目日期去取价值变动的资产,用于下传OA
  LR_SAKNR-SIGN = 'I'.
  LR_SAKNR-OPTION = 'EQ'.
  LR_SAKNR-LOW = '1602010001'.
  APPEND LR_SAKNR.
  CLEAR LR_SAKNR.
  LR_SAKNR-SIGN = 'I'.
  LR_SAKNR-OPTION = 'EQ'.
  LR_SAKNR-LOW = '1602020001'.
  APPEND LR_SAKNR.
  CLEAR LR_SAKNR.
  LR_SAKNR-SIGN = 'I'.
  LR_SAKNR-OPTION = 'EQ'.
  LR_SAKNR-LOW = '1602030001'.
  APPEND LR_SAKNR.
  CLEAR LR_SAKNR.
  LR_SAKNR-SIGN = 'I'.
  LR_SAKNR-OPTION = 'EQ'.
  LR_SAKNR-LOW = '1602040001'.
  APPEND LR_SAKNR.
  CLEAR LR_SAKNR.
  LR_SAKNR-SIGN = 'I'.
  LR_SAKNR-OPTION = 'EQ'.
  LR_SAKNR-LOW = '1602050001'.
  APPEND LR_SAKNR.
  CLEAR LR_SAKNR.
  LR_SAKNR-SIGN = 'I'.
  LR_SAKNR-OPTION = 'EQ'.
  LR_SAKNR-LOW = '1602990001'.
  APPEND LR_SAKNR.
  CLEAR LR_SAKNR.

CL_SALV_BS_RUNTIME_INFO=>SET( EXPORTING DISPLAY = ABAP_FALSE   METADATA = ABAP_FALSE DATA = ABAP_TRUE ).
      SUBMIT FAGL_ACCOUNT_ITEMS_GL "根据FAGLL03总账科目取数
      USING SELECTION-SCREEN '1000'
            WITH SD_SAKNR IN LR_SAKNR
            WITH SD_BUKRS IN S_BUKRS6
            WITH X_AISEL = 'X'
            WITH X_CLSEL = SPACE
            WITH X_OPSEL = SPACE
            WITH SO_BUDAT IN S_ERDAT6
*VIA  SELECTION-SCREEN
      EXPORTING LIST TO MEMORY AND RETURN.
      IF SY-SUBRC = 0.
        TRY.
            CL_SALV_BS_RUNTIME_INFO=>GET_DATA_REF( IMPORTING R_DATA = LR_PAY_DATA ).
            ASSIGN LR_PAY_DATA->* TO <LT_PAY_DATA>.
          CATCH CX_SALV_BS_SC_RUNTIME_INFO.
            MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
        ENDTRY.
      ENDIF.
      CL_SALV_BS_RUNTIME_INFO=>CLEAR_ALL( ).
      IF <LT_PAY_DATA> IS  ASSIGNED.
        LT_DATA_6 = CORRESPONDING #( <LT_PAY_DATA> ).
      ENDIF.
SORT LT_DATA_6 BY BUKRS ANLN1 ANLN2.
  DELETE ADJACENT DUPLICATES FROM LT_DATA_6 COMPARING BUKRS ANLN1 ANLN2.

取出所有资产后,就可以根据ANLC去读取价值传送给OA

上一篇:工业大数据是中国制造的伪命题丨无知识不数据 精益数据时代


下一篇:25个优秀的设计机构网站设计案例