cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot DataBrowse oQuotation document

Former Member
0 Kudos

Hi, I am unable to browse through quotations with the below code - I get the following error (in the last line of code below): cannot use results from OQUT table with this object, however the exact same code using the BoObjectTypes.oOrders and using an ORDR selection works???

(I am using patch 29...)

SAPbobsCOM.IDocuments doc = (SAPbobsCOM.IDocuments)pCmp.GetBusinessObject(BoObjectTypes.oQuotations);

SAPbobsCOM.IDocument_Lines lines;

SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)pCmp.GetBusinessObject(BoObjectTypes.BoRecordset);

string quoteQuery = @"

select *

from OQUT

where DocEntry in (

select distinct DocEntry

from QUT1

where QUT1.LineStatus = 'O'

and QUT1.U_PriceUpd = 'Y'

and trgetEntry is null)

";

rs.DoQuery(quoteQuery);

doc.Browser.Recordset = rs;

Accepted Solutions (1)

Accepted Solutions (1)

FOA
Advisor
Advisor
0 Kudos

Hi Daniel,

Strange that is working wiht ORDR, can you post that code as well?

I remember there was a bug (seems it still there) when you define a query with "*" in the record set and then you assing it to the databrowser.

To be sure try the following: Define the fields you want to query instead of selecting them all with the star "*". The other option is to browse the records by using the star in your query, but to fully use the recordset to browse them (oRecordSet.MovePrevious, oRecordSet.MoveNext) here you will not have any problem at all.

HTH,

Felipe

rasmuswulff_jensen
Active Contributor
0 Kudos

I still fight with SAP Support over the same issue. Reported the problem november last year, but the problem is still there... not making a "select *" does not help much, and I've heard that the problem is C# specific...

Latest news from SAP support is that SBO2005A PL02 might have solved the problem (Was still a problem in SBO2005A PL01)...

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Filepe,

Thanks for the suggestion, I guess I will have to use the Databrowser option and just browse through those records and get the quotation document from the DocEntry...

But as you say it is strange that the Order object works okay? Below is the code that I use for orders which seems to work perfectly???

SAPbobsCOM.IDocuments doc = (SAPbobsCOM.IDocuments)_SboCompany.GetBusinessObject(BoObjectTypes.oOrders);

SAPbobsCOM.IDocument_Lines lines;

SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)_SboCompany.GetBusinessObject(BoObjectTypes.BoRecordset);

SAPbobsCOM.SBObob bob = (SAPbobsCOM.SBObob)_SboCompany.GetBusinessObject(BoObjectTypes.BoBridge);

string orderQuery = @"

select * from ORDR where DocEntry in (

select distinct DocEntry

from RDR1

where RDR1.LineStatus = 'O'

and RDR1.U_PriceUpd = 'Y')

";

rs.DoQuery(orderQuery);

doc.Browser.Recordset = rs;

while(!doc.Browser.EoF)

{

lines = doc.Lines;

for(int i = 0; i < lines.Count; i++)

{

lines.SetCurrentLine(i);

if(lines.UserFields.Fields.Item("U_PriceUpd").Value.ToString() == "Y")

{

lines.Price = double.Parse(bob.GetItemPrice(doc.CardCode, lines.ItemCode, lines.Quantity, DateTime.Now).Fields.Item("Price").Value.ToString());

//_SboProgressBar.Value ++;

}

}

doc.Browser.MoveNext();

}

doc.Update();

Message was edited by: Daniel Archer

Former Member
0 Kudos

Another issue which has arisen from this is that when I try to run the code after catching an SBO UI event (form button click, or menu click (i have tried both to see if it would work)) the code freezes at the doc.Browser.Recordset = rs; line, however running it outside of the caught event works fine?

I have posted about it here:

FOA
Advisor
Advisor
0 Kudos

Hi Daniel,

I can not test your code right now but once I had problems with the Item_Event and they were solved by rearranging how all the event variables were used.

Here a thread that was solved:

As soon as i can test your code i will let you know my results. But i dont see any problem at all with it.

Regards,

Felipe

Former Member
0 Kudos

Hi Filepe,

Thanks for the ongoing help. I have actually just discovered that the code in the event is running, it just doesn't like being stepped through with the VS.NET debugger. I can step through the code in the debugger if it is not handled within a SBO event - which is fine because I can step through and test it, and then put it in the event when I am happy with the result.

Cheers,

Daniel