Posted: Sat Jan 31, 2009 6:00 pm Post subject: BAPI_FIXEDASSET_CHANGE
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'.
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.
* 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
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.