Considerations for SAP transactions on SAP ECC 6 server using LC LSX
Earlier versions of HCL Domino® Connector for SAP® Solutions used an "RFC_CALL_TRANSACTION" call for working with SAP transactions. With the SAP ECC 6 server, this RFC does not exist; it has been replaced by the RFC "ABAP4_CALL_TRANSACTION" call. In addition to the name change, the interface of this RFC is also different than that of "RFC_CALL_TRANSACTION" call. Starting with version 2.0, Domino Connector for SAP Solutions supports RFC for working with SAP transactions on the SAP ECC server.
Following are significant changes in RFC (ABAP4_CALL_TRANSACTION) as compared to the
older one (RFC_CALL_TRANSACTION):
- EXPORT parameter MESSG, which was used to return the result of SAP Transaction execution is no longer present in the new RFC. It has been replaced by parameter "SUBRC" which is of type INT. The user will no longer be able to use the "Message" property of an SAP connection object while working with SAP Transaction on SAP ECC 6.
- While working with SAP Transactions on SAP ECC 6, users must use the data returned in table "MESS_TAB" and EXPORT parameter "SUBRC" to get information about execution status.
Below is sample LC LSX code to work with SAP Transaction on SAP ECC 6 server. This sample
code uses SAP Transaction "XD02" to update a customer's street address information.
Sub Initialize
On Error Goto errorhandler
Dim session As New Lcsession
Dim target As New Lcconnection("sap")
Dim inputfieldlist As New Lcfieldlist
Dim outputfieldlist As New Lcfieldlist
target.Userid = "muster"
target.Password = "FOOBAR"
target.Client = "800"
target.SystemNo = 0
target.Language = "EN"
target.Server= "acme"
target.Destination = "N4S"
target.Procedure = "XD02"
target.ModuleType = 1
target.ScreenFields = "$SAPMF02D=0101," +_
"BDC_OKCODE=/00," +_
"RF02D-KUNNR," +_
"RF02D-D0110=X," +_
"$SAPMF02D=0110," +_
"BDC_OKCODE==UPDA," +_
"KNA1-STRAS"
target.Connect
Dim field As LCfield
Set field = inputfieldlist.Append("RF02D-KUNNR",LCTYPE_TEXT)
field.text = "0000000002"
Set field = inputfieldlist.Append("KNA1-STRAS",LCTYPE_TEXT)
field.text = "Astorstrasse 34"
target.MapByName=True
Call target.Call(inputfieldlist,1,outputfieldlist)
' Property Message is not available with ABAP4_CALL_TRANSACTION
' Msgbox target.Message
Dim tcode As LCField
Dim dyname As LCField
Dim dynumb As LCField
Dim msgtyp As LCField
Dim msgspra As LCField
Dim msgid As LCField
Dim msgnr As LCField
Dim msgv1 As LCField
Dim msgv2 As LCField
Dim msgv3 As LCField
Dim msgv4 As LCField
Dim env As LCField
Dim fldname As LCField
Dim subrc As LCField
'Use table MESS_TAB to read execution status info
Set tcode = outputfieldlist.Lookup("MESS_TABTCODE")
Set dyname = outputfieldlist.Lookup("MESS_TABDYNAME")
Set dynumb = outputfieldlist.Lookup("MESS_TABDYNUMB")
Set msgtyp = outputfieldlist.Lookup("MESS_TABMSGTYP")
Set msgspra = outputfieldlist.Lookup("MESS_TABMSGSPRA")
Set msgid = outputfieldlist.Lookup("MESS_TABMSGID")
Set msgnr = outputfieldlist.Lookup("MESS_TABMSGNR")
Set msgv1 = outputfieldlist.Lookup("MESS_TABMSGV1")
Set msgv2 = outputfieldlist.Lookup("MESS_TABMSGV2")
Set msgv3 = outputfieldlist.Lookup("MESS_TABMSGV3")
Set msgv4 = outputfieldlist.Lookup("MESS_TABMSGV4")
Set env = outputfieldlist.Lookup("MESS_TABENV")
Set fldname = outputfieldlist.Lookup("MESS_TABFLDNAME")
'Use EXPORTS parameter SUBRC
Set subrc = outputfieldlist.Lookup("EXPORTSSUBRC")
If (target.Fetch (outputfieldlist)) Then
Print "TCODE = " + tcode.Text(0)
Print "DYNAME = " + dyname.Text(0)
Print "DYNUMB = " + dynumb.Text(0)
Print "MSGTYP = " + msgtyp.Text(0)
Print "MSGSPRA = " + msgspra.Text(0)
Print "MSGID = " + msgid.Text(0)
Print "MSGNR = " + msgnr.Text(0)
Print "MSGV1 = " + msgv1.Text(0)
Print "MSGV2 = " + msgv2.Text(0)
Print "MSGV3 = " + msgv3.Text(0)
Print "MSGV4 = " + msgv4.Text(0)
Print "ENV = " + env.Text(0)
Print "FLDNAME = "+ fldname.Text(0)
Print "SUBRC = " + subrc.Text(0)
End If
Exit Sub
errorhandler:
Dim Msg As String
Dim Msgcode As Long
Dim status As Integer
Dim result As String
If session.status <> LCSUCCESS Then
status = session.GetStatus(result, Msgcode, Msg)
End If
Msgbox result
End Sub