*&---------------------------------------------------------------------*
*& Form FRM_CALL_BAPI_POST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM frm_call_bapi_post .
DATA: lv_flg TYPE c.
CHECK gv_flg IS INITIAL.
LOOP AT gt_upload INTO gwa_upload.
CLEAR gwa_alv_out.
PERFORM frm_convertion CHANGING gwa_upload-asset.
gwa_alv_out-asset_1 = gwa_upload-asset.
* 公司代码
gs_bapi1022_key-companycode = gwa_upload-companycode.
* 补零
PERFORM frm_convertion CHANGING gwa_upload-assetclass.
* 资产分类
IF rd_crt IS NOT INITIAL.
gs_generaldata-assetclass = gwa_upload-assetclass. "'00010000'.
gs_generaldatax-assetclass = 'X'.
ENDIF.
* 资产描述
gs_generaldata-descript = gwa_upload-descript. "'资产描述'.
gs_generaldatax-descript = 'X'.
* 附加资产描述
* gs_generaldata-descript2 = gwa_upload-descript2. "'英文描述'.
* gs_generaldatax-descript2 = 'X'.
* 数量
gs_generaldata-quantity = gwa_upload-quantity. "'11'.
gs_generaldatax-quantity = 'X'.
* 基本计量单位
gs_generaldata-base_uom = gwa_upload-base_uom. " 'KG'.
gs_generaldatax-base_uom = 'X'.
* 资产资本化日期
IF rd_crt IS NOT INITIAL.
gs_postinginformation-cap_date = gwa_upload-cap_date. "'20070101'.
gs_postinginformationx-cap_date = 'X'.
ENDIF.
* 记账凭证码
gs_leasing-text = gwa_upload-text.
gs_leasingx-text = 'X'.
* 成本中心
gs_timedependentdata-costcenter = gwa_upload-costcenter. "'100000'.
gs_timedependentdatax-costcenter = 'X'.
* 成本中心对资产负责
gs_timedependentdata-resp_cctr = gwa_upload-resp_cctr. "'100001'.
gs_timedependentdatax-resp_cctr = 'X'.
* 不活动日期
gs_postinginformation-deact_date = gwa_upload-deact_date.
gs_postinginformationx-deact_date = 'X'.
*供应商科目编号(其他关键字)
gs_origin-vendor_no = gwa_upload-vendor_no.
gs_originx-vendor_no = 'X'.
* 资产制造商
gs_origin-manufacturer = gwa_upload-manufacturer.
gs_originx-manufacturer = 'X'.
* 使用状态
gs_allocations-evalgroup1 = gwa_upload-evalgroup1.
gs_allocationsx-evalgroup1 = 'X'.
* 运行状态
gs_allocations-evalgroup2 = gwa_upload-evalgroup2.
gs_allocationsx-evalgroup2 = 'X'.
* 核电设施类别
gs_allocations-evalgroup3 = gwa_upload-evalgroup3.
gs_allocationsx-evalgroup3 = 'X'.
* 增减方式
gs_allocations-assetsupno = gwa_upload-assetsupno.
gs_allocationsx-assetsupno ='X'.
* 核电设施类别
gs_allocations-evalgroup4 = gwa_upload-evalgroup4.
gs_allocationsx-evalgroup4 = 'X'.
* 投资原因
gs_allocations-inv_reason = gwa_upload-inv_reason.
gs_allocationsx-inv_reason = 'X'.
* 房间
* gs_timedependentdata-room = gwa_upload-zroom.
* gs_timedependentdatax-room = 'X'.
* 资产用途
gs_allocations-evalgroup5 = gwa_upload-evalgroup5.
gs_allocationsx-evalgroup5 = 'X'.
* 序列号
gs_generaldata-serial_no = gwa_upload-serial_no. "'11'.
gs_generaldatax-quantity = 'X'.
CLEAR gt_bapi1022_cumval.
* 累计购置价值
gwa_bapi1022_cumval-fisc_year = '2011'.
gwa_bapi1022_cumval-area = '01'.
gwa_bapi1022_cumval-acq_value = gwa_upload-acq_value.
* 累计普通折旧
gwa_bapi1022_cumval-ord_dep = 0 - gwa_upload-ord_dep.
APPEND gwa_bapi1022_cumval TO gt_bapi1022_cumval.
* 增强屏幕的字段
CLEAR: gwa_ext, gt_ext.
gwa_ext-structure = 'BAPI_TE_ANLU'.
gs_bapi_te_anlu-comp_code = gwa_upload-companycode.
gs_bapi_te_anlu-zclass = gwa_upload-zclass.
gs_bapi_te_anlu-zperno = gwa_upload-zperno.
gs_bapi_te_anlu-zdescript = gwa_upload-zdescript.
gs_bapi_te_anlu-zfpdate = gwa_upload-zfpdate.
gs_bapi_te_anlu-zsbbh = gwa_upload-zsbbh.
gs_bapi_te_anlu-zccdate = gwa_upload-zccdate.
gs_bapi_te_anlu-zccno = gwa_upload-zccno.
gs_bapi_te_anlu-zno = gwa_upload-zno.
gs_bapi_te_anlu-zroom = gwa_upload-zroom.
MOVE gs_bapi_te_anlu+0(240) TO gwa_ext-valuepart1.
MOVE gs_bapi_te_anlu+240(225) TO gwa_ext-valuepart2.
APPEND gwa_ext TO gt_ext.
CLEAR:gt_return, gv_companycode,gv_asset, gv_subnumber,gv_assetcreated,
gwa_return.
IF rd_crt IS NOT INITIAL.
PERFORM frm_bapi_create_asset CHANGING lv_flg.
ELSEIF rd_cha IS NOT INITIAL.
PERFORM frm_bapi_change_asset CHANGING lv_flg.
ENDIF.
IF lv_flg IS NOT INITIAL.
EXIT.
ENDIF.
ENDLOOP.
IF ( ( rd_crt IS NOT INITIAL AND p_test IS INITIAL ) OR ( rd_cha IS NOT INITIAL ) )
AND lv_flg IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
.
ENDIF.
ENDFORM. " FRM_CALL_BAPI_POST
FORM frm_bapi_create_asset CHANGING lv_flg TYPE c.
CALL FUNCTION 'BAPI_FIXEDASSET_OVRTAKE_CREATE'
EXPORTING
key = gs_bapi1022_key
* REFERENCE =
* CREATESUBNUMBER =
* CREATEGROUPASSET =
testrun = p_test
generaldata = gs_generaldata
generaldatax = gs_generaldatax
inventory = gs_inventory
inventoryx = gs_inventoryx
postinginformation = gs_postinginformation
postinginformationx = gs_postinginformationx
timedependentdata = gs_timedependentdata
timedependentdatax = gs_timedependentdatax
allocations = gs_allocations
allocationsx = gs_allocationsx
origin = gs_origin
originx = gs_originx
* INVESTACCTASSIGNMNT =
* INVESTACCTASSIGNMNTX =
* NETWORTHVALUATION =
* NETWORTHVALUATIONX =
* REALESTATE =
* REALESTATEX =
* INSURANCE =
* INSURANCEX =
leasing = gs_leasing
leasingx = gs_leasingx
IMPORTING
companycode = gv_companycode
asset = gv_asset
subnumber = gv_subnumber
assetcreated = gv_assetcreated
TABLES
* DEPRECIATIONAREAS =
* DEPRECIATIONAREASX =
* INVESTMENT_SUPPORT =
extensionin = gt_ext
cumulatedvalues = gt_bapi1022_cumval
* POSTEDVALUES =
* TRANSACTIONS =
* PROPORTIONALVALUES =
return = gt_return
.
IF gt_return IS NOT INITIAL.
* READ TABLE gt_return INTO gwa_return WITH KEY type = 'E'.
LOOP AT gt_return INTO gwa_return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
lv_flg = 'X'.
MOVE-CORRESPONDING gwa_return TO gwa_alv_out.
ELSE.
gwa_alv_out-type = 'S'.
IF p_test IS INITIAL.
gwa_alv_out-message = '创建历史资产被成功创建'.
ELSE.
gwa_alv_out-message = '创建历史资产被成功测试'.
ENDIF.
ENDIF.
ENDIF.
gwa_alv_out-companycode = gv_companycode.
gwa_alv_out-asset = gv_asset.
APPEND gwa_alv_out TO gt_alv_out.
ENDFORM. " FRM_BAPI_CREATE_ASSET
FORM frm_bapi_change_asset CHANGING lv_flg TYPE c.
DATA: lv_return TYPE bapiret2,
lv_sub TYPE bapi1022_1-assetsubno VALUE '0',
lv_asset TYPE bapi1022_1-assetmaino.
CALL FUNCTION 'BAPI_FIXEDASSET_CHANGE'
EXPORTING
companycode = gs_bapi1022_key-companycode
asset = gwa_upload-asset
subnumber = ''
* GROUPASSET =
generaldata = gs_generaldata
generaldatax = gs_generaldatax
inventory = gs_inventory
inventoryx = gs_inventoryx
postinginformation = gs_postinginformation
postinginformationx = gs_postinginformationx
timedependentdata = gs_timedependentdata
timedependentdatax = gs_timedependentdatax
allocations = gs_allocations
allocationsx = gs_allocationsx
origin = gs_origin
originx = gs_originx
* INVESTACCTASSIGNMNT =
* INVESTACCTASSIGNMNTX =
* NETWORTHVALUATION =
* NETWORTHVALUATIONX =
* REALESTATE =
* REALESTATEX =
* INSURANCE =
* INSURANCEX =
leasing = gs_leasing
leasingx = gs_leasingx
IMPORTING
return = lv_return
TABLES
* DEPRECIATIONAREAS =
* DEPRECIATIONAREASX =
* INVESTMENT_SUPPORT =
extensionin = gt_ext
.
IF lv_return-type = 'S'.
gwa_alv_out-type = 'S'.
gwa_alv_out-message = '历史资产被成功修改'.
ELSE.
gwa_alv_out-type = 'E'.
MOVE-CORRESPONDING lv_return TO gwa_alv_out.
ENDIF.
gwa_alv_out-companycode = gwa_upload-companycode.
gwa_alv_out-asset = gwa_upload-asset.
APPEND gwa_alv_out TO gt_alv_out.
ENDFORM. " FRM_BAPI_CHANGE_ASSET
阅读(2166) | 评论(0) | 转发(0) |