You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "Stefan Schnell" is male
  • "Stefan Schnell" started this thread

Posts: 102

Date of registration: Mar 13th 2009

Location: Oberirsen - Germany

Occupation: Senior Software Engineer

Hobbies: Programming aund Photography

  • Send private message

1

Tuesday, April 14th 2009, 9:57pm

Frage zu einer Klasse

Hallo zusammen,
ich habe folgende Klasse als Klassen-Modul definiert:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'-Begin Class-----------------------------------------------------------
  Implements DestinationDataProvider 
  '-Variables----------------------------------------------------------- 
    Private eL As DestinationDataEventListener 
    Private ABAP_AS_Prop As Properties 
  '--------------------------------------------------------------------- 
    Public Function GetDestinationProperties(destName As String) As _ 
      Properties 
      If (destName = "ABAP_AS") And (ABAP_AS_Prop <> Null) Then 
        GetDestinationProperties = ABAP_AS_Prop 
      Else 
        GetDestinationProperties = Null 
      End If 
    End Function 
  '--------------------------------------------------------------------- 
    Public Sub SetDestinationDataEventListener(EventListener As _ 
      DestinationDataEventListener) 
      eL = EventListener 
    End Sub 
  '--------------------------------------------------------------------- 
    Public Function SupportsEvents() As Boolean 
      SupportsEvents = True 
    End Function 
  '--------------------------------------------------------------------- 
    Public Sub ChangePropertiesForABAP_AS(Prop As Properties) 
      If Prop = Null Then 
        eL.deleted("ABAP_AS") 
        ABAP_AS_Prop = Null 
      Else 
        If (ABAP_AS_Prop <> Null) And (ABAP_AS_Prop <> Prop) Then 
          eL.updated("ABAP_AS") 
          ABAP_AS_Prop = Prop 
        End If 
      End If 
    End Sub 
'-End-------------------------------------------------------------------

Nach deren Instanzierung:

Jabaco Source

1
Dim myDestDataProv As New myDestinationDataProvider

kann ich nicht alle Methoden verwenden.

Auch habe ich das Problem, das nach Änderung eines Klassen-Moduls nicht sofort alle Methoden sichtbar werden bzw. private Attribute sichtbar sind. Was läuft hier falsch. Bin für Tipps dankbar.
Beste Grüße
Stefan
Visit my personal or commercial site
If you have questions or suggestions, write me an eMail or
meet me here

This post has been edited 2 times, last edit by "Stefan Schnell" (Apr 16th 2009, 11:10pm)


Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

2

Tuesday, April 14th 2009, 10:19pm

Quoted

Public Sub ChangePropertiesForABAP_AS(Prop As Properties)
Methoden mit einem Unterstrich werden bei der automatischen Vervollständigung nicht angezeigt - du kannst die Methode aber trotzdem verwenden. Ich würde den Namen der Methode ändern, wenn diese nicht zu dem Interface "DestinationDataProvider" gehört.

Quoted

Auch habe ich das Problem, das nach Änderung eines Klassen-Moduls nicht sofort alle Methoden sichtbar werden
Die Klassen werden nur unter bestimmten Voraussetzungen aktualisiert. In der nächsten Version wird sich dieses Verhalten noch verbessern...

Quoted

wie oben zu sehen private Attribute sichtbar sind
Danke für diesen Hinweis. Ich werde das noch genauer prüfen...

  • "Stefan Schnell" is male
  • "Stefan Schnell" started this thread

Posts: 102

Date of registration: Mar 13th 2009

Location: Oberirsen - Germany

Occupation: Senior Software Engineer

Hobbies: Programming aund Photography

  • Send private message

3

Tuesday, April 14th 2009, 10:24pm

Hallo Manuel,
die Methode ChangePropertiesForABAP_AS fehlt in der Auflistung.
Die Klasse DestinationDataProvider ist Bestandteil des SAP Java Connectors (JCo).
Habe heute via Java den Connector zum Lesen von Tabellen programmiert, das hat gut funktioniert:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.util.Properties;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoRepository;
import com.sap.conn.jco.ext.DestinationDataEventListener;
import com.sap.conn.jco.ext.DestinationDataProvider;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoContext;
import com.sap.conn.jco.JCoTable; 
 public class SAPCon {
  public static class MyDestinationDataProvider implements DestinationDataProvider{
    private DestinationDataEventListener eL;
    private Properties ABAP_AS_properties; 
 
    public Properties getDestinationProperties(String destinationName){
      if (destinationName.equals("ABAP_AS") && ABAP_AS_properties != null) return ABAP_AS_properties;
      return null;}

    public void setDestinationDataEventListener(DestinationDataEventListener eventListener){
      this.eL = eventListener;}

    public boolean supportsEvents(){return true;}

    void changePropertiesForABAP_AS(Properties properties){
      if (properties == null){
        eL.deleted("ABAP_AS");
        ABAP_AS_properties = null;}
      else{
        if (ABAP_AS_properties != null && !ABAP_AS_properties.equals(properties))
          eL.updated("ABAP_AS");
          ABAP_AS_properties = properties;}}
  }

public static void main(String[] args) throws Exception{
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "10.100.200.100");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "99");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "099");
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "bambi");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "hugo");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "DE");

