Retrieving list items from a specific view using CSOM

How can I query a specific view of a SharePoint List using the C# CSOM? I am dealing with SharePoint Online, so the only option is to use SharePoint.Client.
I have done this using Javascript, and I know how to do this with SharePoint On-Premises, but I haven't found a way to do with for SharePoint online using C#.

hi Dkhouri,
thanks for posting your issue, you can create a specific view of a list using CSOM and C#.
Kindly find the code snippet below fort he same.
Code for CSOM :- 
// Starting with ClientContext, the constructor requires a URL to the
// server running SharePoint.
ClientContext context = new ClientContext("http:SiteUrl");
// Assume the web has a list named "Announcements".
List announcementsList = context.Web.Lists.GetByTitle("Announcements");
// This creates a CamlQuery that has a RowLimit of 100, and also specifies Scope="RecursiveAll"
// so that it grabs all list items, regardless of the folder they are in.
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection items = announcementsList.GetItems(query);
// Retrieve all items in the ListItemCollection from List.GetItems(Query).
context.Load(items);
context.ExecuteQuery();
foreach (ListItem listItem in items)
// We have all the list item data. For example, Title.
label1.Text = label1.Text + ", " + listItem["Title"];
For C# 
public CamlQuery CreateInventoryQuery(string searchSku)
var qry = new CamlQuery();
qry.ViewXml =
@"<View>
<Query>
<Where>
<BeginsWith>
<FieldRef Name='SKU' />
<Value Type='Text'>" + searchSku + @"</Value>
</BeginsWith>
</Where>
</Query>
</View>";
return qry;
Also, checkout below mentioned URLs for more details
http://www.c-sharpcorner.com/UploadFile/sagarp/sharepoint-2013-caml-query-for-item-id-with-jquery/
http://msdn.microsoft.com/en-us/library/ff798388.aspx
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh

Similar Messages

  • Retrieve list items from the textbox text value and display the dropdownlist item for that particular list item

    hi,
     I have created a custom list in my sharepoint :
    List1 name:   employeedepartment  -
                   Title       empdepartment
                   A             D1
                   B             D2
                   C             D3 
    List2  name:  employeedetails  
     emptitle            empname       empdepartment(lookup) --> from the list "employeedepartment"
       x                     Ram                 D1
       y                     Robert             D2
       z                     Rahim              D3
    My task is to create a custom webpart that will be for searching this employee details by entering emptitle
    For this, i have created a visual webpart using visual studio 2010, my webpart will be like this:
    emptitle  --->  TextBox1                        Button1--> Text property : Search
    empname---> TextBox2
    empdepartment-->  DropDownList1
    For this, i wrote the code as follows:
    protected void Button1_Click(object sender, EventArgs e)
                using (SPSite mysite = new SPSite(SPContext.Current.Site.Url))
                    using (SPWeb myweb = mysite.OpenWeb())
                        SPList mylist = myweb.Lists["employeedetails"];
                        SPQuery query = new SPQuery();
                        query.Query = "<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>" + TextBox1.Text.ToString() + "</Value></Eq></Where>";
                        SPListItemCollection myitems = mylist.GetItems(query);
                        if (myitems.Count > 0)
                            foreach (SPListItem item in myitems)
                                string a1 = Convert.ToString(item["empname"]);
                                string a2 = Convert.ToString(item["empdepartment"]);
                                TextBox2.Text = a1;           // displaying   properly                    
                                //DropDownList3.SelectedIndex = 1;                           
     It is showing the list item in textbox according to the item entered in the textbox1... But I am stuck to show in the dropdown list. 
    Suppose, if i enter X in textbox and click on search, then dropdownlist need to show D1,
                               for Y --> D2 and for Z-> D3... like that.
    What code do i need to write in the button_click to show this... 
    Please don't give any links...i just want code in continuation to my code.

    Hi,
    Since you have got the data you want with the help of SharePoint Object Model, then you can focus on how to populate values and set an option selected in the Drop Down List.
    With the retrieved data, you can populate them into the Drop Down List firstly, then set a specific option selected.
    Here is a link will show how to populate DropDownList control:
    http://www.dotnetfunda.com/articles/show/30/several-ways-to-populate-dropdownlist-controls
    Another link about select an item in DropDownList:
    http://techbrij.com/select-item-aspdotnet-dropdownlist-programmatically
    Best regards
    Patrick Liang
    TechNet Community Support

  • Retrieve List Items based on condition in Where Clause

    Hello Experts,
     I am trying to retrieve list items from a list (CityList)  which contains 2 columns one is city(string) and State(Lookup) based on Lookup value, but i am getting all city names.
    here is my query below.
    function MainFunction() {
            var lookupid = 5;
            var myQueryString = "<Where><Eq><FieldRef Name='State' LookupId='true' /><Value Type='Lookup'>"+lookupid+"</Value></Eq></Where>";
            var myContext = new SP.ClientContext.get_current(); ;
            var myWeb = myContext.get_web();
            var myList = myWeb.get_lists().getByTitle("CityList");
            var myQuery = new SP.CamlQuery();
            myQuery.set_viewXml(myQueryString);    
            myItems = myList.getItems(myQuery);
            myContext.load(myItems, 'Include(Title)'); 
            myContext.executeQueryAsync(Function.createDelegate(this, GetListDataSuccess), Function.createDelegate(
    this, GetListDataFail));
        function GetListDataFail(sender, args) {
            // Show error message
            alert('GetListDataFail() failed:' + args.get_message());
        function GetListDataSuccess(sender, args) {
            var currListItemCount = myItems.get_count();       
            var currItemEnumerator = myItems.getEnumerator();
            var currItemDetails = '';       
            while (currItemEnumerator.moveNext()) {          
                var currItem = currItemEnumerator.get_current();          
                 currItemDetails = currItemDetails + ';' + currItem.get_item("Title");
            // Show details 
            alert(currItemDetails); 
    Please suggest where i am wrong. 
    Thank you
    saroj

    You need to enclose the <Where> tag inside <View><Query> . Try like below
    var myQueryString = "<View><Query><Where><Eq><FieldRef Name='State' LookupId='TRUE' />
    <Value Type='Lookup'>"+lookupid+"</Value></Eq></Where></Query></View>";
    Geetanjali Arora | My blogs |

  • How to copy List item from one list to another using SPD workflow using HTTP call web service

    Hi,
    How to copy List item from one list to another using SPD workflow using HTTP call web service.
    Both the Lists are in different Web applications.
    Regards, Shreyas R S

    Hi Shreyas,
    From your post, it seems that you are using SharePoint 2013 workflow platform in SPD.
    If that is the case, we can use Call HTTP web service action to get the item data, but we cannot use Call HTTP web service to create a new item in the list in another web application with these data.
    As my test, we would get Unauthorized error when using Call HTTP web service action to create a new item in a list in another web application.
    So I recommend to achieve this goal programmatically.
    More references:
    https://msdn.microsoft.com/en-us/library/office/jj164022.aspx
    https://msdn.microsoft.com/en-us/library/office/dn292552.aspx?f=255&MSPPError=-2147217396
    Thanks,
    Victoria
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View

    Todd,
    Let me try to explain you this time. I have a text field in a TiledViewBean.
    When I display the page, the text field
    html tag is created with the name="PageDetail.rDetail[0].tbFieldName" say
    five times/rows with same name.
    The html tags look like this.
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    When the form is submitted, I want to get the text field values using the
    method getTbFieldName().getValues() which
    returns an array object[]. This is in case where my TiledViewBean is not
    bound and it is working fine.
    Now in case when my TiledView is bound to a model, it creates the html tags
    as follows.
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[1].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[2].tbFieldName" value=""
    maxlength=9 size=13>
    Now when I say getTbFieldName().getValues() it returns only the first
    element values in the object[] and the rest of the
    values are null.
    May be we need to create a utility method do get these values from
    requestContext.
    raju.
    ----- Original Message -----
    From: Todd Fast <toddwork@c...>
    Sent: Saturday, July 07, 2001 3:52 AM
    Subject: Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
    Raju.--
    I wanted to know how the getValues() method works the reason being,
    when the tiled view is NOT bound to a model, it populates all the
    fields with the same name as some thing likeI'm afraid I don't understand your point--can you please clarify? Do you
    mean "value" instead of "name"?
    What are you trying to do? What behavior are you expecting but notseeing?
    >
    Without further clarification, I can say that the setValues() methodsNEVER
    populates data on multiple rows of a (dataset) model, nor does it affect
    multiple fields on the same row. Perhaps what you are seeing is theeffect
    of default values. Model that derive from DefaulModel have the ability to
    carry forward the values set on the first row to other rows in lieu ofdata
    in those other rows. This behavior is for pure convenience and can be
    turned off, and it is turned off for the SQL-based models.
    Todd
    [email protected]

    Hi,
    I wanted to know how the getValues() method works the reason being,
    when the tiled view is NOT bound to a model, it populates all the
    fields with the same name as some thing like
    PageDetail.rDetail[0].tbFieldValue
    PageDetail.rDetail[0].tbFieldValue
    in which case, the getValues() method works fine.
    But in case where the tiled view is bound to a model, it populates
    with different field names such as,
    PageDetail.rDetail[0].tbFieldValue
    PageDetail.rDetail[1].tbFieldValue
    in this case, the getValues() doesn't work. Any soultion to this?
    We are using Moko 1.1.1.
    thanks in advance,
    raju.
    --- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
    Does anyone know of is there a single method to get all values of a
    display
    field in a tiled view without having to iterate through all the
    values ie
    resetTileIndex() / nextTile() approach.
    ie Something that returns an Object[] or Vector just like ND returned a
    CspVector. I tried using the getValues() methods but that allways returns
    a
    single element array containing the first element.
    (I think now, that method is used for multi selecteable ListBoxes)Actually, no. We can add this in the next patch, but for now, I'd recommend
    creating a simple utility method to do the iteration on an arbitrary model
    and build the list for you.
    Todd

  • SharePoint Designer 2013 (2010 Platform Workflow) - How can I create a new list item with a SPECIFIC content type?

    In SharePoint 2010 I created workflows that used the 'Create list Item' Action, which then set the Content Type ID (so I could create documents of various types in a document library). 
    We just switched to the SharePoint 2013 platform, and now the drop down for Content Type ID is blank in all of the workflows that are still using the SharePoint 2010 platform.  Is there any way to create a list item with specific content
    type?  Even if I could just input a string into that field instead of using this blank drop-down.  Please help! 

    Hi Sarah,
    According to your description, my understanding is that you cannot create a new list item with a specific content type using SharePoint 2010 Platform Workflow.
    I tested the same scenario in my environment, and the Create List Item worked fine with the specific content type.
    How did you create the content type?
    Please check if the content type is added to the list/library the workflow associated with.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Is it possible to retrieve deleted items from the Pages App please?

    IIs it possible to retrieve deleted items from the Pages App? Thanks

    From within the Pages app, no. If you have an iTunes or iCloud backup that would have contained the file, and you are backing up Pages, it could be received via a restore using that backup (this would wipe out any newer data however).

  • How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM.

    How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM. I found that it can be
    done by using XsltListViewWebPart class but how can I use this one by using shraepoint client api.
    shiv

    Nice, can you point me to the solution please ?
    I'm  trying to do this but I get an error : 
    Web Part Error: Cannot complete this action. Please try again. Correlation ID: blablabla
    StackTrace:    at Microsoft.SharePoint.SPViewCollection.EnsureViewSchema(Boolean fullBlownSchema, Boolean bNeedInitallViews)     at Microsoft.SharePoint.SPList.GetView(Guid viewGuid)   
    All help really appreciated.

  • List items archival with version history using powershell

    HI
    Is there any way to work with site and content structure in SharePoint 2010 with power-shell.
    I want to run a automated task(power shell script) to move list items from source to destination in the same site with version history.
    I know i can do it from site and content organizer but i have to do manually and SharePoint designer workflows doesn't retain the version history.
    Please give me  your valuable tips.

    Hi Manikanta,
    Archive ListItem with Version History in SharePoint, I suggesting you the best links for your solution here
    http://techno-sharepoint.blogspot.sg/2012/10/moving-sharepoint-list-items-to-archive.html
    http://get-spscripts.com/2011/10/copy-sharepoint-lists-and-document.html
    For more details, reach us at
    <a href="http://staygreenacademy.com/sharepoint-2013-training/">SharePoint 2013 Online Training</a>

  • Populating List Item From View

    I have two data blocks in my form, one named USERS which contains updateable fields to a table from the view and another data block called CONTROL which are all list items that currently populate on a WHEN-MOUSE-CLICK trigger. The list items work as expected for the WHEN-MOUSE-CLICK trigger. However, my problem is trying to populate the list items based on a selection previously chosen and saved to the table (yes, the values are in the table and are selectable through the view). I have a seperate population for this occurrance in the WHEN-NEW-FORM-INSTANCE at the form level, as well as on KEY-SCRUP, KEY-SCRDOWN, WHEN-NEW-RECORD-INSTANCE, and POST-QUERY at the USERS data block level. The only way the list items populate on a previously chosen and saved value is if you choose (WHEN-MOUSE-CLICK trigger) the list of values and save. From then on, as I scroll through the data retrieved in the USERS data block the corresponding data in the users view shows up in the CONTROL block list items. How do I get my form to initially show the corresponding list item data on form load when it is already in a WHEN-NEW-FORM-INSTANCE and POST-QUERY trigger on form load?
    Thanks in advance for any clue to point me in the right direction.
    Kyle
    Edited by: Kyle Miller on Sep 29, 2008 3:09 PM

    The form is for editing a current student information system user who we will be extracting data for an OBIEE IDM import. All of the fields displayed in the OBIEE_USERS data block can be edited. For the CONTROL block list items I would like them to display the current value chosen for the user displayed in the OBIEE_USERS data block. When the CONTROL block list items are clicked on then a list of values are displayed in which the logged in form user can chose another value which ultimately changes the choice for the user displayed in the OBIEE_USERS data block. This all works fine in my current form except the list items do not display the current user selected in the OBIEE_USERS data block's saved value until the list item is selected, a value chosen, and a save is committed to the table tied to the OBIEE_USERS data block. From that point I can scroll through the OBIEE_USERS block and the list item displays the correct value for the selected user, if there are values (some users have NULL values). I have currently worked around this issue by displaying the fields in the OBIEE_USERS block and only use the list items for the changing selection. I did this because I needed a proof of concept for the pilot roll-out and could no longer wait to figure this issue out (it should be more simple it seems). I am still interested in resolving this as I feel it is a great functionality for the form.

  • Sum child list items and update parent total using javascript

    I have a SharePoint 2010 Parent/Child list setup using a lookup field to join both the lists, this is working well.
    The Parent list contains requisition requests and the child list contains related item details. Each of the related child list items has a 'Line Item Total' field. I need to aggregate the Line Item Totals in the child list and place the result in a 'Requisition
    Total' in the parent. So for any given parent record the sum of it's related child 'Line Item Totals' is reflected in the 'Requisition' total in the parent row.
    I am struggling with the JavaScript code below. I am trying to aggregate Line Item Totals for a given Requisition#? Could someone please review and advise?
    <script language="javascript" src="/Purchasing/Documents/jquery-1.8.2.js" type="text/javascript"></script>
    <script language="javascript" src="/Purchasing/Documents/jquery.SPServices-2014.01.min.js" type="text/javascript"></script>
    <script>
    $(document).ready(function()
     $('select[title=Requisition#]').children().attr('disabled',true);
     $("input[title='Old Amount']").attr("readonly","true").css('background-color','#F6F6F6');
       // Retrieve the name of the selected parent item.
       var strParent=$("select[title$='Requisition#'] :selected").text(); 
     splist li = web.lists["ReqDetails"]; // This is the child list
        spquery q = new spquery();
        q.Query= "<Where>" +
         "<And>" +
          "<Neq>" +
           "<FieldRef Name='ID'/><Value Type='Number'>0</Value>" +
          "</Neq>" +
          "<eq>" +
           "<FieldRef Name='LinkID'/><Value Type='Number'>ReqID</Value>" +
          "</eq>" +
         "<And>" +
        "</Where>" +
        "<OrderBy>" +
         "<FieldRef Name='LineItemTotal'/>" +
        "</OrderBy>"
        q.ViewFields = string.Concat("<FieldRef Name='LineItemTotal' />");
        q.ViewFieldsOnly = true; // Fetch only the data that we need
        splistitemcollection items = li.getitems(q);
        foreach(SPListItem item in items)
        sum += parseInt(item["LineItemTotal"], 10);
      alert(sum)
     </script>
    Rick Rofe

    I do something similar for a PO Header/PO Detail set of lists. I use SPServices to pull the data.
    I put this code in the child edit page - so any time any child is edited, the parent is updated. I get all children records and total them up (except for the item I'm displaying at the current time. I add that value in directly from the form itself.
    <script type="text/javascript" src="/Javascript/JQuery/JQueryMin-1.11.1.js"></script>
    <script src="/Javascript/JQuery/jquery.SPServices-2014.01.min.js"></script>
    <script>var poNumber = '';
    var poDetailID = '';
    $(document).ready(function() { var queryStringVals = $().SPServices.SPGetQueryString();
    poNumber = queryStringVals["PO"];
    poDetailID = queryStringVals["ID"];
    function PreSaveAction() {
    // update the PO header with the total of all items + shipping + adjustments
    var query = "<Query><Where><And><Eq><FieldRef Name='Title' /><Value Type='Text'>" + poNumber + "</Value></Eq><Neq><FieldRef Name='ID' /><Value Type='Counter'>" + poDetailID + "</Value></Neq></And></Where></Query>";
    var viewFields = '<ViewFields><FieldRef Name="Total" />';
    viewFields += '</ViewFields>';
    var poTotal = 0.00;
    $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "PO Details",
    webURL: "/po",
    CAMLViewFields: viewFields,
    CAMLQuery: query,
    completefunc: function (xData, Status) {
    //alert(xData.responseText);
    $(xData.responseXML).SPFilterNode('z:row').each(function() {
    if($(this).attr("ows_Total")) {
    //alert($(this).attr("ows_Total"));
    poTotal += Number(parseFloat($(this).attr("ows_Total").split(";#")[1],2).toFixed(2));
    // add in this changed line (we skipped it above)
    var qty = $('input[title="Quantity Ordered"]').val();
    var price = $('input[title="Price"]').val().replace(',','');
    var extend = Number(qty)*Number(price);
    poTotal += extend;
    //alert(poTotal);
    // update the PO Header
    $().SPServices({
    operation: "UpdateListItems",
    async: false,
    listName: "Purchase Orders",
    webURL: "/po",
    ID: poID,
    valuepairs: [["Total", poTotal]],
    completefunc: function (xData, Status) {
    //alert(xData.responseText);
    $(xData.responseXML).SPFilterNode('z:row').each(function() {
    return true;
    Robin

  • Hide the delete menu item from a specific document library

    I want to hide the Delete  item menu option for a specific document library.Since it is for a specific library I would not like to use customcore.js approach.Please suggest some useful javascript for same.
    I have a custom delete action associated with the menu which performs other function as well so need to hide the OOB delete option from the item  menu of a document library.
    I have already used below javascript in CEWP which I added on the document library page itself(allitems.aspx) but yeild no results:
    <script type="text/javascript">
    var elemTable=document.getElementById('ECBItems');
    if (elemTable !=null) {
         var elemTBody=elemTable.childNodes[0];
    //iterate each table row to find the correct ECB menu item to hide(remove)
       for (var iMenuItem=0; iMenuItem < elemTBody.childNodes.length; iMenuItem++) {
             var elemTR=elemTBody.childNodes[iMenuItem];
             var elemTDTitle=elemTR.childNodes[0];
             var title=GetInnerText(elemTDTitle);
     //here we filter on title, but the table contains more information if need be
            if(title =='Delete') {
                 elemTBody.removeChild(elemTR);
    </script>
    Please suggest which can be kept specific and requires no change in masterpage as same masterpage is used across the site.

    Hi justSP,
    Greetings.
    Hope the below links help you
    http://social.technet.microsoft.com/Forums/office/en-US/9adea3a2-6d08-4c04-ace2-88a704833f1d/how-to-hide-delete-item-from-ecb-menu-for-1-specific-custom-list?forum=sharepointcustomizationlegacy
    http://chakkaradeep.com/index.php/sharepoint-hiding-menu-items-from-the-edit-control-block/
    http://social.technet.microsoft.com/Forums/office/en-US/1b832635-4ae7-4f31-826c-2d6b834ece52/hide-delete-from-ecb-menu-for-a-specific-document-library-in-sharepoint-2010?forum=sharepointcustomizationprevious
    http://social.technet.microsoft.com/Forums/office/en-US/919e01e6-9a7a-4439-b778-28e0dc8bffba/how-to-hide-delete-option-from-ecb-menu-in-document-library-in-sharepoint-2010?forum=sharepointdevelopmentprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How to populate List Item from the table in a form builder

    I want to know how to populate the List Item (pop up menu and combo box) from a table.
    Supposing I have a table Customer(cust_id,cust_name)
    and now I want to populate it in such a manner that I can update the data back to the database and also access the list on the form.

    This is the method i am using to populate a list.
    1- First of all you need to create a non-database list item for customer_name.
    2-create this procedure
    PROCEDURE populate_list_with_query
    --Populates the given list item with the specified query.
    (p_list_item in VARCHAR2
    ,p_query in VARCHAR2)
    IS
    /* Name the record group after the list item (no
    block prefix). */
    cst_rg_name constant VARCHAR2(30) :=
    GET_ITEM_PROPERTY(p_list_item,item_name);
    v_rg_id RECORDGROUP;
    BEGIN
    v_rg_id := FIND_GROUP(cst_rg_name);
    IF ID_NULL(v_rg_id) THEN
    v_rg_id := CREATE_GROUP_FROM_QUERY(cst_rg_name,p_query);
    END IF;
    IF POPULATE_GROUP(v_rg_id) = 0 THEN
    POPULATE_LIST(p_list_item,v_rg_id);
    /* Force display of first list element label
    in the list item. */
    COPY(GET_LIST_ELEMENT_VALUE(p_list_item,1),p_list_item);
    END IF;
    END populate_list_with_query;
    3- Create When-Create-Record on the block level and write this code
    BEGIN
    POPULATE_LIST_WITH_QUERY('bk1.customer_name',
    'SELECT customer_name, to_char(customer_id) FROM customer');
    END;
    In this example, the customer name is the (visible) list label and the customer ID is the (actual) list value
    i hope this will solve your problem ...

  • How to retrieve the data from SAP-BAPI by using VB Code

    Hi ,
    I am new to BAPI.
    V have created an application in Visual Basic with the following fields
    EmpNo , EmpName, Addr1, Addr2, City and Phone (Only for Test)
    We have written the code for SAVING the data into SAP. Already we have
    constructed a table with the respective fields in SAP.
    For that we ourself created our own BAPI Structure / Function Group /
    Function Module/ Business Object - RELEASED related elements.
    1)Established the connection successfully.
    2)Stored the data into SAP Successfully and v r in need of
    3)HOW TO RETRIEVE THE DATA FROM SAP (USING GETLIST.....GETDETAIL....)
    Following is the code :
    'BAPI Structure  : ZBAPIEMP
    'Function Group  : ZBAPIEMP
    'Function Module : ZBAPI_EMP_CREATEFROMDATA
    'Business Object : ZBAPIEMP
    'Function Module : ZBAPI_EMP_GETLIST
    Dim bapictrl As Object
    Dim oconnection As Object
    Dim boEmp As Object
    Dim oZEmp_Header As Object
    Dim oImpStruct As Object
    Dim oExpStruct As Object
    Dim oreturn As Object
    Dim x As String
    Private Sub Form_Load()
    Set bapictrl = CreateObject("SAP.BAPI.1")
    Set oconnection = bapictrl.Connection
    oconnection.logon
    Set boEmp = bapictrl.GetSAPObject("ZBAPIEMP")
    Set oZEmp_Header = bapictrl.DimAs(boEmp, "CreateFromData", "EmployeeHeader")
    Set oImpStruct = bapictrl.DimAs(boEmp, "GetList", "EmployeeDispStruct")
    End Sub
    Private Sub cmdSave_Click()
        oZEmp_Header.Value("EMPNO") = txtEmpNo.Text
        oZEmp_Header.Value("EMPNAME") = txtEmpName.Text
        oZEmp_Header.Value("ADDR1") = txtAddr1.Text
        oZEmp_Header.Value("ADDR2") = txtAddr2.Text
        oZEmp_Header.Value("CITY") = txtCity.Text
        oZEmp_Header.Value("PHONE") = txtPhone.Text
        boEmp.CreateFromData EmployeeHeader:=oZEmp_Header, Return:=oreturn
        x = oreturn.Value("Message")
        If x = "" Then
            MsgBox "Transaction Completed!..."
        Else
            MsgBox x
        End If
    End Sub
    Private Sub cmdView_Click()
    End Sub
    COULD ANYBODY GUIDE ME, HOW TO RETRIEVE THE DATA FROM BAPI, FOR THE WRITTEN CODE.

    I didn't seen any other answers but here's how it's been done previously in our organization for a custom BAPI. In this example, we give material and language to return the part description. It's not specific to your project but may give you ideas..
    -Tim
    Option Compare Database
    Dim SAPLOGIN As Boolean
    Dim FunctionCtrl As Object
    Dim SapConnection As Object
    Sub SAPLOGOUT()
    On Error GoTo LogoutFehler
        SapConnection.logoff
        SAPLOGIN = False
    Exit Sub
    LogoutFehler:
        If Err.Number = 91 Then
            Exit Sub
        Else
            MsgBox Err.Description, vbCritical, "Fehler-Nr." & CStr(Err.Number) & " bei SAP-Logout"
        End If
    End Sub
    Function SAPLOG() As Boolean
    'Verbindungsobjekt setzen (Property von FunctionCtrl)
       Set FunctionCtrl = CreateObject("SAP.Functions")
       Set SapConnection = FunctionCtrl.Connection
    'Logon mit Initialwerten
       SapConnection.Client = "010"
       SapConnection.Language = "EN"
       SapConnection.System = "PR1"
       SapConnection.SystemNumber = "00"
       'SapConnection.Password = ""
       SapConnection.GroupName = "PR1"
       SapConnection.HostName = "168.9.25.120"
       SapConnection.MessageServer = "168.9.25.120"
         If SapConnection.Logon(0, False) <> True Then  'Logon mit Dialog
             Set SapConnection = Nothing
             DoCmd.Hourglass False
             MsgBox "No connection to SAP R/3 !"
             SAPLOGIN = False
             SAPLOG = False
             Exit Function
          End If
        SAPLOG = True
    End Function
    Function MatDescr(MatNr As String)
    Dim func1 As Object
    Dim row As Object, X As Integer, ErsteNr As String
    Dim DatensatzZähler As Long
    Dim RowField(1 To 50, 0 To 1) As String, RowLine As Long
        If Not SAPLOGIN Then
            If Not SAPLOG() Then
                MsgBox "No connection  to SAP !", 16
                SAPLOGOUT
                Exit Function
            End If
        End If
    ' Instanziieren des Function-Objektes
    Set func1 = FunctionCtrl.Add("Z_BAPI_READ_MAKT")
    ' Export-Paramter definieren
    func1.exports("MATNR") = MatNr
    func1.exports("SPRAS") = "EN"
    DoEvents
    If Not func1.call Then
        If func1.exception <> "" Then
            MsgBox "Communication Error with RFC " & func1.exception
        End If
        DoCmd.Hourglass False
        SAPLOGOUT
        Exit Function
    Else
      MatDescr = func1.imports("MAKTX")
    End If
    If MatDescr = "" Then
        MatDescr = "PART NO. NOT FOUND"
    End If
    End Function

  • How to select an item from a dropdown menu using Enter key

    A website I frequently use opens with a dropdown menu. Using my former browser, I was able to select the an item from the dropdown list by hitting the first letter with my keyboard and then hitting Enter. (Think of entering an address and selecting TX from a dropdown menu of states. Often you can hit T twice to get to TX and then the Enter key will advance the cursor to the zip code field.) Since converting to Firefox, the Enter key no longer works to advance to the next screen...I now have to move the mouse to a "Go" button and click it after selecting the desired item from the downdown menu. It's a small thing, but constantly switching back and forth between mouse and keyboard is becoming annoying. Is there an option in Firefox to select items simply by highlighting them in the dropdown menu and hitting the Enter key, instead of having to use the mouse to click a "Go" button? Thanks

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

Maybe you are looking for