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.
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography
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 37 38 39 40 41 42 43 |
'-Begin Class myDestinationDataProvider--------------------------------- Implements DestinationDataProvider '-Variables----------------------------------------------------------- Private eL As DestinationDataEventListener Private ABAP_AS_Prop As Properties '--------------------------------------------------------------------- Private Sub Class_Initialize() Set ABAP_AS_Prop = New Properties End Sub '--------------------------------------------------------------------- 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 ChangePropertiesForABAPAS(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------------------------------------------------------------------- |
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 |
Public Sub CallSAP() Dim propConn As Properties Set propConn = New Properties Dim destDataProv As DestinationDataProvider propConn.setProperty(destDataProv.JCO_ASHOST, "10.100.200.100") propConn.setProperty(destDataProv.JCO_SYSNR, "99") propConn.setProperty(destDataProv.JCO_CLIENT, "999") propConn.setProperty(destDataProv.JCO_USER, "bambi") propConn.setProperty(destDataProv.JCO_PASSWD, "hugo") propConn.setProperty(destDataProv.JCO_LANG, "DE") Static myDestDataProv As New myDestinationDataProvider Set myDestDataProv = New myDestinationDataProvider com#sap#conn#jco#ext#Environment.registerDestinationDataProvider(myDestDataProv) myDestDataProv.ChangePropertiesForABAPAS(propConn) Dim dest As com#sap#conn#jco#JCoDestination Set dest = com#sap#conn#jco#JCoDestinationManager.getDestination("ABAP_AS") 'dest.ping() Form1.Outputbox.appendText dest.getAttributes().toString() com#sap#conn#jco#ext#Environment.unregisterDestinationDataProvider(myDestDataProv) propConn.clear() End Sub |
This post has been edited 2 times, last edit by "StefanSchnell" (Oct 5th 2010, 9:47am)
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
'-Read tables with RFC_READ_TABLE----------------------------------------- Dim i, j As Integer '-Get repository instance----------------------------------------------- Dim repos As JCoRepository Set repos = dest.getRepository() '-Define function------------------------------------------------------- Dim func As JCoFunction Set func = repos.getFunction("RFC_READ_TABLE") '-Set arguments for function-------------------------------------------- func.getImportParameterList().setValue("QUERY_TABLE", "SFLIGHT") func.getImportParameterList().setValue("DELIMITER", "~") '-Execute function------------------------------------------------------ com#sap#conn#jco#JCoContext.begin(dest) func.execute(dest) com#sap#conn#jco#JCoContext.end(dest) '-Get field names------------------------------------------------------- Dim fields As JCoTable Set fields = func.getTableParameterList().getTable("FIELDS") Dim fcnt As Integer fcnt = fields.getNumRows() - 1 '-Set field names as header in the grid------------------------------- For i = 0 To fcnt fields.setRow(i) Form1.Grid.Header(i) = fields.getString("FIELDNAME") Form1.Grid.Refresh Next '-Get table content----------------------------------------------------- Dim table As JCoTable Set table = func.getTableParameterList().getTable("DATA") Dim cnt As Integer cnt = table.getNumRows() Dim felder(0 To fcnt) As String '-Set table in the grid----------------------------------------------- For i = 0 To cnt - 1 table.setRow(i) felder = table.getString("WA").split("~") For j = 0 To fcnt - 1 Form1.Grid.TextMatrix(i, j) = felder(j) Next Next |
This post has been edited 2 times, last edit by "Stefan_Schnell" (Apr 19th 2009, 10:37am)
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Dim propConn As Properties Set propConn = New Properties '-Application server (Anwendungsserver)------------------------------- propConn.setProperty(destDataProv.JCO_ASHOST, "localhost") '-System number (Systemnummer)---------------------------------------- propConn.setProperty(destDataProv.JCO_SYSNR, "00") '-Client (Mandant)---------------------------------------------------- propConn.setProperty(destDataProv.JCO_CLIENT, "000") '-User (Benutzer)----------------------------------------------------- propConn.setProperty(destDataProv.JCO_USER, "bambi") '-Password (Kennwort)------------------------------------------------- propConn.setProperty(destDataProv.JCO_PASSWD, "hugo") '-Language (Sprache)-------------------------------------------------- propConn.setProperty(destDataProv.JCO_LANG, "DE") |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
'-Define function----------------------------------------------------- Dim func As JCoFunction Set func = repos.getFunction("RFC_READ_TABLE") '-Set arguments for function------------------------------------------ func.getImportParameterList().setValue("QUERY_TABLE", "SFLIGHT") func.getImportParameterList().setValue("DELIMITER", "~") '-Execute function---------------------------------------------------- com#sap#conn#jco#JCoContext.begin(dest) func.execute(dest) com#sap#conn#jco#JCoContext.end(dest) |
Jabaco Source |
|
1 2 3 4 5 6 7 |
'-Get field names----------------------------------------------------- Dim fields As JCoTable Set fields = func.getTableParameterList().getTable("FIELDS") '-Get table content--------------------------------------------------- Dim table As JCoTable Set table = func.getTableParameterList().getTable("DATA") |
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
'-Begin------------------------------------------------------------------ '-CallSAP-------------------------------------------------------------- Private Function CallSAP() As com#sap#conn#jco#JCoDestination Dim propConn As Properties Set propConn = New Properties Dim destDataProv As DestinationDataProvider propConn.setProperty(destDataProv.JCO_ASHOST, "10.100.100.100") propConn.setProperty(destDataProv.JCO_SYSNR, "99") propConn.setProperty(destDataProv.JCO_CLIENT, "099") propConn.setProperty(destDataProv.JCO_USER, "hugo") propConn.setProperty(destDataProv.JCO_PASSWD, "bambi") propConn.setProperty(destDataProv.JCO_LANG, "DE") Static myDestDataProv As New myDestinationDataProvider Set myDestDataProv = New myDestinationDataProvider com#sap#conn#jco#ext#Environment.registerDestinationDataProvider(myDestDataProv) myDestDataProv.ChangePropertiesForABAPAS(propConn) CallSAP = com#sap#conn#jco#JCoDestinationManager.getDestination("ABAP_AS") End Function '-DeRegister------------------------------------------------------------ Private Sub DeRegister(DestDataProv As DestinationDataProvider, ByRef propConn As Properties) com#sap#conn#jco#ext#Environment.unregisterDestinationDataProvider(DestDataProv) propConn.clear() End Sub '-outGrid--------------------------------------------------------------- Private Sub outGrid(GridName As JBGrid, JFunc As JCoFunction) Dim fields As JCoTable Dim table As JCoTable Dim fcnt As Integer Dim cnt As Integer '-Get field names--------------------------------------------------- Set fields = JFunc.getTableParameterList().getTable("FIELDS") fcnt = fields.getNumRows() - 1 '-Set field names as header in the grid----------------------------- For i = 0 To fcnt fields.setRow(i) GridName.Header(i) = fields.getString("FIELDNAME") Next GridName.Refresh '-Get table content------------------------------------------------- Set table = JFunc.getTableParameterList().getTable("DATA") cnt = table.getNumRows() Dim felder(0 To fcnt) As String '-Set table in the grid--------------------------------------------- For i = 0 To cnt - 1 table.setRow(i) felder = table.getString("WA").split("~") For j = 0 To fcnt - 1 GridName.TextMatrix(i, j) = felder(j) Next Next GridName.Refresh table.clear() fields.clear() End Sub '-getDebug_Click-------------------------------------------------------- Public Sub getDebug_Click() Dim i, j As Integer Dim dest As com#sap#conn#jco#JCoDestination Dim fields As JCoTable Dim func As JCoFunction Dim repos As JCoRepository '-Read tables with RFC_READ_TABLE----------------------------------- Set dest = CallSAP() '-Get repository instance------------------------------------------- Set repos = dest.getRepository() '-Define function--------------------------------------------------- Set func = repos.getFunction("Z_RFC_READ_TABLE") '-Set arguments for function---------------------------------------- func.getImportParameterList().setValue("DELIMITER", "~") '-Execute function-------------------------------------------------- com#sap#conn#jco#JCoContext.begin(dest) '-Read table ABDBG_INFO----------------------------------------- func.getImportParameterList().setValue("QUERY_TABLE", "ABDBG_INFO") func.execute(dest) outGrid(GridABDBGInfo, func) '-Read table ABDBG_BPS------------------------------------------ func.getImportParameterList().setValue("QUERY_TABLE", "ABDBG_BPS") func.execute(dest) outGrid(GridABDBGBPS, func) '-Read table ICFATTRIB------------------------------------------ Set fields = func.getTableParameterList().getTable("FIELDS") fields.appendRow() fields.setValue("FIELDNAME", "USERNAME") fields.appendRow() fields.setValue("FIELDNAME", "SERVER") fields.appendRow() fields.setValue("FIELDNAME", "CHOST") fields.appendRow() fields.setValue("FIELDNAME", "DEBUGID") func.getImportParameterList().setValue("QUERY_TABLE", "ICFATTRIB") func.execute(dest) outGrid(GridICFATTRIB, func) com#sap#conn#jco#JCoContext.end(dest) End Sub '-End-------------------------------------------------------------------- |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
old code:--> data: begin of work, buffer(30000), end of work. field-symbols: <wa> type any, <comp> type any. assign work to <wa> casting type (query_table). if rowcount > 0. rowcount = rowcount + rowskips. endif. New Code :--> data: dref type ref to data. field-symbols: <wa> type any, <comp> type any. create data dref type (query_table). assign dref->* to <wa>. |
This post has been edited 3 times, last edit by "StefanSchnell" (Oct 5th 2010, 9:59am)
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography
Trainee
Date of registration: Mar 13th 2009
Location: Oberirsen - Germany
Occupation: Senior Software Engineer
Hobbies: Programming aund Photography