Domino 9 und frühere Versionen > Entwicklung

Import von Daten aus SAP/R3

(1/3) > >>

eknori:
@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

eknori:
nun, den Fehler beim Datum habe ich gefunden.

statt

RfcAppointmentGet.Exports("DATE_FROM").Value = "01.01.2002"
RfcAppointmentGet.Exports("DATE_TO").Value = "01.01.2003"

muss es einfach

RfcAppointmentGet.Exports("DATE_FROM").Value = "20020101"
RfcAppointmentGet.Exports("DATE_TO").Value = "20030101"

heißen.

Leider liefert die Funktion (noch) keine Werte zurück.

eknori

Hoshee:
Yoo eknori,

ich hab' leider Business-Explorer zur Hand, aber in Deinem Script taucht die Variable C_no auf.


--- Zitat ---PERFORM APPOINTMENT_GET_ TABLES APPOINTMENTS
   USING  DATE_FROM
   DATE_TO
                                C_no.
   

--- Ende Zitat ---

Ich nehme man an soll heissen "Kundennummer", aber Du übergibst diesen Wert nirgendwo.
Schau mal in diese Richtung.

Vielleicht sucht Du mal nach einem entsprechenden BAPI oder BO im SAP. Die sind meist besser beschrieben.

Gruss ...

Hoshee

eknori:
Hallo Hoshee,

die RFC hat als export (also Parameter) nur DATE_FROM und DATE_TO. C_No ist bereits innerhalb der ABAP und kann nicht übergeben werden.
Der Aufruf wird jetzt auch Fehlerfrei ausgeführt, nur leider kommen keine Werte zurück. Im Debugger sieht man auch, daß er APPOINTMENTS als Object initialisiert; leider steht bei ROWS nix drin.

Na, hab ja heute erst mit dem Kram angefangen; das wird schon.

Ziel ist eine Sychronisation des SAP Kalenders mit dem NotesKalender und andersherum.

Na, der Abend ist ja noch lang; bin Strohwitwer  ;D ;D
Frau zum Klassentreffen in Dresden, Tochter auf ner Party mit Übernachtung, Werner in der Glotze und nen Falschbier aufm Tisch.  ;D ::) ::)

eknori

Hoshee:
Yoo,

bei mir fast ähnlich. Frau in der Badewanne und beide Kinder im Bett.
Ich werde mir am Montag mal den Business-Explorer schnappen (wenn ich noch eine ID finde, die das darf und mal schauen)

Gruss ...

Hoshee

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln