Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent-> BAPI Code

Former Member
0 Kudos

Hi all,

i am using BAPI_FIXEDASSET_CREATE1 to upload asset data. in this function module there is a mandatory parameter that is key regarding this i am getting a dump error. saying that <b>Type is correct but incorrect for key length</b>. here is my declaration .


data: begin of wa_companycode occurs 0.
      include structure BAPI1022_KEY.
data  End of WA_Companycode.

WA_COMPANYCODE-COMPANYCODE = WA_SOURCE-BUKRS.

CALL FUNCTION 'BAPI_FIXEDASSET_CREATE1'
  EXPORTING
    key                               = WA_COMPANYCODE-COMPANYCODE
   GENERALDATA              = WA_GENERALDATA
*   GENERALDATAX             =
    POSTINGINFORMATION         = WA_POSTINGINFORMATION
*   POSTINGINFORMATIONX        =
   TIMEDEPENDENTDATA          = WA_TIMEDEPENDENTDATA
*   TIMEDEPENDENTDATAX         =
   ALLOCATIONS                = WA_ALLOCATIONS
*  ALLOCATIONSX               =
 IMPORTING
  ASSETCREATED               = wa_Assetcreated

   RETURN                     = wa_return

** TABLES
**   DEPRECIATIONAREAS          =
**   DEPRECIATIONAREASX         =
**   INVESTMENT_SUPPORT         =
**   EXTENSIONIN                =
*          .



3 REPLIES 3

former_member181962
Active Contributor
0 Kudos

Make the highlighted change:

WA_COMPANYCODE-COMPANYCODE = WA_SOURCE-BUKRS.

CALL FUNCTION 'BAPI_FIXEDASSET_CREATE1'

EXPORTING

<b> key = WA_COMPANYCODE</b>

GENERALDATA = WA_GENERALDATA

  • GENERALDATAX =

POSTINGINFORMATION = WA_POSTINGINFORMATION

  • POSTINGINFORMATIONX =

TIMEDEPENDENTDATA = WA_TIMEDEPENDENTDATA

  • TIMEDEPENDENTDATAX =

ALLOCATIONS = WA_ALLOCATIONS

  • ALLOCATIONSX =

IMPORTING

ASSETCREATED = wa_Assetcreated

RETURN = wa_return

    • TABLES

    • DEPRECIATIONAREAS =

    • DEPRECIATIONAREASX =

    • INVESTMENT_SUPPORT =

    • EXTENSIONIN =

  • .

REgards,

Ravi

Former Member
0 Kudos

Hi,

Instead of passing WA_COMPANYCODE-COMPANYCODE, pass WA_COMPANYCODE.

Here, KEY is a structure so you have to pass a structure i.e WA_COMPANYCODE and not a single field i.e. WA_COMPANYCODE-COMPANYCODE.

Reward points if the answer is helpful.

Regards,

Mukul

Former Member
0 Kudos

Hi Praveen,

In exporting parameter you are passing internal table instead of structure.

Pass WA_COMPANYCODE-COMPANYCODE as structure it will work. Means you need to declare like this without occurs 0.

data: begin of wa_companycode.

include structure BAPI1022_KEY.

data End of WA_Companycode.

EXPORTING

key = WA_COMPANYCODE-COMPANYCODE

Reward points for helpful answers.

Ashven