on 12-22-2006 5:36 PM
I am new to the .Net Connector. I have been able to set it up and sucessfully call BAPIs/FMs without problems. The problem I am having is getting the Rollbackwork method to work properly. I am using the Bapi_User_Change FM to update the Birth Name of a user. For testing purposes I want the change rolled back. I cannot get the changes to rollback, it appears that the RollBackMethod does not work. I have looked at the BAPI documentation for this Bapi and it does NOT indicate that it does internal commits. Therefore at least according to the documentation, my changes done by this code should have been undone. Note that in my sample code: I call it twice once with a valid ID and once with an non-existant ID. One works, other other of course does not. The rollback that follows both seems to be ignored.
Can anyone help? What am I missing here? Something obvious?
Dim addr As New BAPIADDR3
Dim addrx As New BAPIADDR3X
Dim retTable As New BAPIRET2Table
'Dim ret0 As New BAPIRET1
Dim ret2 As New BAPIRET2
Dim conn As SAPConnection
Try
conn = proxy.Connection.GetNewConnection(cs)
conn.Open()
proxy.Connection = conn
addrx.City = "X"
addrx.Birth_Name = "X"
addr.City = "Charlotte"
addr.Birth_Name = "XXXXXXXXXXXXX"
proxy.Bapi_User_Change(addr, addrx, "GOODID", retTable)
proxy.Bapi_User_Change(addr, addrx, "BADID", retTable)
Console.Write(retTable.Count)
If proxy.RollbackWork() = True Then
Console.Write("True")
Else
Console.Write("False")
End If
Catch ex As Exception
Console.Write(ex.Message)
End Try
Hi Mickey,
I agree with Gareth.
Once a syncronous call is executed, the rollback mechanism does not yield any results.
As an alternative, you could look at tRFC [which is async] but will give you the transaction relevant options of commit, rollback, etc ...
http://help.sap.com/saphelp_nw2004s/helpdata/en/bd/ab5315ed92c4479d62036be9cdf678/content.htm
with respect,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mickey,
I have found that using a synchronous BAPI call through the .NET connector the commit is triggered by the synch BAPI call itself. This means the rollback will always fail. Please check
http://help.sap.com/saphelp_46c/helpdata/en/78/21745d51ce11d189570000e829fbbd/frameset.htm
Sorry for the bad news.
Gareth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.