@All
Habe ein kleines Problem bei der Übergabe von Werten an eine RFC von SAP.
Die Sub GetAppointment soll alle Termine aus dem SAP System auslesen. Dabei kann das Start und Enddatum angegeben werden. Beim Aufruf der Funktion miezt mich SAP aber an, daß die Datumswerte nicht im richtigen Format übergeben wurden.
Hab mal den Code des RFC Funktionsbausteins APPOINTMENT_GET auch hier mit gepostet.
Eventuell hat ja jemand so etwas schon gemacht.
Ich kann z.B. der RFC Customer_GET einen String für die zu exportierenden Daten übergeben. Dann funktioniert das auch. Nur halt nicht beim Datum.
(Im SAP habe ich als sap* alle Berechtigungen, nur falls diese Frage auftauchen sollte)
Sub GetAppointment
%REM
FUNCTION APPOINTMENT_GET.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" DATE_FROM LIKE SCAPPT-DATE_FROM
*" DATE_TO LIKE SCAPPT-DATE_TO
*" TABLES
*" OWNER_OR_DISTR_LIST STRUCTURE SCSOWNERDL
*" APPOINTMENTS STRUCTURE SCSAPPT
*" EXCEPTIONS
*" DATE_HAS_INVALID_FORMAT
*" DATE_INCONSISTENCY
*"----------------------------------------------------------------------
* DATA: BEGIN OF OWNER_RANGE_TABLE OCCURS 10.
* INCLUDE STRUCTURE g_owner_range_tab.
* DATA: END OF OWNER_RANGE_TABLE.
DATA: BEGIN OF ERROR_MESSAGE.
INCLUDE STRUCTURE SCSERROR.
DATA: END OF ERROR_MESSAGE.
************************************************************************
* Verteilerlisten auflösen
************************************************************************
PERFORM G_OWNER_RANGE_TAB_FILL TABLES OWNER_OR_DISTR_LIST
CHANGING ERROR_MESSAGE.
************************************************************************
* Datum prüfen
************************************************************************
PERFORM DATE_CHECK_PLAUSIBILITY USING DATE_FROM
'DATE_FROM'.
PERFORM DATE_CHECK_PLAUSIBILITY USING DATE_TO
'DATE_TO'.
PERFORM DATE_CHECK_CONSISTENCY USING DATE_FROM
DATE_TO.
************************************************************************
* Termine lesen
************************************************************************
PERFORM APPOINTMENT_GET_ TABLES APPOINTMENTS
USING DATE_FROM
DATE_TO
C_no.
ENDFUNCTION.
%END REM
'
'Declare objects for creation of Notes documents and other Notes related stuff.
Dim Session As New NotesSession
Dim dbCurr As NotesDatabase
Dim docCurr As NotesDocument
Set dbCurr = Session.CurrentDatabase
'Counter vars
Dim intRow As Integer
Dim intEndRow As Integer
'Declare the function object
Dim RfcAppointmentGet As RFCfunction
'Declare the table object
Dim tblAppointment_t As RFCtable
'Create the function object and bind it to the R/3 function module "RFC_CUSTOMER_GET".
'The first parameter "objServer" is a global variable previously set by the function "AssertConnection".
'It specifies the R/3 application server on which the function module will be processed.
Set RfcAppointmentGet = New RFCfunction(objServer, "APPOINTMENT_GET")
'Assign the "Import" parameters of the function module for data selection.
'We look from the client's side: The function module's "Imports" are our "Exports"
'Wildcards are allowed.
RfcAppointmentGet.Exports("DATE_FROM").Value = "01.01.2002"
RfcAppointmentGet.Exports("DATE_TO").Value = "01.01.2003"
' Call the function. If the result is true process the data, else pop up a message.
If RfcAppointmentGet.Call = True Then
'Bind the table object to the function's interface table "APPOINTMENTS"
Set tblAppointment_t = RfcAppointmentGet.Tables("APPOINTMENTS")
'get number of rows to be imported
intEndRow = Cint(Inputbox$("Number of documents to be imported:", _
"Table contains" & Str$(tblAppointment_t.ColumnCount) & " columns and " & Str$(tblAppointment_t.Rows.Count) & " rows" , _
Str$(tblAppointment_t.Rows.Count)))
'Loop through the retrieved data and create a Notes document for each row.
For intRow = 1 To intEndRow
Set docCurr = dbCurr.CreateDocument
'Set various fields
docCurr.Type = "APPOINTMENT"
docCurr.Form = "APPOINTMENT"
'Write the customer data into the Notes document.
docCurr.WHO= tblAppointment_t.GetCell (intRow, 1)
'... and what have ya
Call docCurr.Save (True, True)
Next
Else
'In this case of error the "Message" property contains the appropriate error message.
Print "Call Failed! error: " + RfcAppointmentGet.Message
End If
End Sub