Quantcast
Channel: SCN : All Content - SAP ERP Financials - Asset Accounting
Viewing all articles
Browse latest Browse all 786

How to change the investment support key via BAPI in LSMW?

$
0
0

Hello everyone,

 

as I couldn't remove the investment support key on a bunch of assets by playing a recording with LSMW, I switched to the Business Objects method (BAPI).

I used the following object attributes:

Business Object: BUS1022

Method: Change

Message Type: FIXEDASSET_CHANGE

Basic Type: FIXEDASSET_CHANGE03

 

My source structure consists only of the two fields main asset number and the asset subnumber.

 

As structure relation I assigned the source structure to "E1FIXEDASSET_CHANGE" (the header segment) and the target structure "E1BP1022_INV_SUPPORT".

 

So my field mapping and conversion rules look like this:

Field Mapping and Rule

|---+DI_DC40                       IDoc Control Record for Interface to External System

|   |--Fields

|

|---+E1FIXEDASSET_CHANGE            Header segment

    |+Fields

    ||--COMPANYCODE                  Company Code

    ||                      Rule :   Constant

    ||                      Code:    E1FIXEDASSET_CHANGE-COMPANYCODE = '1000'.

    ||--ASSET                        Main Asset Number

    ||                      Source:  Z_SOURCESTRUC-ANLN1

    ||                      Code:    * Zielfeld: E1FIXEDASSET_CHANGE-ASSET

    ||                               E1FIXEDASSET_CHANGE-ASSET = Z_SOURCESTRUC-ANLN1.

    ||--SUBNUMBER                    Asset Subnumber

    ||                      Source:  Z_SOURCESTRUC-ANLN2

    ||                      Code:    * Zielfeld: E1FIXEDASSET_CHANGE-SUBNUMBER

    ||                               E1FIXEDASSET_CHANGE-SUBNUMBER = Z_SOURCESTRUC-ANLN2.

    ||--GROUPASSET                   Indicator: Asset is a group asset

    |                       Rule :   Constant

    |                       Code:    E1FIXEDASSET_CHANGE-GROUPASSET = ''.

    |+E1BP1022_INV_SUPPORT           Investment Support Key

     |-+Fields

       |--INV_SUPPORT_KEY              Investment support key

       |                      Rule :   Constant

       |                      Code:    E1BP1022_INV_SUPPORT-INV_SUPPORT_KEY = '60'.

       |--CHANGE_IND                   Change Type (U, I, S, D)

                              Rule :   Constant

                              Code:    E1BP1022_INV_SUPPORT-CHANGE_IND = 'D'.


But when I start the IDoc processing, the following error message is returned:

SAPSQL_ARRAY_INSERT_DUPREC "The ABAP/4 Open SQL array insert results in duplicate database records."

 

It seems as if the LSMW is trying to create the given asset numbers again. But it should only delete the investment support key from the given asset numbers.

 

What am I doing wrong?

And how could I achive the removal of the investment support key?


Viewing all articles
Browse latest Browse all 786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>