Considerations specific to using the connector with DECS
DECS provides the equivalent to the Virtual Fields activity of HEI, incorporated into Domino. The DECS activity document is slightly different than the HEI activity document. The following sections describe the DECS forms and key initialization.
- Intercept Document Create
- Intercept Document Open
- Intercept Document Update
- Intercept Document Delete
To create one activity that supports all four of the above events, write your own RFC/BAPI function that allows you to do so.
Key initialization in DECS
With the SAP Connector, Key Initialization is only possible when you have a Document Open event activity already created. Document Open is the only event where the SAP Connector may send a result set back to Notes. Multiple events being watched in a single activity is not supported with the SAP Connector.
There are times when you may not use key initialization together with your Document Open activity. For example, when you want to call BAPI_REQUISITION_GETDETAIL to retrieve information from ECC for display in Notes. The input key to this BAPI is the requisition number.
Sub GetAllRequisitions (source As LCConnection)
Dim Ws As New NotesUIWorkspace
Dim Vw As NotesUIView
Set Vw=Ws.Currentview
On Error Goto errorhandler
Dim target As New Lcconnection("notes")
Dim sourcefieldlist As New Lcfieldlist
Dim targetfieldlist As New Lcfieldlist
Dim counter As Integer
Dim selectstatement As String
Call ConnectR3(source,"RFC_READ_TABLEEBAN")
target.Server = ""
target.Database = "getreq.nsf"
target.Connect
source.Metadata = "EBAN"
target.Metadata = "BAPI_REQ"
selectstatement = |FIELDS.1.FIELDNAME="BANFN"|
source.Fieldnames = "EBANBANFN"
counter = source.Execute(selectstatement, sourcefieldlist)
If (counter = 0) Then
Msgbox "No records returned by ECC"
Exit Sub
End If
Call targetfieldlist.MapName(sourcefieldlist,"EBANBANFN","Number")
target.MapByName = True
Dim counter2 As Integer
counter2 = source.Fetch(sourcefieldlist,1,1)
While (counter2 > 0)
Call target.Insert(targetfieldlist, 1, 1)
counter2 = source.Fetch(sourcefieldlist, 1, 1)
Wend
Call Vw.view.refresh
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
It would be a good idea to write such a script even if the RFC or BAPI did return the key information, as then you could create a periodic agent that could refresh your keys for you.
Procedure for initializing keys
- First create a DECS Document Open activity, such as that found in the Intercept Document Open section of the DECS specifics later in this section. While selecting RFC/BAPI in the open event (used for initializing keys) make sure that RFC/BAPI should return all keys after execution. For example, BAPI_CUSTOMER_GETLIST will return a list of all customers.
- From the Actions menu, select Initialize Keys.
- If required, enter a Select Statement, as in a Direct Transfer activity.
- Specify where the result set the key is found. At this point the keys should exist in the database.