Using the SAPbobsCOM.Recordset & DataTables
I'm trying to find the best way to tie the SAPbobsCOM.Recordset object (based, for example, on a query to return all Employees) to a more .NET compatible data object such as a datatable or dataset.
In other words, for things such as combo boxes, datagrids etc in .NET how are you guys usually binding data from SBO?
I can just write a call directly to the DB, but wanted to go through the SDK if possible.
Thanks!
I actually ended up putting this into a utility .dll, but here's the function...
Public Function ConvertRecordset(ByVal SAPRecordset As SAPbobsCOM.Recordset) As DataTable
'\ This function will take an SAP recordset from the SAPbobsCOM library and convert it to a more
'\ easily used ADO.NET datatable which can be used for data binding much easier.
Dim dtTable As New DataTable
Dim NewCol As DataColumn
Dim NewRow As DataRow
Dim ColCount As Integer
Try
For ColCount = 0 To SAPRecordset.Fields.Count - 1
NewCol = New DataColumn(SAPRecordset.Fields.Item(ColCount).Name)
dtTable.Columns.Add(NewCol)
Next
Do Until SAPRecordset.EoF
NewRow = dtTable.NewRow
'populate each column in the row we're creating
For ColCount = 0 To SAPRecordset.Fields.Count - 1
NewRow.Item(SAPRecordset.Fields.Item(ColCount).Name) = SAPRecordset.Fields.Item(ColCount).Value
Next
'Add the row to the datatable
dtTable.Rows.Add(NewRow)
SAPRecordset.MoveNext()
Loop
Return dtTable
Catch ex As Exception
MsgBox(ex.ToString & Chr(10) & "Error converting SAP Recordset to DataTable", MsgBoxStyle.Exclamation)
Exit Function
End Try
End Function
Similar Messages
-
VBA with SAPbobsCOM.Recordset
Hi all,
I'm trying to do a report using VBA microsoft word.
I manage to connect to the database using the DI API.
But when i tried to do the
SAPbobsCOM.Recordset, i got error.
Need advice.
Regards,
Bruce.The code I have contains plenty of other stuff, I try to give you some pseudocode for a dll - OK I know this is a very bad pseudocode, it is just to give you an idea ...;-). You should then use this dll from your VBA module: this is what we did and it worked well.
SAPbobsCOM.Company company = new Company();
int Initialize()
/// connect the company
int Finalize()
/// disconnect the company
/// this method read data from the DB with a Recordset
/// and returns them into an array of strings
string[] loadData()
/// your returned data
string[] ret = new string[];
/// your SQL query
string query;
/// the recordset
SAPbobsCOM.Recordset rset;
rset = company.GetBusinessObject(SAPbobsCOM.BoRecordset);
rset.DoQuery(query);
/// loop to fill into the string array
/// move the position in the recordset with rset.MoveNext
/// until you reach rset.EoF and copy the data in ret
return ret; -
[ADF] Having Difficulties in Figuring Out Using the af:selectInputText Tag
This is my first time using the ADF tags.
The <af:selectInputText> is an input component that can launch a dialog and automatically accept its return value.
My pop-up is a data table that provides "code" and "description". And the selection made will be return to the parent page and the "code" will be populated in the input field.
First, I tested if my data table can be constructed successfully. Yes, I am able to use the JSF <h:dataTable> tag to display without problem.
Second, I have adf-faces-api-10_1_3_0_4.jar and adf-faces-impl-10_1_3_0_4.jar in my WEB-INF/lib directory.
Third, my web.xml and faces-config.xml work well because I was able to render JSF tags.
Fourth, I have created the adf-faces-config.xml file with its contents directly copied from the ADF Configuration web site. The adf-faces-config.xml is placed together with the web.xml and faces-config.xml files.
Fifth, on top of my ***.jsp, I added
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/EA10" prefix="af" %>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/EA10/html" prefix="afh" %>
However, the IDE says that <af:selectInputText ...> is an unknown tag.
Besides, for the value of the "action" attribute of the <af:selectInputText ...>, what is supposed to be filled for the "dialog:?????"
and the compiler starts complaining that the "value" attribute in my <h:dataTable ...> has no value! But, my <h:dataTable ....> worked well before I introduced ADF.
Here is my code in the ***.jsp:
<f:view>
<h:form>
<af:selectInputText label="Sex: " id="idInputText"
value="#{listOfValuesManagementBean.selectedGender}"
popupTitle="Sex Types"
action="dialog:????????????" windowWidth="300" windowHeight="200">
<h:dataTable id="gender" value="#{listOfValuesManagementBean.genderTypes}" var="genderType">
<h:column>
<f:facet name="header">
<h:outputText value="Code"/>
</f:facet>
<h:outputText value="#{genderType.code}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
<h:outputText value="#{genderType.description}"/>
</h:column>
</h:dataTable>
</af:selectInputText>
</h:form>
</f:view>I use IBM Rational Application Developer (RAD v.7)
As you know that my JSF code had worked before I started introducing ADF tags.
Now, I have resoved all the complilation complaints in my ***.jsp where I have the ADF <af:selectInputText ...> tag and all tags inside the <af:selectInputText ...> tag.
But, I have the "Error 500: Cannot find FacesContext" in the browser when I run the ***.jsp.
I believe it is in my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
ADF_TEST</display-name>
<context-param>
<description>
The location where state information is saved.
Valid values are 'server' (typically saved in HttpSession) and 'client' (typically
saved as a hidden field in the form.
Default is server.</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<description>
The default suffix for extension-mapped resources that contain JSF components.
Default is '.jsp'.</description>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>
<context-param>
<description>
Number of Views to be stored in the session when Server-Side State Saving is being used.
Default is 15.</description>
<param-name>com.sun.faces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
<param-value>15</param-value>
</context-param>
<context-param>
<description>
If set to true while server-side state saving is being used, a serialized representation
of the view is stored on the server. This allows for failover and sever clustering support.
Default is false. This parameter is not available in JSF 1.0.</description>
<param-name>com.sun.faces.enableHighAvailability</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
If set to true while client-side state saving is being used, reduces the number of bytes
sent to the client by compressing the state before it is encoded and written as a hidden field.
Default is false. This parameter is not available in JSF 1.0.</description>
<param-name>com.sun.faces.COMPRESS_STATE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
Monitors Faces JSP files for modifications and synchronizes a running server with
the changes without restarting the server. If this parameter is set to false or
removed from the deployment descriptor, any changes made to Faces JSP files may
not be seen by the server until it is restarted. This parameter is usually set
to true while the Faces JSP files are being developed and debugged in order to
improve the performance of the development environment.</description>
<param-name>com.ibm.ws.jsf.JSP_UPDATE_CHECK</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
Load JSF runtime when the application server starts up. If this parameter is set to false or removed,
JSF runtime will be loaded and initialized when the first JSF request is processed.
This may disable custom JSF extensions, such as factories defined in the project.</description>
<param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
If set to true disables use of MultipartFacesContext, allowing underlying implementations to be used.
MultipartFacesContext is required when the FileUpload component is used, and can be disabled otherwise.</description>
<param-name>com.ibm.faces.DISABLE_JWL_MULTIPART_CONTEXT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
Value, in milliseconds, to be used for Expires header for resources served by the JavaScript Resource Servlet.
Default is never (31536000000 milliseconds or 1 year).</description>
<param-name>com.ibm.faces.RESOURCE_EXPIRE_MS</param-name>
<param-value>31536000000</param-value>
</context-param>
<context-param>
<description>
Defines the strictness of the conversion when converting from a string to a date.
The higher the value, the more exactly the value must conform to the format.
If 0 (liberal), all 'literals' are ignored while parsing a value, mis-ordered components will be rearranged,
any missing component is supplied using the current datetime, misspellings and incomplete spellings are allowed
(to the extent that they can be evaluated), 'E' and other non-unique components are ignored.
If 1 (strict), all 'literals' are ignored while parsing a value, any missing component is supplied using the current
datetime, misspellings and incomplete spellings are allowed (to the extent that they can be evaluated),
'E' and other non-unique components are ignored. For example if the pattern is MMMM dd, yyyy a user can enter 'Feb/02/04'
and it will be parsed as February 02, 2004.
If 2 (very strict), an exact match is required except long month names can be 'shortened' to the minimum number of unique
characters and 'E' and other non-unique components are ignored. Literals must match exactly.
Default is 1.</description>
<param-name>com.ibm.faces.DATETIME_ASSIST_STRICTNESS</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<description>
Defines the strictness of the conversion when converting from a string to a number.
The higher the value, the more exactly the value must conform to the pattern.
For numbers, currently strictness levels of 0 and 1 are equivalent. If the strictness is 2,
if number is signed, the sign must be provided (otherwise it's assumed positive).
Default is 1.</description>
<param-name>com.ibm.faces.NUMBER_ASSIST_STRICTNESS</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<description>
Defines the path for resources such as JavaScript libraries and images.
The value can be either:
1. An empty string. Context path of the current application will be used.
2. A path string. Example: /project13. A number. Specifies the number of nodes to use from the context path starting from the left.
Example: With a value of 1 if the context path is /screen/faces/SSID110267549/RID1102676
the path will be evaluated as /screen
Default is an empty string.</description>
<param-name>com.ibm.faces.USE_UNENCODED_CONTEXT_PATH</param-name>
<param-value></param-value>
</context-param>
<context-param>
<description>
Sets a custom url-pattern for the JavaScript Resource servlet.
Should match servlet mapping setting for the JavaScript Resource servlet. If the default default mapping
value '/.ibmjsfres/*' is modified, this context-param should also be modified.
</description>
<param-name>com.ibm.faces.JS_RESOURCE_SERVLET_URL_PATTERN</param-name>
<param-value>/.ibmjsfres/*</param-value>
</context-param>
<context-param>
<description>
If set to true, forces JavaScript Resource Servlet to cache all resources on the server.
This can be useful when client-side caching is turned off.</description>
<param-name>com.ibm.faces.JS_RESOURCE_SERVLET_CACHE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
Sets a custom charset mapping properties file similar to converter.properties in WAS.</description>
<param-name>com.ibm.faces.ENCODING_MAPPING</param-name>
<param-value>converter.properties</param-value>
</context-param>
<context-param>
<description>
Number of Views to be stored in the session when Enhanced State Saving is being used.
Default is 15.</description>
<param-name>com.ibm.faces.ENHANCED_SERVER_STATE_SAVING_SESSION_STORED_VIEWS</param-name>
<param-value>15</param-value>
</context-param>
<context-param>
<description>
If set to true, the entire JavaScript library, containing code for all components, will be included
in the generated pages as one file. If set to false or removed, multiple smaller JavaScript files will be
included, depending on the components used on the page.Default is false.</description>
<param-name>com.ibm.faces.USE_HXCLIENT_FULL</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet id="Servlet_1181745021880">
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>
javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<servlet id="Servlet_1181745029380">
<servlet-name>JavaScript Resource Servlet</servlet-name>
<servlet-class>
com.ibm.faces.webapp.JSResourceServlet</servlet-class>
<load-on-startup>-1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>JavaScript Resource Servlet</servlet-name>
<url-pattern>/.ibmjsfres/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>and my ***.jsp looks like:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af" %>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test the ADF selectInputText Tag</title>
</head>
<body>
<f:view>
<h:form>
<af:selectInputText label="Sex: " id="idInputText"
value="#{listOfValuesManagementBean.selectedGender}"
action="dialog:chooseGender" windowWidth="300" windowHeight="200">
<af:table id="gender" value="#{inputListOfValuesManagementBean.genderTypes}" var="genderType">
<af:column>
<f:facet name="header">
<af:outputText value="Code"/>
</f:facet>
<af:outputText value="#{genderType.code}"/>
</af:column>
<af:column>
<f:facet name="header">
<af:outputText value="Description"/>
</f:facet>
<af:outputText value="#{genderType.description}"/>
</af:column>
</af:table>
</af:selectInputText>
</h:form>
</f:view>
</body>
</html>Message was edited by:
user537770 -
How to get a recordset defined by primarykeys using the LabVIEW Database Connectivity Toolset?
Hi folks.
I'm using LabVIEW with the LabVIEW Db Toolset and Microsoft Access. The table contains 18 columns with a growing nr of rows.Now I want to get the whole recordset containing all columns defined by my primary keys. My SQL-statement is sofar:
SELECT ALL FROM IMPULS_STATOR WHERE FAB = [string] AND LDATE = [datestring] AND ADATE = [datestring]
But every time I end up with an error message saying "Invalid string: specified field does not exist or contains an unsupported character". I mutated the statement several times, adding or removing spaces, colons, etc.
What am I doing wrong?
Thanks in advanceThanks, Dennis.
Unfortunately, I`m still encountering some problems with the DateValue function. My date/time field has this format: yyyy-mm-dd hh:nn:ss . If I use DateValue, nothing will be returned. Changing the format to yyyy-mm-dd in the Access DB didn`t help and I do need the time. Combining DateValue and TimeValue let to several errors. Using only TimeValue did not help me out. LabVIEW does not indicate errors anymore, therefore the syntax should be fine. But I don`t get any information back from my database. -
Using the results of one recordset to filter another.
Hi
I have a dynamically generated web page that uses a recordset to gather most of the relevant information that is needed on it. However, what i need to do is create a second record set on the same page and filter that second recordset using one of the results generated from the first recordset. The problem that i am having is that the first recordset displays its information as an echo <?php echo $row_Recordset1['move_type']; ?> but i obviously cannot use this echo code in the filter for the second recordset, the code obviously needs tweaking but i am not sure how.
If it were as simple as copy and paste the query i would need for the recordset2 is as follows but i am unsure how to code the echo from the first recordset. I am well aware that the following code could never work but i hope it works as simplified example of my intention.
SELECT ID, move_name, catagory_link_path, move_type, mem_on_off
FROM moves
WHERE move_type = <?php echo $row_Recordset1['move_type']; ?>
ORDER BY move_name ASC
Any help would be appreciatedI can think of two ways this can be done. One way, (which may or may not be appropriate in your case) is to use an INNER JOIN. Here is an example:
$presenterset1=mysql_query("SELECT * FROM presenters INNER JOIN presenters_course USING (presenter_id) WHERE course_id='$course_id' ORDER BY presenter_rank");
Do a search for tutorials on INNER JOIN for information about how to use it.
Another possible solution is to nest one SQL statement within the result of another: like this:
$sql1=mysql_query("SELECT one, two, three from table1 WHERE one='$one'");
while ($result1=mysql_fetch_assoc($sql1)){
extract ($result1);
$sql2=mysql_query("SELECT apple, orange, pear from table2 WHERE fruit='$three'");
while ($result2=mysql_fetch_assoc($sql2)){
extract ($result2);
echo "$apple and $orange" and $pear<br/>"; -
Getting the selected row (selected using radio button in dataTable)
I have problem getting the selected row.
If not mistaken, the way used in BalusC's website sets the value to the backing bean using the valueChangeListener.
Can I set the value to the DTO instead?
using something like
private boolean selected;
public void setSelectedItem(ValueChangeEvent e){
this.selected = true;
} If i use this way it throws NoSuchMethodException. I have no idea why. I did this for the checkbox and it works fine. I don't know why it doesn't work for radio buttons.The DataTable is below :
<h:panelGrid columns="1" columnClasses="table_align">
<t:dataTable id="table1" value="#{sysMgrBean.locationList}"
var="location" rows="5" styleClass="table" headerClass="tableHeader"
rowClasses="tableRowOdd, tableRowEven" width="500">
<t:column>
<f:facet name="header">
<h:outputText styleClass="lbl" value="#{lbl['no']}" />
</f:facet>
<h:outputText value="#{location.id}" />
</t:column>
<t:column>
<f:facet name="header">
<h:outputText styleClass="lbl" value="#{lbl['slct']}" />
</f:facet>
<h:selectOneRadio value="#{location.selected}"
onfocus="dataTableSelectOneRadio(this);"
onclick="enableInput(this.form,this)" valueChangeListener="#{location.setSelectedItem}">
<f:selectItem itemValue="" value="true" />
</h:selectOneRadio>
</t:column>
<t:column>
<f:facet name="header">
<h:outputText styleClass="lbl" value="#{lbl['cd']}" />
</f:facet>
<h:outputText value="#{location.loccd}" />
</t:column>
<t:column>
<f:facet name="header">
<h:outputText styleClass="lbl" value="#{lbl['desc']}" />
</f:facet>
<h:inputText id="Description" value="#{location.descr}" disabled="#{location.disabled}" />
</t:column>
</t:dataTable>In the DTO :
private boolean selected;
public void setSelectedItem(ValueChangeEvent e){
this.selected = true;
} -
How to set the rows of dataTable using loadBundle tag?
Hi,
Can i set the rows property of a <h:dataTable> using the value from a <f:loadBundle> tag?
I tried the following code
<f:loadBundle basename="com.message.NumberOfRows" var="numRows"/>
I have NumberOfRows.properties file with the following entry
rows=5
The dataTable code
<h:dataTable value="#{mastData.list}" rows="#{numRows.rows}" align="center" var="mastBean">
</h:dataTable>
This code is generating ClassCast Exception.
Please comment on this issue.
Thanks,
RenjuHi,
Exactly Reymond, See Renju you already using mastData bean for datatable. In that create a bean method something like rows & create a getter/setter method returning int. In getter method try this code as
ResourceBundle bundle = ResourceBundle.getBundle("ur resource bundle");
rows = Integer.parseInt(bundle.getString("rows_to_display"));
return rows.
Hope you can now get some clear idea i guess
Regards,
A. -
Set crystal report .rtp file with SAPbobsCOM.Recordset type object
Hi Experts,
I need to pass the resultset of my SAPbobsCOM.Recordset type query to the rpt file. what report object should i use. at the moment i am using reportdocument but at the point of calling .SetDataSource(rs) it says the datasource is not valid.
Please help.
Is there any addon sample regarding setting the recordsouce of a report by setting it with SAPbobsCOM.Recordset type object is availabel.
Regards.Hi Maryam,
In my sample I'm getting the values from a DataTable. But the procedure is the same for a RecordSet.
Private Sub PrintDM(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, ByRef oForm As SAPbouiCOM.Form)
Dim dt_h As Data.DataTable = Nothing
Dim drh As Data.DataRow = Nothing
Dim dt_r As Data.DataTable = Nothing
Dim drr As Data.DataRow = Nothing
Dim ds As Data.DataSet = Nothing
Dim rsNotaRecepcao As SAPbobsCOM.Recordset = Nothing
Dim rsMorada As SAPbobsCOM.Recordset = Nothing
Dim rptConnectionInfo As ConnectionInfo = Nothing
Dim rptPath As String = Nothing
Dim myTables As Tables = Nothing
Dim myTableLogonInfo As TableLogOnInfo = Nothing
Dim rptDocument As ReportDocument = Nothing
Dim FileName As String = "DiarioDeMovimentos"
Try
dt_h = New Data.DataTable("HEADER")
dt_h.Columns.Add("Key")
dt_h.Columns.Add("Empresa")
dt_h.Columns.Add("DiaryCod")
dt_h.Columns.Add("DiaryNam")
dt_h.Columns.Add("FromNum")
dt_h.Columns.Add("ToNum")
dt_h.Columns.Add("FromDate")
dt_h.Columns.Add("ToDate")
dt_h.Columns.Add("G")
dt_h.Columns.Add("A")
dt_h.Columns.Add("F")
dt_r = New Data.DataTable("ROWS")
dt_r.Columns.Add("Key")
dt_r.Columns.Add("Arquivo")
dt_r.Columns.Add("DataLancamento")
dt_r.Columns.Add("TipoDocumento")
dt_r.Columns.Add("Conta")
dt_r.Columns.Add("Debito")
dt_r.Columns.Add("Credito")
dt_r.Columns.Add("NumExterno")
dt_r.Columns.Add("DataDocumento")
dt_r.Columns.Add("DataVencimento")
dt_r.Columns.Add("Detalhes")
'#### Fill HEADER fields
With oForm.DataSources.UserDataSources
drh = dt_h.NewRow()
drh("Key") = "1"
drh("Empresa") = oCompany.CompanyName
drh("DiaryCod") = .Item("DSDiaryCod").ValueEx
drh("DiaryNam") = .Item("DSDiaryNam").ValueEx
If .Item("DSFromNum").ValueEx = "" Then
drh("FromNum") = "0"
Else
drh("FromNum") = DateFromDS(oApplication, .Item("DSFromNum").ValueEx)
End If
If .Item("DSToNum").ValueEx = "" Then
drh("ToNum") = "0"
Else
drh("ToNum") = DateFromDS(oApplication, .Item("DSToNum").ValueEx)
End If
If .Item("DSFromDate").ValueEx = "" Then
drh("FromDate") = "0"
Else
drh("FromDate") = DateFromDS(oApplication, .Item("DSFromDate").ValueEx)
End If
If .Item("DSToDate").ValueEx = "" Then
drh("ToDate") = "0"
Else
drh("ToDate") = DateFromDS(oApplication, .Item("DSToDate").ValueEx)
End If
drh("G") = .Item("DSGeneral").ValueEx
drh("A") = .Item("DSAnalitic").ValueEx
drh("F") = .Item("DSCashFlow").ValueEx
End With
dt_h.Rows.Add(drh)
Dim creditString As String = ""
Dim oBP As SAPbobsCOM.BusinessPartners
oBP.CreditLimit = IIf(creditString = "", 0.0, Convert.ToDouble(creditString))
(continues)
Hope it helps,
Regards,
Vítor Vieira -
Bug in SAPbobsCOM.Recordset.GetAsXML()?
I am using the following code:
string query =
"SELECT BoxCode as stBoxcode, (CASE WHEN TaxCode = 'B' THEN BaseAmount ELSE Debit + Credit END) AS Amountx " +
"FROM (SELECT VatTaxBox.BoxCode, VatTaxBox.TaxCode, SUM(dbo.JDT1.Basesum * VatTaxBox.FSign) as BaseAmount, SUM(dbo.JDT1.Debit * VatTaxBox.FSign) AS Debit, SUM(dbo.JDT1.Credit * VatTaxBox.FSign) AS Credit " +
"FROM dbo.JDT1 INNER JOIN dbo.OJDT ON dbo.JDT1.TransId = dbo.OJDT.TransId " +
"INNER JOIN dbo.OVTG ON dbo.JDT1.VatGroup = dbo.OVTG.Code " +
"inner join (SELECT (CASE WHEN BOXx IS NULL THEN VatBoxes.Boxcode ELSE BOXx END) AS BoxCode, VATMember, FormulSignx * FormulSign as FSign, OBOX.summayfld AS TaxCode " +
"FROM (SELECT TOP 100 PERCENT B11.BoxCode AS BOXx, B0.boxcode, B0.BoxMember, B0.VATMember, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
"where b1.boxcode=B0.boxcode and b1.SeqNum = B0.Seqnum-1), +1) AS FormulSignx, isnull((select (case when formulSign='M' then -1 else +1 END) as FSignX from box1 b1 " +
"where b1.boxcode=B11.boxcode and b1.SeqNum = B11.Seqnum-1), +1) AS FormulSign " +
"FROM BOX1 B0 LEFT OUTER JOIN BOX1 B11 ON B0.BoxCode = B11.BoxMember " +
"WHERE (NOT (B0.VATMember IS NULL)) ORDER BY B11.BoxCode, B0.BoxCode, B0.SeqNum) AS VatBoxes " +
"INNER JOIN OBOX ON VatBoxes.boxcode = obox.boxcode) as VatTaxBox ON JDT1.VatGroup = VatTaxBox.VATMember " +
"WHERE (dbo.OJDT.RefDate >= '2005/01/01') AND (dbo.OJDT.RefDate <= '2005/07/01') AND OJDT.Series = 4 GROUP BY VatTaxBox.BoxCode, VatTaxBox.TaxCode ) as ResultSet ";
SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)_sapCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
try
rs.DoQuery(query);
int i = rs.RecordCount;
int j = i++;
string s = rs.GetAsXML(); //-> throws an error: "External component has thrown an exception."
catch (Exception ex)
System.Windows.Forms.MessageBox.Show(ex.ToString());
The statement rs.GetAsXML() throws an exception. However when I use a simpler query everything works fine.
What am I doing wrong?
JurgenI don't specifically, but one trick I've learned of is to "hide" complex SQL queries in functions or stored procedures. SBO sometimes has problems with complex SQL queries. They're aware of this, but until it's fixed, try putting that "monster" in a function or a view.
Hope that helps. -
SAPBobsCOM Recordset cannot execute Stored Procedure
I have a query stored in a SQL 2005 Stored Procedure, and when want to retrieve my procedure with the Recordset.doQuery() command, this error message appears :
System.Runtime.InteropServices.COMException (0xFFFFF930) at SAPbobsCOM.IRecordset.DoQuery(String QueryStr) at [ blah2..... (it refers to my code line) ]
My code is :
Dim oRec As SAPbobsCOM.Recordset
oRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Try
oRec.DoQuery("EXEC PO_LIst2")
Catch ex As Exception
MsgBox(ex.GetBaseException.ToString)
End Try
And when I change my code to be like this :
Dim oRec As SAPbobsCOM.Recordset
oRec = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Try
oRec.DoQuery("Select * From OPOR")
Catch ex As Exception
MsgBox(ex.GetBaseException.ToString)
End Try
I don't get any error....
For all of the code I use SQL Server 2005, Visual Studio 2008, and SAPBobsCOM version 8.8.
Have anyone experience this?? Why the recordset can't execute my stored procedure??
Edited by: Rinaldi Sugiono on Jun 18, 2010 1:44 PMI would search the forums for SAPBobsCOM to find a more appropriate forum, since the BusinessOne components are outside of scope for this forum.
Sincerely,
Ted Ueda -
How to send php email using email from recordset?
Hi
I know the headers to use for php mail(), and I use it for
the contact form for my viewers in order to contact the directory
listing's email address ( of which I have hidden by using the words
'Email Us' and use the id to carry through to the form).
I have sucessfully used the $to = [email protected] but when I
want to use the $row_?['email'] it will not send.
Any suggestions? I use a recordset to retrieve the id of the
listing to the contact form.
I will want to follow the same procedure for my jobseekers to
contact employers job adverts.
Thanks
TheresaHi,
There are many sms gateways that have their own api to send sms. You can use them for sms. (They will charge you for the sms!!!)
Moderator edit: Link removed
Thanks
Edited by: PhHein on 20.10.2010 16:11 -
How to use the Combo Box In MAtrix Colums
HI Experts,
Good Mornong.How to use the Combo Box In MAtrix Colums?
Regards And Thanks,
M.Thippa Reddyhi,
loading data in to the combobox on form load.but, it should be done when atleast one row is active.
the values what ever you are inserting in to combo should be less than or eqhal to 100 or 150.if it exceeds beyond that performance issue arises.it takes more time to load all the data.so, it is better to have 100 or less.
oMatrix.AddRow()
RS = Nothing
RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RS.DoQuery("select ItemCode,ItemName from oitm")
oCombo = oMatrix.Columns.Item("ColumnUID").Cells.Item(oMatrix.RowCount).Specific
For i = 1 To RS.RecordCount
If RS.EoF = False Then
oCombo.ValidValues.Add(RS.Fields.Item("ItemCode").Value,RS.Fields.Item("ItemName").Value)
RS.MoveNext()
End If
Next
the above code is inserting data from database to column combobox.
you can fill combo directly also as shown below.
oCombo.ValidValues.Add("x","1")
oCombo.ValidValues.Add("y","2")
oCombo.ValidValues.Add("z","3")
oCombo.ValidValues.Add("","")
and what ever the values you are filling into combo should be unique.other wise it shows valid value exists.
regards,
varma -
Clearing an Invoice using the DI
Hello
I am experiencing a problem when I generate a Journal Credit that is matched to a invoice using the DI but the balance on the invoice does not reduce or clear. I am using the following code:
' Generate the Excess Invoice/Document
oJournal = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
oJournal.TaxDate = Now
oJournal.Memo = "Excess-" & oCustName.Value
oJournal.Reference = lDocNum
oJournal.Lines.AccountCode = sGLTradeAcc
oJournal.Lines.ContraAccount = oCustAcc.Value
oJournal.Lines.ShortName = oCustAcc.Value
oJournal.Lines.Debit = rExcAmt
oJournal.Lines.Credit = 0
oJournal.Lines.ReferenceDate1 = Now
oJournal.Lines.LineMemo = "Excess-" & oCustName.Value
oJournal.Lines.Reference1 = lDocNum
oJournal.Lines.Add()
oJournal.Lines.AccountCode = sGLTradeAcc
oJournal.Lines.TaxDate = Now
oJournal.Lines.ContraAccount = oInvParty.Value
oJournal.Lines.ShortName = oInvParty.Value
oJournal.Lines.Credit = rExcAmt
oJournal.Lines.Debit = 0
oJournal.Lines.ReferenceDate1 = Now
oJournal.Lines.LineMemo = "Excess-" & oCustName.Value
oJournal.Lines.Reference1 = lDocNum
oJournal.Lines.Add()
If (0 <> oJournal.Add()) Then
MsgBox("failed to add a journal entry")
Call oDICompany.GetLastError(nErr, ErrMsg)
If (0 <> nErr) Then
MsgBox("Found error:" + Str(nErr) + "," + ErrMsg)
End If
End If
oJournal = Nothing
Please help !
Regards
JohnHi John,
You can only "clear" (= "Close"?!) an Invoice by posting a Payment or a Credit Memo, if I am not totally wrong!
A Journal entry only has a connection to a document (through the Origin / Origin No. fields) when it is generated in the background of the document creation!
Sorry, Frank -
Error while using the variable name "VARIABLE" in variable substitution
Hi Experts,
I am using variable substitution to have my output filename set as a payload field value. It is working fine when I am using the variable name as fname, subs etc but channel goes in error when I am using the variable name as "VARIABLE". This is probably a reserved word but i would like to know where i can find a detailed documentation on this. Say things to note / restrictions while using variable substitution.
This is the error in the channel:
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table
Thanks,
DiyaHi Zevik,
Thanks for the reply. The output file is created correctly by merely changing the variable name to something else and hence the doubt.
Below is the configuration:
Variable Substituition
VARIABLE payload:interface_dummy,1,Recordset,1,Header,1,field1,1
Filename schema : TEST_%VARIABLE%.txt
Output xml structure:
<?xml version="1.0" encoding="utf-8" ?>
- <ns:interface_dummy xmlns:ns="http://training.eu.unilever.com">
- <ns:Recordset xmlns:ns="http://training.eu.unilever.com">
- <Header>
<identifier>HDR</identifier>
<field1>001</field1>
<field2>001</field2>
<field3>R</field3>
</Header>
- <Detail>
<identifier>A</identifier>
<field1>000000002</field1>
<field2 />
<field3>Doretha.Walker</field3>
</Detail>
I thimk my configuration is correct as it is working correctly with the variable name change, However, maybe i missed something ! -
Cannot process a Fixed Field Length file using the File Adapter (Sender)
Hi -
I have checked throughout these posts and blogs but I still have not been able to find a solution to my issue. When using the File Adapter (Sender) I get a Conversion initialization failed with "xml.keyfieldName", no value found. Why would I require a key field when I am using fixed field lenghts? The file is comprised of 2 structures - 1 header and multiple details (see below). There are no key fields in the flat file that I would be able to use. Any suggestions?
011000390 Customer Americas 20080605164317 000000000000000800000008000000000016000000
12345678 100500 100500 Supplier 1 0000000000030000002008040400
12345678 100501 100501 Supplier 2 0000000000052000002008042100
The File Adapter is configured as follows:
Document Name = Rfchke00
Document Namespace = 'my namespace'
Recordset Name = Rfchke00
Recordset Structure = Dtachkh,1,Dtachkp,*
Recordset Sequence = Ascending
Recordsets per Message = 1
Key Field Type = String (Case-Sensitive)
Dtachkh.fieldFixedLengths = 15,25,8,6,1,8,8,8,15,3,31
Dtachkh.fieldNames = F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11
Dtachkh.processFieldNames = fromConfiguration
Dtachkp,fieldFixedLengths = 18,13,13,35,15,3,8,2,21
Dtachkp,fieldNames = F1,F2,F3,F4,F5,F6,F7,F8,F9
Dtachkp,processFieldNames = fromConfiguration
Thanks,
DaveHi,
you can use the module from which u can convert your structure to
H011000390 Customer Americas 20080605164317 000000000000000800000008000000000016000000
D12345678 100500 100500 Supplier 1 0000000000030000002008040400
D12345678 100501 100501 Supplier 2 0000000000052000002008042100
Please note the extra H,D in the struture added by the module.
You can then use them as your key fieldValues.. The module should be deployed in Visual Admin and then can be used in the Module tab of your adapter CC
While writing the content conversion after that please dont forget about the added new characters
Please note also that i can find that the word supplier kept repeating in all the Dtachkp records
Please use that
Also if you feel that the field is of 13 characters and that would cause a problem dont worry... create a dummy field eg split tht 13 to two fields and use the common one as key field Value and identifier... as i see in ure case its like 500 Supplier , 502 Supplier . u can split the first 4 char and the remaing 9 char are key field value.
try this out
Rgds
Aditya
Maybe you are looking for
-
DAP LUA match ipad device unique id to cert
Hi, I am trying to configure a DAP policy using LUA to perform a check that a cert has not been moved. I cert has been configured to store the ipads device unique id in the subject cn field, which i have verified on the device. I have configured the
-
Snow Leopard installation doesn't back up using TC Disk
Hi, Has anyone else on here had problems with Snow Leopard not working with an Apple Time Capsule? OS X 10.5.8 allows for Time Machine backups to be successfully created however this no longer works on my MacBook. The TC Disk is recognised however al
-
Performance issue related to OWM? Oracle version is 10.2.0.4
The optimizer picks hash join instead of nested loop for the queries with OWM tables, which causes full table scan everywhere. I wonder if it happens in your databases as well, or just us. If you did and knew what to do to solve this, it would be gre
-
I can't double click in order to open file or folder
Dear apple support team, I have the problem with open file or folder when using Mountain Lion, I can't open file or folder by double click in it. With Lion i can do it. Please advice for me, i feel use Mountain Lion is difficult.
-
IPhone's 3.1.3 firmware cause Error code 9?
Trying to update my phone to 3.1.3 last night and now is throwing error code#9 in recovery mode. Try to recover from different PCs and USB ports, still no avail. Any ideas???