Skip to Content
author's profile photo
Former Member

Material Reservation BAPI

I'm trying to use the Bapi: BAPI_RESERVATION_CREATE1, but I'm getting the following error:

error '80004004' Operation aborted

When I use SE37 and fill the RESERVATIONHEADER and RESERVATIONITEMS data I can run the Bapi, but when I fill the same data using an ASP page it doesn't work... I get an error when I call the Bapi.

The ASP code follows bellow;

  Set oBAPI  = CreateObject("SAP.MaterialReservation.1")

  oBAPI.Destination = "XXXXXXXXXXXXXXX"

  'ReservationHeader
  OBapi.DimAs "BapiCreateFromData1", "RESERVATIONHEADER", oResHeader
  oResHeader.AddNew    
  oResHeader.Fields("RES_DATE").Value		= Now
  oResHeader.Fields("MOVE_TYPE").Value		= "001"
  oResHeader.Fields("COSTCENTER").Value		= "00001"
  oResHeader.Update
  
  'ReservationItems
  OBapi.DimAs "BapiCreateFromData1", "RESERVATIONITEMS", oResItem
  oResItem.AddNew
  oResItem.Fields("MATERIAL").Value     	= "XXXXXXXXX"
  oResItem.Fields("PLANT").Value     		= "XXXX"
  oResItem.Fields("ENTRY_QNT").Value		= 10
  oResItem.Fields("REQ_DATE").Value     	= Now
  oResItem.Update
  
  ' Result
  OBapi.DimAs "BapiCreateFromData1", "RETURN", oReturn
  
  ' bapi Call
  oBAPI.BapiCreateFromData1 oResHeader, oResItem, , , oReturn

Does anybody know what might be the problem?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Posted on Feb 21, 2005 at 06:45 PM

    Hi Leonardo,

    perhaps you just shortened display, maybe it's a problem:

    oResItem.Fields("MATERIAL").Value     	= "XXXXXXXXX"
    

    Material number has 18 chars in database. When you enter value via SE37, there is an automatic conversion between display format (without leading zeros) and internal format -> test will work.

    If you enter external format via ASP-call, you will not find an article -> use 18 chars.

    Have a look at function module 'CONVERSION_EXIT_ALPHA_INPUT' for translation rules (make some tests...).

    Regards,

    Christian

    Add comment
    10|10000 characters needed characters exceeded