How to programatically querying from a custom scope

Hi All
I am using below code in a visual wp to implement search functionality.
SearchServiceApplicationProxy proxy
= (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy(SPServiceContext.GetContext(SPContext.Current.Site));
KeywordQuery query
= new KeywordQuery(proxy);
query.ResultsProvider = Microsoft.Office.Server.Search.Query.SearchProvider.Default;
query.QueryText = queryText;
query.RowLimit = 100;
Above code is showing data from default scope ie 'All Sites' but I want show data from custom scope 'MyCustomScope'. Is it possible to provide scope name in code
Please help

Hi Pramod,
You can define your scope in  HiddenConstraints property of KeywordQuery class.
keywordQuery.HiddenConstraints = "scope:\"XYZ\"";
In your case
query.HiddenConstratints = "scope:\"MyCustomScope\"";
Also you can refer below link for more information,
http://www.mstechblogs.com/paul/sharepoint-2010-keywordquery-and-the-hiddenconstraints-property
Regards,
Uday G

Similar Messages

  • How to dynamically query from an LOV CO?

    Hi,
    I have a page and AM
    I also have an LOVVO linked to LOVAM.
    The LOV Vo is query based and contains a whereclause like user_id = :1
    I have created a LovRN and LovCO based on the RN
    I want to filter LOV values based on logged in user ID during PR
    How to dynamicaly invoke the execute query from Lov CO PR() ?
    I have written a method in LOV AM and when I try to invoke it from Lov CO, i get an error 'Method does not exist'. Should I write the method in Room AM?
    In case I write the method in Root AM (linked to OA pages), how can I access the LOV VO as it is assigned to LOv AM only.
    Thanks,
    Kamath

    Hi
    write this code in CO
    OAApplicationModuleImpl am =
    (OAApplicationModuleImpl) pageContext.getApplicationModule(webBean);
    System.out.println("Inside CO");
    am.invokeMethod("initEmpVO");
    write this code in AM
    public void initEmpVO()
    VacancyVOImpl vo = getVacancyVO();
    System.out.println("Inside initEmpVO");
    if(vo == null)
    MessageToken errTokens[] = {
    new MessageToken("OBJECT_NAME", "VacancyVO")
    throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
    } else
    vo.executeQuery();
    System.out.println("Execute Query");
    Thanks
    Nilesh

  • How to unassign query from a role

    Hi All,
    I have wrongly published a query in a role through query designer 2 times. Can you pls suggest how to unassign the query from that role, Your quick response will be appreciated.
    Thanks in advance,
    Sananda

    Use Tcode PFCG and there you can delete th query from the role. Then the query gets deleted only from that role view. Then you can assign it to the new role.

  • How to get query from a record group

    HI
    do we get the query from which record groupis based on in oracle forms with out checking in to the properties.

    Hello,
    No, you cannot get the initial SELECT order from the Record Group.
    Francois

  • How I create query from infoset ???

    Case 1 : I cannot create query from infoset
    Case 2 : I cannot create query from multiprovider that is created from infoset
    When I create multiprovider from infoset , I open query designer from this multiprovider... I received error message from query designer as below...
    File name : bextrace_qd_25510925_0556.txt
    Application error:
    17:56:02.171: Info: Query Designer Start. Revision: 601
    QueryDesigner.UserSettings.LoadSettings: Could not find file 'BExQueryDesigner.xml'.
    17:56:11.15: DEBUG ASSERT ### False - QDbCommandManager::.ctor - Method not called from CommandManager
    -CALLING-FROM- 17:56:11.15: DEBUG ASSERT ### False - QDbCommandManager::.ctor - Method not called from CommandManager ---
       at com.sap.bi.et.common.appl.Log.Debug.WriteTraceToFile(Level lLevel, String lString, Exception ex)
       at com.sap.bi.et.common.appl.Log.Debug.Assert(Boolean iExpectedCondition, String iAdditionalInformation, String iDetailedMessage)
       at com.sap.bi.et.QueryDesigner.QDfForm.InitFromCommandManager(QDbCommandManager iCommandManager)
       at com.sap.bi.et.QueryDesigner.QDbCommandManager..ctor(QDbApplicationData iApplicationData, QDfForm iWindow)
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.Init()
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.Run(Boolean iAsApplication)
       at com.sap.bi.et.QueryDesigner.QDbQueryDesigner.Run(Boolean iAsApplication)
       at com.sap.bi.et.QueryDesigner.QDStarter.QDStartup.Main()
    QDbApplicationData::ApplyUserSettings  - Standard View
    QDbCommandManager::DoViewCommand  - Table View
    QDbCommandManager::DoViewCommand  - Rows/Columns
    QDbCommandManager::DoViewCommand  - Cells
    QDbCommandManager::DoViewCommand  - Conditions
    QDbCommandManager::DoViewCommand  - Exceptions
    QDbCommandManager::DoViewCommand  - InfoProvider
    QDbCommandManager::DoViewCommand  - Filter
    QDbCommandManager::DoViewCommand  - Documents
    QDbCommandManager::DoViewCommand  - Where-Used List
    QDbCommandManager::CommandExecute  - Properties
    QDbCommandManager::DoViewCommand  - Properties
    QDbCommandManager::DoViewCommand  - Messages
    QDdEventDispatcher::MenuItemClickedHandler - Bar clicked: NewQuery
    QDbCommandManager::CommandExecute  - New...
    QDdEventDispatcher::MenuItemClickedHandler - Bar clicked: OpenQuery
    QDbCommandManager::CommandExecute  - Open...
    -EXCEPTION-START- 18:03:12.671: TRACE EXCEPTION  ---
    Exception Name: NullReferenceException
    Exception Message: Object reference not set to an instance of an object.
    Exception    at com.sap.bi.et.QueryDesigner.QDmCharacteristic.LoadValues()
       at com.sap.bi.et.QueryDesigner.QDbCharacteristic.GetValues(Boolean iReload)
       at com.sap.bi.et.QueryDesigner.QDmMetaBase.GetValues(Boolean iReload)
       at com.sap.bi.et.QueryDesigner.QDmCharacteristic.get_ValuesNonTechnical(QDeInfoObjectFilter iFilter)
       at com.sap.bi.et.QueryDesigner.QDpCharacteristicReference.ValueInitial()
       at com.sap.bi.et.QueryDesigner.QDpCharacteristicReference.set_pValue(Object value)
       at com.sap.bi.et.QueryDesigner.QDpString.set_Value(String Value)
       at com.sap.bi.et.QueryDesigner.QDbVariable.FromTable(RSZ_X_VAR isVar, QDcElement iElements)
       at com.sap.bi.et.QueryDesigner.QDbElement.FromTables(Hashtable iTables, QDcElement iElements)
       at com.sap.bi.et.QueryDesigner.QDbElement.CreateElements(Hashtable iTables, QDcElement iElements)
       at com.sap.bi.et.QueryDesigner.QDbElement.Load(QDeElementType iElementType, String iName, String iCompUid, String iGenUniId)
       at com.sap.bi.et.QueryDesigner.QDbQuery.Load(String iName, String iCompUid, String iGenUniId)
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.LoadQuery()
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.LoadFromServer()
       at com.sap.bi.et.QueryDesigner.QDbCommandOpenQuery.ExecuteCommand()
       at com.sap.bi.et.QueryDesigner.QDbCommandBase.Execute()
       at com.sap.bi.et.QueryDesigner.QDbCommandManager.CommandExecute(QDbCommandBase iCommand)
       at com.sap.bi.et.QueryDesigner.QDbCommandManager.InitialCommandExecute(QDbCommandBase iCommand)
       at com.sap.bi.et.QueryDesigner.QDbCommandManager.DoExecuteCommandInternal()
       at com.sap.bi.et.QueryDesigner.QDbCommandManager.ItemClickedHandler(Object sender, BarItemClickedEventArgs args)
       at com.sap.bi.et.QueryDesigner.QDdEventDispatcher.MenuItemClickedHandler(Object iSender, BarItemClickedEventArgs iE)
       at Syncfusion.Windows.Forms.Tools.XPMenus.BarManager.OnItemClicked(BarItemClickedEventArgs args)
       at Syncfusion.Windows.Forms.Tools.XPMenus.BarItem.OnItemClicked(EventArgs args)
       at com.sap.bi.et.QueryDesigner.QDiBarItem.OnItemClicked(EventArgs args)
       at Syncfusion.Windows.Forms.Tools.XPMenus.BarItem.PerformClick()
       at Syncfusion.Windows.Forms.Tools.XPMenus.BarRenderer.OnMouseUp(MouseEventArgs e)
       at Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.OnMouseUp(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at Syncfusion.Windows.Forms.Tools.XPMenus.BarControlInternal.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    Full Stack:   at com.sap.bi.et.common.appl.Log.Debug.WriteTraceToFile(Level lLevel, String lString, Exception ex)
       at com.sap.bi.et.common.appl.Log.Trace.Exception(Exception ex, String iAdditionalInformation)
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.OnGuiUnhandledException(Object iSender, ThreadExceptionEventArgs iEventArgs)
       at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
       at System.Windows.Forms.Control.WndProcException(Exception e)
       at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.Run(Boolean iAsApplication)
       at com.sap.bi.et.QueryDesigner.QDbQueryDesigner.Run(Boolean iAsApplication)
       at com.sap.bi.et.QueryDesigner.QDStarter.QDStartup.Main()
    -EXCEPTION-END----
    -CALLING-FROM- 18:03:12.671: TRACE EXCEPTION  ---
       at com.sap.bi.et.common.appl.Log.Debug.WriteTraceToFile(Level lLevel, String lString, Exception ex)
       at com.sap.bi.et.common.appl.Log.Trace.Exception(Exception ex, String iAdditionalInformation)
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.OnGuiUnhandledException(Object iSender, ThreadExceptionEventArgs iEventArgs)
       at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
       at System.Windows.Forms.Control.WndProcException(Exception e)
       at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at com.sap.bi.et.QueryDesigner.QDbApplicationData.Run(Boolean iAsApplication)
       at com.sap.bi.et.QueryDesigner.QDbQueryDesigner.Run(Boolean iAsApplication)
       at com.sap.bi.et.QueryDesigner.QDStarter.QDStartup.Main()
    Please kindly help me !!

    Hi,
    check the links to create  Infosets
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d6419190-0201-0010-0cb0-d7e4503c1231
    http://help.sap.com/saphelp_nw04s/helpdata/EN/ab/7a877cba29144b85d07f26f1f50cd8/content.htm
    Thanks.

  • How to call function from a custom module in a grid?

    I have a module with an advanced data grid in it. One of the columns of this grid has an itemRenderer="myCustom"
    MyCustom is a separate MXML Module. In this module, I have defined a vBox with 2 buttons. In the click event of the button how can I call a custom function that is defined in the parent module? click="myCustomFuction()" doesn't work and I get an 1180 warning . I'm thinking something like click="this.parent.myCustomFunction()" but I don't know the proper syntax.

    I tried your suggestion, but it's not working. Can you figure out what I'm doing wrong?
    <mx:Button name="bLotView" label="View" click="Object(this.owner).MyCustomFunction()"
    This button is contained in a VBox which is contained in it's own module: MyVBox
    In the "parent" MyGrid module I have an AdvancedDataGrid and one of the columns of this grid uses ItemRender="MyVBox"
    If I place a button in the parent MyGrid module (not in the grid), and set it's click to MyCustomFunction() then the function fires. But the function never fires from the MyVBox module's button click which is contained in the grid.
    Does Object(this.owner) refer to the owning module or the owning control? If it refers to the owning control, wouldn't this point to the VBox in the same module, not the owning module? Would I have to do something like Object(this.owner.owner.owner).MyCustomFunction()  ??

  • How to get DBconnection from a custom servlet

    Hi all:
    In my JHeadstart Struts application, if we will using javascript to call a custom servlet program when some html event occur,
    than how can we get db connection in our Servlet because we need get some database data through this Servlet,
    we hope this Servlet can share dbconnection pool with JHeadstart that is consider for performance issue.
    thanks a lot !

    Ting Rung,
    JHeadstart is based on the Model-View-Controller (MVC) principle. This means that the Model layer is responsible for communication with the database (and thus database connection pooling). Accessing the database directly from a JSP or Servlet is against the principles of MVC. JHeadstart uses BC4J as the technology to implement the model layer. By going through an BC4J Application Module to do some database action (for example calling a stored procedure as you mentioned in another thread) you automatically get the database connection pooling.
    So, in the JHeadstart philosophy, we do not access the database from a servlet, instead we would do the following:
    - write a method on the BC4J app module that performs the database action
    - add a method to the apporpriate handler that calls this AM method
    - write a custom Struts action that calls the handler method
    Having said this, nobody will stop you from doing database access in a servlet. But JHeadstart might not be the right choice for you if you do not want to stick with the principles of MVC.
    Here is a link that provides you with some more background information about MVC, may be it can help you deciding what the best approach for your application is:
    http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier5.html
    You can also "google" on model-view-controller if you like.
    Steven Davelaar,
    JHeadstart Team.

  • How to Call BAPI From the Custom Controller

    Hi
    I developed frist WD Application Using RFC Adapter.
    i did the following steps
    1. created the project
    2. created the model.
    3. created the customer controller and mapped the model of the controller to the model.
    4. mapped controller context to the views
    5. created one action in the start view
    6. created one method in the customer controller.
    so please let me know the lines of code to call BAPI using RFC.
    and  how to pass input valus to the bapi and how to execute the BAPI
    plese send the reply ASAP
    regards
    mmukesh

    Hi
    i did like this
    In  Start View OnActionSearch () method code
    public void onActionsearch (com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
           wdThis.wdGetTestCustControllerController().executeGetlistBapi();
    in CustomController Init method
    public void wdDoInit()
        Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();
        wdContext.nodeBapi_FlightGetlist_Input().bind(input);
        input.setDestination_From(new Bapisfldst());
        input.setDestination_To(new Bapisfldst());
    In CUSTOMECONTROLLER executeGetlistBapi();
    METHOD
    public void executeGetlistBapi( )
        //@@begin executeGetlistBapi()
        try{
           wdContext.currentBapi_FlightGetlist_InputElement().modelObject().execute();
           wdContext.nodeOutput().invalidate();
        }catch(Exception ex){
           ex.printStackTrace();
    Then let me know what is wrong in this
    i did as per pdf
    please correct if there is any worng in this code.
    this is flight example .
    regards
    mmukesh

  • How to copy query from one cube to another ? OR atlest a KF strecture?

    Hello edperts,
    just wanted some tips on coping a query or KF strecture from one cube to other . i am trying to use TCODE RSZC, but bcoz some of the chars. are not present in the target cube i a m not able to copy it.
    But, looks like both the cube has save KFs, so i thought atlest let me copy KFS , so i just have to pull manually chars. but thats also not working..
    Is there any back door way to do it ? please help me, it might save lots of time.
    Appreciated.

    Hi,
    Check the below article, it might help you out.
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/204111a9-0fca-2d10-219c-be20e686cdb5?QuickLink=index&overridelayout=true]
    Regards,
    Durgesh.

  • How to get Query from bw?

    I use BI XMLA Connector to connect BW System,I want to get QUERY.But I only get the DATA.I want to get the Query completely,
    include style,navigation,and so on.not a table.
    WHAT CAN I DO?

    HI,
    It is seemed rather odd that WEBI does not use the MASTER DATA search that is defined in the BEX query, the UNV based on.
    We are talking about objects that have less than 200 values in the MASTER DATA, usually it is an Authorization Object, that the User needs to select from it during runtime.
    We can also change the maximum value listed from MASTER DATA to be higher than 200.
    This is very poor performance to get the LOV after several minutes instead of few seconds.
    >> first of all the BI authorization you configure are not relevant for master data unless you are using authorization variables and BEx does a paging of the values - it does not retrieve all values. it does retrieve the values in chunks
    Using delegating search is not always possible when the user needs to select random values.
    Although delegate search improved getting the LOV from 5 minutes to 2 minutes (in our case), still waiting for 2 minutes,
    just to get the LOV is very long time for an enduser. (and now he has to wait for the WEBI query to be executed).
    >> using delegated search is possible. and delegated search means you are not retrieving a list of values at all so the 2 min that you mentioned indicates you didn't configure it properly.
    Ingo

  • How to transport Query from one client to another

    There is a following query in XXX-010:
    Queries of user group: UTILITY
    Name: YWH_2
    Is it possible to transport the same to XXX-020?
    Could you please check and inform ASAP?
    Regards,
    M.R.Reddy

    Hi M.R.Reddy,
    please enter transaction SQ02, then at the menu Environment > Transports. This allows you to export/import infosets and/or queries and/or user groups between your systems. You can also do this "transport" just by downloading in your source system/client and uploading into the target one.
    I hope it helps. Best regards,
    Alvaro

  • Execute a Query from a report sending it parameters and capture the result

    Hello everybody,
    Greetings from Peru, I want your help, Do you know how to execute a query from a report sending parameteres and capture the result in a internal table?
    The attached imaged has in red square the parameteres I want to send from a report.
    The idea is to have a JOB that executes everyday and parameters like DATE PERIOD will change automatically.
    Thanks for your time.

    Hi Enrique,
    You can call a query from a report by using submit statement.
    Every query has a corresponding program associated with it.
    Execute the query from SQ01. On te selection screen of query, goto SYSTEM  from menu and then click on STATUS, you will get program name (In this case aqzzzent_struct=zmm_ent_struc1). Use this program to call the query from your custom program.
    Also populate the rspar int table as per the selection criteria you want to pass to query.
       DATA: rspar     TYPE TABLE OF rsparams,
        wa_rspar  LIKE LINE OF rspar.
          wa_rspar-selname = 'SP$00001'.
          wa_rspar-kind = 'S'.
          wa_rspar-sign = 'I'.
          wa_rspar-option = 'BT'.
          wa_rspar-low  = s_cmp_cd-low.
          wa_rspar-high = s_cmp_cd-high.
          APPEND wa_rspar TO rspar.
       SUBMIT aqzzzent_struct=zmm_ent_struc1 WITH SELECTION-TABLE rspar AND RETURN.
    Thanks,
    Sachin

  • Question from a customer: If I download it to my MacBook Air can I share it to my MacBook Pro and or vis a vis?

    I had the following query from a customer, and I don't know the answer. Any help would be much appreciated.
    Regarding the Adobe Photoshop Lightroom 5 Software Download card:
    If I download it to my MacBook Air can I share it to my MacBook Pro and or vis a vis?
    Thank you in advance.

    A Lightroom license can be activated on any two installs regardless of platform but the use of only one at at time is permitted.

  • How to set a bind variable into a vo query from the current vo ?

    I would like to exclude from my list of values defined in a view object the already referenced items in the current view object content.
    Let's say i have dept and emp with a many to many relationships, I would like that the already existing dept for emp not listed (excluded) in the list of values for emp.
    Do i need to define a bind parameters and set it during search or is it possible to use an expression that will refer the current row attribute representing the dept ?
    I didn't find an example or explanation how to set bind parameters defined in a view object query from seach pages or list of values ui components. May be somebody know how to find the info.
    Thank you

    I think that bind variable accessors in the VO class is what you need. You can override the getter method of the bind variable "LocaleCode2" in order to return the first 2 chars from the bind variable "LocaleCode". Have a look at this blog post for details:
    http://jdeveloperandadf.blogspot.com/2011/03/custom-java-bind-variable-in-where.html
    Dimitar

  • How to Create EXTRACTOR from R3 QUERY

    Hi,
    I'd like to create an extractor from a custom ABAP R3 Query that must be executed with a variant.
    The standard extractor from a query doesn't allow to execute the query with a variant.
    The query variant drives some calculations and it's important for the correct display of the query result.
    How can i do?
    Thanks in advance.

    Hi,
    the result of the query depends on the input fields we set in the variant. So we need to extract the query information on R3.
    We tried also to submit the program related to the queries with return esporting the result to the memory  and  then, using the FMS LIST TO MEMORY and LIST TO ASCII in order to put the result into an internal table, but it doesn't work beacuse the query uses a logical database. Any IDEA?
    The code below works for an easy query (join from table) but not on a query that uses a logical database :
    DATA asci_tab TYPE text180 OCCURS 0.
    DATA mem_tab TYPE abaplist OCCURS 0.
    START-OF-SELECTION.
      SUBMIT AQZZFI==========ZTEST_AF=====
                            USING SELECTION-SET 'ZTEST_AF'
                            EXPORTING LIST TO MEMORY
                            AND RETURN.
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = mem_tab
        EXCEPTIONS
          not_found  = 1.
      IF sy-subrc = 0.
        CALL FUNCTION 'LIST_TO_ASCI'
         EXPORTING
           list_index               = -1
         TABLES
           listasci                 = asci_tab
           listobject               = mem_tab
         EXCEPTIONS
           empty_list               = 1
           list_index_invalid       = 2
           OTHERS                   = 3   .
      ENDIF.
      CALL FUNCTION 'LIST_FREE_MEMORY'.

Maybe you are looking for