SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_FIXEDASSET_CHANGE



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Jan 31, 2009 6:00 pm    Post subject: BAPI_FIXEDASSET_CHANGE Reply with quote

BAPI_FIXEDASSET_CHANGE - Changes an Asset

Code:
REPORT zmila_oss_0000170346_2007.

PARAMETERS:
* daten sind ausgelegt fur mdt 004
p_bukrs TYPE bukrs DEFAULT '1000',
p_anln1 TYPE anln1 DEFAULT '3474',
p_c1 TYPE xfeld RADIOBUTTON GROUP comm ,
p_c2 TYPE xfeld RADIOBUTTON GROUP comm DEFAULT 'X',
p_012 TYPE xfeld RADIOBUTTON GROUP ordr DEFAULT 'X',
p_120 TYPE xfeld RADIOBUTTON GROUP ordr,
p_201 TYPE xfeld RADIOBUTTON GROUP ordr.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF BLOCK ovw WITH FRAME TITLE ovw.
SELECTION-SCREEN COMMENT /1(75) comm0.
SELECTION-SCREEN COMMENT /1(75) comm1.
SELECTION-SCREEN COMMENT /1(75) comm2.
SELECTION-SCREEN END OF BLOCK ovw.

INITIALIZATION.
  ovw = 'TEST-DATEN (Mdt 004)'.
  comm0 = 'Bukrs ist immer 1000'.
  comm1 = 'Anlage ohne Equi.: 3474'.
  comm2 = 'Anlage mit Equi. : 3475'.

  DATA:
  lt_anlz TYPE TABLE OF anlz,
  ls_anlz TYPE anlz,
  lv_anln2 TYPE anln2,
  ls_tdd TYPE bapi1022_feglg003,
  ls_tddx TYPE bapi1022_feglg003x,
  ls_return TYPE bapiret2.

  SELECT * FROM anlz INTO TABLE lt_anlz
  WHERE bukrs EQ p_bukrs
  AND anln1 EQ p_anln1.

  LOOP AT lt_anlz INTO ls_anlz.
*    todo: nur aktuelles intervall ziehen
  ENDLOOP.

  DO 3 TIMES.
    IF sy-index = 1.
      IF p_012 = 'X'. lv_anln2 = '0000'. ENDIF.
      IF p_120 = 'X'. lv_anln2 = '0001'. ENDIF.
      IF p_201 = 'X'. lv_anln2 = '0002'. ENDIF.
    ENDIF.
    IF sy-index = 2.
      IF p_012 = 'X'. lv_anln2 = '0001'. ENDIF.
      IF p_120 = 'X'. lv_anln2 = '0002'. ENDIF.
      IF p_201 = 'X'. lv_anln2 = '0000'. ENDIF.
    ENDIF.
    IF sy-index = 3.
      IF p_012 = 'X'. lv_anln2 = '0002'. ENDIF.
      IF p_120 = 'X'. lv_anln2 = '0000'. ENDIF.
      IF p_201 = 'X'. lv_anln2 = '0001'. ENDIF.
    ENDIF.

    LOOP AT lt_anlz INTO ls_anlz WHERE anln2 EQ lv_anln2.
      EXIT.
    ENDLOOP.

    CHECK sy-subrc EQ 0.

    CASE ls_anlz-kostl.
      WHEN '0000001000'. ls_tdd-costcenter = '0000001010'.
      WHEN '0000001010'. ls_tdd-costcenter = '0000001000'.
      WHEN OTHERS. ls_tdd-costcenter = '0000001000'.
    ENDCASE.
    ls_tddx-costcenter = 'X'.

    CALL FUNCTION 'BAPI_FIXEDASSET_CHANGE'
    EXPORTING
    companycode = p_bukrs
    asset = p_anln1
    subnumber = lv_anln2
*    groupasset =
*    generaldata =
*    generaldatax =
*    inventory =
*    inventoryx =
*    postinginformation =
*    postinginformationx =
    timedependentdata = ls_tdd
    timedependentdatax = ls_tddx
*    allocations =
*    allocationsx =
*    origin =
*    originx =
*    investacctassignmnt =
*    investacctassignmntx =
*    networthvaluation =
*    networthvaluationx =
*    realestate =
*    realestatex =
*    insurance =
*    insurancex =
*    leasing =
*    leasingx =
    IMPORTING
    return = ls_return.
*    TABLES
*    depreciationareas =
*    depreciationareasx =
*    investment_support =
*    extensionin =
    WRITE: ls_return-id, ls_return-number, ls_return-message(50).

    IF p_c1 = 'X'.
      COMMIT WORK AND WAIT.
    ENDIF.
  ENDDO.

  IF p_c2 = 'X'.
    COMMIT WORK AND WAIT.
  ENDIF.
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Wed Mar 03, 2010 6:08 pm    Post subject: Reply with quote

Code:
FORM bapi_call TABLES pt_msg STRUCTURE bapiret2.
*Time-dependent data
  DATA: ls_tmdepdata  TYPE bapi1022_feglg003.
  DATA: ls_tmdepdatax TYPE bapi1022_feglg003x.

*Account assignment
  DATA: ls_accasdata  TYPE bapi1022_feglg010.
  DATA: ls_accasdatax TYPE bapi1022_feglg010x.

*Leasing: Supplementary text
  DATA: ls_leasdata TYPE bapi1022_feglg005.
  DATA: ls_leasdatax TYPE bapi1022_feglg005x.

*Return message
  DATA: ls_return     TYPE bapiret2.

*  ls_tmdepdata-from_date    = anlz-adatu.
*  ls_tmdepdata-to_date      = anlz-bdatu.
  ls_tmdepdata-from_date    = g_adatu.
  ls_tmdepdata-to_date      = '99991231'.
  ls_tmdepdata-shift_fact   = anlz-msfak.
  ls_tmdepdata-costcenter   = anlz-kostl.
  ls_tmdepdata-intern_ord   = anlz-caufn.
  ls_tmdepdata-person_no    = anlz-pernr.
  ls_tmdepdata-location     = anlz-stort.
  ls_accasdata-wbs_elem     = anla-posnr.

  ls_tmdepdatax-from_date   = c_yes.
  ls_tmdepdatax-to_date     = c_yes.
  ls_tmdepdatax-shift_fact  = c_yes.
  ls_tmdepdatax-costcenter  = c_yes.
  ls_tmdepdatax-intern_ord  = c_yes.
  ls_tmdepdatax-person_no   = c_yes.
  ls_tmdepdatax-location    = c_yes.
  ls_accasdatax-wbs_elem    = c_yes.

* Supplementary text
  ls_leasdata-text = anla-letxt.
  ls_leasdatax-text = c_yes.

*call function for process master data update
  CALL FUNCTION 'BAPI_FIXEDASSET_CHANGE'
    EXPORTING
      companycode          = anlz-bukrs
      asset                = anlz-anln1
      subnumber            = anlz-anln2
      timedependentdata    = ls_tmdepdata
      timedependentdatax   = ls_tmdepdatax
      investacctassignmnt  = ls_accasdata
      investacctassignmntx = ls_accasdatax
      leasing              = ls_leasdata
      leasingx             = ls_leasdatax
    IMPORTING
      return               = ls_return.

*Transfer message into Error log
  COLLECT ls_return INTO pt_msg.

  CASE ls_return-type.
    WHEN 'A' OR 'E' OR 'X'.
      MOVE 1 TO sy-subrc.
    WHEN OTHERS.
*Commit result in database
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  ENDCASE."ls_return-type

ENDFORM.                    " bapi_call
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.