on 09-27-2012 7:46 AM
Hi there,
I am trying to create asset reservation using .net connector 3.0 with VS2005. I am using BAPI_RESERVATION_CREATE1 the header data (RESERVATIONHEADER) is creating fine but there is always error in item data (RESERVATIONITEMS) "No instance of object type BUS2093 has been created. External reference:" Please help me I m stuck in this. Below is the .net code.
Dim sapRfcDestination As RfcDestination = RfcDestinationManager.GetDestination("DEV")
Dim saprfcRepository As RfcRepository = sapRfcDestination.Repository
Dim bapiReservation As IRfcFunction = saprfcRepository.CreateFunction("BAPI_RESERVATION_CREATE1")
Dim RfcReservationStrt As IRfcStructure = bapiReservation.GetStructure("RESERVATIONHEADER")
Dim RfcReservationTb As IRfcTable = bapiReservation.GetTable("RESERVATIONITEMS")
RfcReservationStrt.SetValue("RES_DATE", DateTime.Today)
RfcReservationStrt.SetValue("MOVE_TYPE", "201")
RfcReservationStrt.SetValue("COSTCENTER", "ID1034")
'RfcReservationStrt.SetValue("ASSET_NO", "3000032")
RfcReservationStrt.SetValue("CREATED_BY", "USER")
'
RfcReservationTb.Append()
RfcReservationTb.SetValue("MATERIAL", "3000032")
RfcReservationTb.SetValue("PLANT", "HQ01")
RfcReservationTb.SetValue("STGE_LOC", "L001")
RfcReservationTb.SetValue("ENTRY_QNT", "10")
RfcReservationTb.SetValue("ENTRY_UOM", "EA")
RfcReservationTb.SetValue("REQ_DATE", DateTime.Today)
RfcReservationTb.SetValue("ITEM_TEXT", "Pencil with Rubber")
bapiReservation.Invoke(sapRfcDestination)
Dim RfcReturnDetail As IRfcTable = bapiReservation.GetTable("RETURN")
MsgBox(RfcReturnDetail.GetString("MESSAGE").ToString)
Dim trns As New RfcTransaction
trns.AddFunction(bapiReservation)
trns.Commit(sapRfcDestination)
Thanks in advance...
Hi, Please try to change FM Update Commit to this method :
IRfcFunction BapiCommit = destination.Repository.CreateFunction ("BAPI_TRANSACTION_COMMIT");
BapiCommit.SetValue("WAIT", "X");
//// fill function with update data
RfcSessionManager.BeginContext(RfcDestination);
RfcReservationStrt.Invoke(RfcDestination);
BapiCommit.Invoke(RfcDestination);
RfcSessionManager.EndContext(RfcDestination);
IRfcTable returnTable = RfcReservationStrt.GetTable("RETURN");
Best regards,
Yarden
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rehman,
Could you pls check or let me know where exactly the instance of "bapiReservation" is created.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.