MyDestinationDataProvider myProvider = new MyDestinationDataProvider();
com.sap.conn.jco.ext.Environment.registerDestinationDataProvider(myProvider);
myProvider.changePropertiesForABAP_AS(connectProperties);

try{
JCoDestination dest = JCoDestinationManager.getDestination("ABAP_AS");
dest.ping();
System.out.println(dest.getAttributes());}
catch (Exception e){}}}

com.sap.conn.jco.ext.Environment.unregisterDestinationDataProvider(myProvider);
connectProperties.clear();

Wollte selbiges mit Jabaco umsetzen.
Danke und Gruß
Stefan
Visit my personal or commercial site
If you have questions or suggestions, write me an eMail or
meet me here

This post has been edited 2 times, last edit by "StefanSchnell" (Oct 5th 2010, 9:43am)


A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

4

Tuesday, April 14th 2009, 10:34pm

SAP JCo-Beispiel

Hallo Stefan,
vielleicht kann Jabaco die Typen wie "Properties" nicht einfach so auflösen.
Versuche mal, statt dessen "java#util#Properties" anzugeben oder die fraglichen Typen im Classpath (Taste F1) aufzunehmen.
Bei mir ist diese Klasse allerdings in RT.JAR angekreuzt gewesen, ohne dass ich etwas geändert hätte.

Ich habe mal testhalber eine eigene Klasse "Properties" eingeführt. Danach wurde mir die vorher fehlende Routine angezeigt.
Ist die SAPJCO3.JAR im Jabaco Classpath (Taste F1)? Sonst lassen sich die SAP-Typen nicht auflösen.

Das sieht ja nach einem prima Beispiel aus! Ich hoffe, Du bringst es zum Laufen uns spendest es uns.

Gruß!

A1880

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

5

Tuesday, April 14th 2009, 10:44pm

Hmm ... und wo finde ich den "SAP Java Connector" ? Der "SAP Service Marketplace" will einen Benutzernamen / Passwort.

  • "Stefan Schnell" is male
  • "Stefan Schnell" started this thread

Posts: 102

Date of registration: Mar 13th 2009

Location: Oberirsen - Germany

Occupation: Senior Software Engineer

Hobbies: Programming aund Photography

  • Send private message

6

Wednesday, April 15th 2009, 7:40am

Hallo A1880,
Danke für Deine Hinweise. An der Referenzierung zu den Properties oder dem JCo hat es nicht gelegen, die Auflösung funktioniert in Jabaco einwandfrei.
Das Beispiel habe ich in Samples & Tutorials (How to connect SAP with Jabaco via JCo (Java Connector)) eingestellt.
Danke und Gruß
Stefan

Hallo Manuel,
auch auf diesem Weg nochmal Danke für Deine Unterstützung. Der Fehler lag darin, dass die implementierte Klasse Methodennamen beinhaltete die die Worte set... und get... beinhalteten. Bei Anlage einer Methode in Jabaco wird set und get jedoch automatisch in Set und Get umgesetzt - also der erste Buchstabe als Großbuchstabe. Darauf habe ich schlichtweg nicht geachtet und dann kam es zur Kollision. Manuel schreibt dazu: "...in Deiner Klasse musst Du auf die Groß/Kleinschreibung achten. Jabaco macht da keinen Unterschied und die Klasse ist gültig für das Interface - die JavaVM findet die Methoden in der Zielklasse nicht und vermutet, dass das Interface veraltet ist, bzw. geändert wurde. Dadurch erhältst Du die Exception." Wieder etwas dazu gelernt, in diesem Sinne.
Cheers
Stefan
Visit my personal or commercial site
If you have questions or suggestions, write me an eMail or
meet me here

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

7

Wednesday, April 15th 2009, 2:35pm

SAP JCo muss separat lizensiert werden

Aus dem SAP Service Market:

Quoted


The SAP JCo is only available from SAP for connecting Java Applications to SAP Systems. Other than the above permitted usage is not allowed by SAP. The redistribution of the SAP JCo is not allowed. The terms and regulations of the respective End User License Agreement shall otherwise apply.

Java® is a registered trademark of Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303, USA.

All SAP connectors are licensed without additional license fees as part of the respective solution or component license. However, please note that each developer using a connector is required to get a respective development license and that all users accessing application functionality through the relevant connector are required to be licensed under a respective solution or component license.

Answers to frequently asked questions about the license terms of SAP JCo can be found on the FAQs Page of SAP JCo, especially under questions and answers from number 12 through number 17.


Gruß!

A1880

Rate this thread
WoltLab Burning Board