Application Development and Automation 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: 
Read only

Material Reservation BAPI

Former Member
0 Likes
1,979

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?

1 ACCEPTED SOLUTION
Read only

christian_wohlfahrt
Active Contributor
0 Likes
732

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

1 REPLY 1
Read only

christian_wohlfahrt
Active Contributor
0 Likes
733

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