Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Now in sFin S4 HANA the upload process has changed,OASV  T code has been removed from the system. In AS91 transaction type field has been removed.

A new T code has been introduced for uploading values for asset i.e ABLDT.

Reference Code as below,

 

report ZFI_ASSET_CUTOVER.

 
" type declaration ==============================================
types:begin of ty_data,
        anlkl(8)     type  c,  " anlkl,
        bukrs(4)     type  c,  " bukrs,
        txt50_1(45)  type c,  "  txt50,
        txt50_2(45)  type c,  "  txt50,
*        txa50 type t     c,xa50,
        sernr(8)     type  c,  "sernr,
        invnr(25)    type c,  " invnr,
        menge(13)    type c,  " menge,
        meins(3)     type  c,  "meins,
        aktiv(18)    type  c,  "aktiv,
        kostl(10)    type  c,  "kostl,
        afasl(4)     type  c,  "afasl,
        ndjar(3)     type  c,  "ndjar,
        afabg(10)    type c,  " afabg,
        afasl_02(4)  type  c,  "afasl,
        ndjar_02(3)  type  c,  "ndjar,
        afabg_02(10type c,  " afabg,
        afabe(10)    type c,  " afabe,
        kansw(15)    type c,  " kansw,
        knafa(15)    type c,  " knafa,
        afabe_02(10type c,  " afabe,
        kansw_02(15type c,  " kansw,
        knafa_02(15type c,  " knafa,
      end of ty_data.


" data declaration ==============================================
datait_data type table of ty_data,
      wa_data type ty_data.

" bapi Data and tables Declaration ==============================

data:
  wa_key                 like  bapi1022_key,
  wa_reference           like  bapi1022_reference,
  wa_createsubnumber     like  bapi1022_misc-xsubno,
  wa_creategroupasset    like  bapi1022_misc-xanlgr,
  wa_testrun             like  bapi1022_misc-testrun,
  wa_generaldata         like  bapi1022_feglg001,
  wa_generaldatax        like  bapi1022_feglg001x,
  wa_inventory           like  bapi1022_feglg011,
  wa_inventoryx          like  bapi1022_feglg011x,
  wa_postinginformation  like  bapi1022_feglg002,
  wa_postinginformationx like  bapi1022_feglg002x,
  wa_timedependentdata   like  bapi1022_feglg003,
  wa_timedependentdatax  like  bapi1022_feglg003x,
  wa_allocations         like  bapi1022_feglg004,
  wa_allocationsx        like  bapi1022_feglg004x,
  wa_origin              like  bapi1022_feglg009,
  wa_originx             like  bapi1022_feglg009x.




datait_depreciationareas  type table of bapi1022_dep_areas,
      wa_depreciationareas  type bapi1022_dep_areas,
      it_depreciationareasx type table of bapi1022_dep_areasx,
      wa_depreciationareasx type bapi1022_dep_areasx,
      it_cumulatedvalues    type table of bapi1022_cumval,
      wa_cumulatedvalues    type bapi1022_cumval,
      it_return_dis         type table of bapiret2,
      wa_return_dis         type bapiret2,
      it_return             type table of bapiret2,
      wa_return             type bapiret2.



datagv_companycode  like  bapi1022_1-comp_code,
      gv_asset        like  bapi1022_1-assetmaino,
      gv_subnumber    like  bapi1022_1-assetsubno,
      gv_assetcreated like  bapi1022_reference.

" global veriable declaration ===================================
data :          it_raw type truxs_t_text_data" for excel convert
" SELECTION DECLARATION ===============================================


selection-screenbegin of block b1 with frame title text-001.
parametersp_file like rlgrap-filename obligatory.
selection-screenend of block b1.

at selection-screen on value-request for p_file.

  call function 'F4_FILENAME'
    exporting
      program_name  syst-cprog
      dynpro_number syst-dynnr
      field_name    'p_file'
    importing
      file_name     p_file.


  " Start of selection ======================================================

start-of-selection.

  if p_file is initial.
    message 'Please select upload file' type 'E'.
    leave list-processing.
  endif.

  call function 'TEXT_CONVERT_XLS_TO_SAP'
    exporting
*     I_FIELD_SEPERATOR    =
      i_line_header        'X'
      i_tab_raw_data       it_raw
      i_filename           p_file
    tables
      i_tab_converted_data it_data
    exceptions
      conversion_failed    1
      others               2.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.


  perform pass_data .
  perform display_log.




*&---------------------------------------------------------------------*
*& Form PASS_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
form pass_data .

  loop at it_data into wa_data.
    wa_key-companycode   =  wa_data-bukrs.

    call function 'CONVERSION_EXIT_ALPHA_INPUT'
      exporting
        input  wa_data-anlkl
      importing
        output wa_data-anlkl.




    wa_generaldata-assetclass  wa_data-anlkl      .
    wa_generaldata-descript    wa_data-txt50_1   .
    wa_generaldata-descript2   wa_data-txt50_2   .
    wa_generaldata-serial_no   wa_data-sernr      .
    wa_generaldata-invent_no   wa_data-invnr      .
    wa_generaldata-quantity    wa_data-menge      .

    call function 'CONVERSION_EXIT_CUNIT_INPUT'
      exporting
        input          wa_data-meins
        language       sy-langu
      importing
        output         wa_data-meins
      exceptions
        unit_not_found 1
        others         2.

    wa_generaldata-base_uom    wa_data-meins      .

    wa_generaldatax-assetclass  =  'X'.
    wa_generaldatax-descript    =  'X'.
    wa_generaldatax-descript2   =  'X'.
    wa_generaldatax-serial_no   =  'X'.
    wa_generaldatax-invent_no   =  'X'.
    wa_generaldatax-quantity    =  'X'.
    wa_generaldatax-base_uom    =  'X'.


    call function 'CONVERT_DATE_TO_INTERNAL'
      exporting
        date_external            wa_data-aktiv
*       accept_initial_date      =
      importing
        date_internal            wa_data-aktiv
      exceptions
        date_external_is_invalid 1
        others                   2.



    wa_postinginformation-cap_date =  wa_data-aktiv.
    wa_postinginformationx-cap_date 'X'.

    wa_timedependentdata-costcenter wa_data-kostl.
    wa_timedependentdatax-costcenter 'X'.





    call function 'CONVERT_DATE_TO_INTERNAL'
      exporting
        date_external            wa_data-afabg
*       accept_initial_date      =
      importing
        date_internal            wa_data-afabg
      exceptions
        date_external_is_invalid 1
        others                   2.

    unpack wa_data-afabe to wa_data-afabe.

    call function 'CONVERT_DATE_TO_INTERNAL'
      exporting
        date_external            wa_data-afabg_02
*       accept_initial_date      =
      importing
        date_internal            wa_data-afabg_02
      exceptions
        date_external_is_invalid 1
        others                   2.
    wa_depreciationareas-area               wa_data-afabe  .
    wa_depreciationareas-dep_key            wa_data-afasl  .
    wa_depreciationareas-ulife_yrs          wa_data-ndjar  .
*    wa_depreciationareas-exp_ulife_yrs      = wa_data-AFABG .
    wa_depreciationareas-odep_start_date    wa_data-afabg  .
    append wa_depreciationareas to it_depreciationareas.


    if wa_data-afabe_02 is not initial.
      unpack wa_data-afabe_02 to wa_data-afabe_02.
      wa_depreciationareas-area               =  wa_data-afabe_02 .
      wa_depreciationareas-dep_key            wa_data-afasl_02  .
      wa_depreciationareas-ulife_yrs          wa_data-ndjar_02  .
*    wa_depreciationareas-exp_ulife_yrs      = wa_data-AFABG .
      wa_depreciationareas-odep_start_date    wa_data-afabg_02  .
      append wa_depreciationareas to it_depreciationareas.

    endif.

    wa_depreciationareasx-area               wa_data-afabe ." 'X'  .
    wa_depreciationareasx-dep_key            =  'X'  .
    wa_depreciationareasx-ulife_yrs          =  'X'  .
*    wa_depreciationareasx-exp_ulife_yrs     =  'X'  .
    wa_depreciationareasx-odep_start_date    =  'X'  .
    append wa_depreciationareasx to it_depreciationareasx.


    if wa_data-afabe_02 is not initial.
      wa_depreciationareasx-area               wa_data-afabe_02 ." 'X'  .
      wa_depreciationareasx-dep_key            =  'X'  .
      wa_depreciationareasx-ulife_yrs          =  'X'  .
*    wa_depreciationareasx-exp_ulife_yrs     =  'X'  .
      wa_depreciationareasx-odep_start_date    =  'X'  .
      append wa_depreciationareasx to it_depreciationareasx.
    endif.

    wa_cumulatedvalues-area      wa_data-afabe.
    wa_cumulatedvalues-acq_value wa_data-kansw.
    if wa_data-knafa ge 0.
      wa_data-knafa wa_data-knafa * -1.
      wa_cumulatedvalues-ord_dep   wa_data-knafa.
    else.
      wa_cumulatedvalues-ord_dep   wa_data-knafa.
    endif.
    append wa_cumulatedvalues to it_cumulatedvalues.


    if wa_data-afabe_02 is not initial.
      wa_cumulatedvalues-area      =  wa_data-afabe_02.
      wa_cumulatedvalues-acq_value =  wa_data-kansw_02.


      if wa_data-knafa_02 ge 0.
        wa_data-knafa_02 wa_data-knafa_02 * -1.
        wa_cumulatedvalues-ord_dep   =  wa_data-knafa_02.

      else.
        wa_cumulatedvalues-ord_dep   =  wa_data-knafa_02.
      endif.
      append wa_cumulatedvalues to it_cumulatedvalues.
    endif.

    perform post_bapi.


  endloop.

endform.
*&---------------------------------------------------------------------*
*& Form POST_BAPI
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
form post_bapi .

  call function 'BAPI_FIXEDASSET_OVRTAKE_CREATE'
    exporting
      key                 wa_key
*     REFERENCE           =
*     CREATESUBNUMBER     =
*     CREATEGROUPASSET    =
*     TESTRUN             = ' '
      generaldata         wa_generaldata
      generaldatax        wa_generaldatax
*     INVENTORY           =
*     INVENTORYX          =
      postinginformation  wa_postinginformation
      postinginformationx wa_postinginformationx
      timedependentdata   wa_timedependentdata
      timedependentdatax  wa_timedependentdatax
*     ALLOCATIONS         =
*     ALLOCATIONSX        =
*     ORIGIN              =
*     ORIGINX             =
*     INVESTACCTASSIGNMNT =
*     INVESTACCTASSIGNMNTX       =
*     NETWORTHVALUATION   =
*     NETWORTHVALUATIONX  =
*     REALESTATE          =
*     REALESTATEX         =
*     INSURANCE           =
*     INSURANCEX          =
*     LEASING             =
*     LEASINGX            =
*     GLO_RUS_GEN         =
*     GLO_RUS_GENX        =
*     GLO_RUS_PTX         =
*     GLO_RUS_PTXX        =
*     GLO_RUS_TTX         =
*     GLO_RUS_TTXX        =
*     GLO_IN_GEN          =
*     GLO_IN_GENX         =
*     GLO_JP_ANN16        =
*     GLO_JP_ANN16X       =
*     GLO_JP_PTX          =
*     GLO_JP_PTXX         =
*     GLO_TIME_DEP        =
*     GLO_RUS_GENTD       =
*     GLO_RUS_GENTDX      =
*     GLO_RUS_PTXTD       =
*     GLO_RUS_PTXTDX      =
*     GLO_RUS_TTXTD       =
*     GLO_RUS_TTXTDX      =
*     GLO_JP_IMPTD        =
*     GLO_JP_IMPTDX       =
    importing
      companycode         gv_companycode
      asset               gv_asset
      subnumber           gv_subnumber
      assetcreated        gv_assetcreated
    tables
      depreciationareas   it_depreciationareas
      depreciationareasx  it_depreciationareasx
*     INVESTMENT_SUPPORT  =
*     EXTENSIONIN         =
      cumulatedvalues     it_cumulatedvalues
*     POSTEDVALUES        =
*     TRANSACTIONS        =
*     PROPORTIONALVALUES  =
      return              it_return
*     POSTINGHEADERS      =
    .

  loop at it_return into wa_return.
    if wa_return-type eq 'E'.

      move wa_return to wa_return_dis.

      append wa_return_dis to it_return_dis.

      clear:wa_return_dis.

    elseif wa_return-type eq 'S'.

      move wa_return to wa_return_dis.

      append wa_return_dis to it_return_dis.

      clear:wa_return_dis.
      call function 'BAPI_TRANSACTION_COMMIT'
        exporting
          wait 'X'.
    endif.

  endloop.



endform.
*&---------------------------------------------------------------------*
*& Form DISPLAY_LOG
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
form display_log .

  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
*     I_INTERFACE_CHECK  = ' '
*     I_BYPASSING_BUFFER =
*     I_BUFFER_ACTIVE    = ' '
      i_callback_program sy-repid
*     I_CALLBACK_PF_STATUS_SET       = ' '
*     I_CALLBACK_USER_COMMAND        = ' '
      i_structure_name   'BAPIRET2'
*     IS_LAYOUT          =
*     IT_FIELDCAT        =
*     IT_EXCLUDING       =
*     IT_SPECIAL_GROUPS  =
*     IT_SORT            =
*     IT_FILTER          =
*     IS_SEL_HIDE        =
      i_default          'X'
*     I_SAVE             = ' '
*     IS_VARIANT         =
*     IT_EVENTS          =
*     IT_EVENT_EXIT      =
*     IS_PRINT           =
*     IS_REPREP_ID       =
*     I_SCREEN_START_COLUMN          = 0
*     I_SCREEN_START_LINE            = 0
*     I_SCREEN_END_COLUMN            = 0
*     I_SCREEN_END_LINE  = 0
*     IR_SALV_LIST_ADAPTER           =
*     IT_EXCEPT_QINFO    =
*     I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
*         IMPORTING
*     E_EXIT_CAUSED_BY_CALLER        =
*     ES_EXIT_CAUSED_BY_USER         =
    tables
      t_outtab           it_return_dis
*         EXCEPTIONS
*     PROGRAM_ERROR      = 1
*     OTHERS             = 2
    .

endform.