RazorSPoint

How to use the BCS Connector

The BCS Connector is a powerful tool but easy to use, once you got the hang of it. This tool uses no code and doesn't require any programming knowledge.

Sebastian SchützeSebastian Schütze
This entry is part 2 of 4 in the article series ERPConnect Services

What is the BSC Connector?

The BCS Connector is a powerful tool but easy to use, once you got the hang of it. It is a stand-alone software which uses the ECS Core of the ERPConnect Services to connect SAP-objects or -tables with external SharePoint lists. This tool uses no code and doesn’t require any programming knowledge. Nevertheless, you need to have a basic understanding of tables, functions from SAP and what the BCS in SharePoint is.
Just to be clear: What you see on SharePoint is just viewed on it. It is not saved or processed in any SharePoint database. The information about data structures is the only data which are saved. The tool offers the following features:

User Interface Basics

On the following screenshot, you can see several regions. First of all the ribbon bar which includes all the commands to edit the SharePoint connection information. Furthermore, you see the commands for importing / exporting or saving and opening you model.

On the left side of the screen, you can fill in the connection information to the SAP server and also a panel to add SAP objects or tables to the BCS-Connector.

On the right side, everything is shown which relates to the loaded SAP table / function. You are able to see what is the structure of the table, you can determine and translate columns names and you also set the allowed operations (CRUD) on the data structure.

Let’s create a Connection to SAP and SharePoint

When you click in “Edit SharePoint” on the top left, you are asked for SharePoint credentials. Since the BCS Connector is a tool which is installed directly on a SharePoint you usually don’t need to fill in a user because you will be probably logged in as a farm administrator with lots of permissions. But if you need to, you should fill in a user who should have permissions who has manage right in the targeted site collection.

Later on you need to set permissions on the external content types either in the secure store or you can permit the users directly on each external content type (I don’t recommend that). On the SAP part, some more information is needed. The following information is needed to get a successful basic connection to the SAP-Server: client id, language code, SAP username and password, hostname (URL or name of the server) and the system id. If you want to use the secure store, the secure store id to the previous created secure store application is needed.

An Example for a BCS Model with the BCS Connector

After setting up the connection, we can start mapping some SAP tables to SharePoint. Generally, SAP has an uncountable amount of tables. In many cases, the system is highly customized to the companies needs. That being said, it is hard to give you an example you can try out (despite the fact that you need a SAP system 😉 ). But what you can try to use are the VBAK and TVKBT tables which in my case had sample data of some sales data. In the next screenshot is an example of how it looks like to have the VBAK table setup in the BCS Connector.

On the right site of the UI are the entity properties (or to in this case the columns) of the table. You see the internal name from SAP and the data type. Don’t mix this data type with SAP data types. Those are mapped .NET data types like ‘System.String’. That means the Software tries to map it and usually, it will be ‘string’. You also have the possibility to choose a name for each column. This is either for the displayed column or the internal column name of the external List in SharePoint. You could also set up translations for every language that is installed on SharePoint.

In the next screenshot, you see the “New Entity” dialog, which you can start by pressing the “New” Button on the bottom left. In this dialog, for table or function can be searched. if you can’t find the table use the search wildcard ‘%’ before or after the search string.

Entity Operations for SAP Tables and RFC Functions

After you choose your table or RFC function you can configure it. The next screenshot shows the configure options for the VBAK table and the “find” method. The finder method is simply the function that gets all the data entities in table form. What I would recommend is to use the ‘WHERE Clause’. This is for limiting the returned data. You should try to only return the data, you really need because the BCS of SharePoint has thresholds and the connection can get very slow. The ‘WHERE Clause’ works very similar to the SQL syntax.

You can also set up filters which give a dynamic way of filtering the returned SAP data. These filter can be used in views of the external list. The ‘WHERE Clause’ can only be changed in the BCS Connector.

You can also have a preview of the data from SAP to see what your settings will give you back when you open the external list later on.

During saving the model to the SharePoint BCS, the old model will be deleted and not overwritten or updated. Just to mention it.

And this is how the saved model looks like in the BCS in the Central Administration of SharePoint. What you finally need to do is to give proper permission to the external content types itself. Either you do that for each user or you set up the secure store with a technical user that accesses the content types.

Exported XML Example from the BCS Connector

Just to give you an impression how the XML for the exported BCS Connector could look like. You to let you know: This is not a working example. It is shortened and is usually more complex.

<?xml version="1.0" encoding="utf-8"?>
<model name="SAP Theobald Model">
  <localizedDisplayNames />
  <lobSystem name="SAP Test System">
    <localizedDisplayNames />
    <instance name="SAP Test System RazorSPoint Theobald" useECSRuntime="False" ecsServiceApplication="">
      <localizedDisplayNames />
      <sapConnection client="800" language="EN" username="RazorSPoint" password="ImNotTellingYou" secureStoreID="" isUnicode="True" connectionType="ApplicationServer" host="theobald.razorstudio.com" system="00" />
    </instance>
    <entities>
        <localizedDisplayNames />
        <fields>
          <field name="MANDT" fieldName="MANDT" displayName="MANDT" typeName="System.String" formatType="" setAsTitle="False" length="3" isSelected="True" isIdentifier="True">
            <localizedDisplayNames />
          </field>
          <field name="SPRAS" fieldName="SPRAS" displayName="SPRAS - Language Key" typeName="System.String" formatType="" setAsTitle="False" length="2" isSelected="True" isIdentifier="True">
            <localizedDisplayNames />
          </field>
          <field name="VKBUR" fieldName="VKBUR" displayName="VKBUR - Sales Office" typeName="System.String" formatType="" setAsTitle="False" length="4" isSelected="True" isIdentifier="True">
            <localizedDisplayNames />
          </field>
          <field name="BEZEI" fieldName="BEZEI" displayName="BEZEI - Description" typeName="System.String" formatType="" setAsTitle="False" length="20" isSelected="True" isIdentifier="False">
            <localizedDisplayNames />
          </field>
        </fields>
        <methods>
          <method name="Read Table" objectName="TVKBT" tableWhereClause="" methodType="Finder" methodInstanceID="329">
            <localizedDisplayNames />
            <returnParameter name="TVKBT" type="Table" isSelected="False" />
            <inputParameters />
            <returnParameters>
              <returnParameter name="TVKBT" type="Table" isSelected="False" />
            </returnParameters>
            <filterDescriptors>
              <filterDescriptor name="Limit Filter" parameterName="limit" type="Limit" mappingType="Field" mappingName="MANDT" defaultValue="4000">
                <localizedDisplayNames />
              </filterDescriptor>
              <filterDescriptor name="Language" parameterName="SPRAS" type="ComparisonEqual" mappingType="Field" mappingName="SPRAS" defaultValue="D">
                <localizedDisplayNames />
              </filterDescriptor>
            </filterDescriptors>
          </method>
          <method name="Read Table Record" objectName="TVKBT" tableWhereClause="" methodType="SpecificFinder" methodInstanceID="343">
            <localizedDisplayNames />
            <returnParameter name="TVKBT" type="Table" isSelected="False" />
            <inputParameters>
              <inputParameter name="MANDT" typeName="System.String" value="" mappingName="MANDT" abapType="" />
              <inputParameter name="SPRAS" typeName="System.String" value="" mappingName="SPRAS" abapType="" />
              <inputParameter name="VKBUR" typeName="System.String" value="" mappingName="VKBUR" abapType="" />
            </inputParameters>
            <returnParameters>
              <returnParameter name="TVKBT" type="Table" isSelected="False" />
            </returnParameters>
            <filterDescriptors />
          </method>
        </methods>
      </entity>
      <entity name="T_PRODUCTS" namespace="RazorSPoint.BCSConnector.SAP" version="1.0.0.0" estimatedInstanceCount="1000" objectType="Function" objectName="Z_ECS_PRODUCT_GET_LIST" parameterType="T" parameterName="T_PRODUCTS" structureName="ZECSPRODUCTS" isCrawlable="False" customFunction="">
        <localizedDisplayNames />
        <fields>
          <field name="MANDT" fieldName="MANDT" displayName="MANDT" typeName="System.String" formatType="" setAsTitle="False" length="3" isSelected="True" isIdentifier="False">
            <localizedDisplayNames />
          </field>         
          </field>
        </fields>
        <methods>
          <method name="Read Data" objectName="Z_ECS_PRODUCT_GET_LIST" tableWhereClause="" methodType="Finder" methodInstanceID="364">            <localizedDisplayNames />
            <returnParameter name="T_PRODUCTS" type="Table" isSelected="False" />
            <inputParameters>
              <inputParameter name="SEARCH_PRODTYPE" typeName="System.String" value="" mappingName="Product Type" abapType="CHAR,8,0" />
              <inputParameter name="SEARCH_PRODUCTNR" typeName="System.String" value="" mappingName="Product Number" abapType="CHAR,36,0" />
            </inputParameters>
            <returnParameters>
              <returnParameter name="T_PRODUCTS" type="Table" isSelected="False" />
            </returnParameters>
            <filterDescriptors>
              <filterDescriptor name="Product Number" parameterName="SEARCH_PRODUCTNR" type="Wildcard" mappingType="InputParameter" mappingName="SEARCH_PRODUCTNR" defaultValue="%">
                <localizedDisplayNames />
              </filterDescriptor>
              <filterDescriptor name="Product Type" parameterName="SEARCH_PRODTYPE" type="Wildcard" mappingType="InputParameter" mappingName="SEARCH_PRODTYPE" defaultValue="%">
                <localizedDisplayNames />
              </filterDescriptor>
            </filterDescriptors>
          </method>          
            <localizedDisplayNames />
            <inputParameters>
              <inputParameter name="I_PRODUCT" typeName="Structure" value="" mappingName="<<ENTITY>>" abapType="" />
            </inputParameters>
            <returnParameters />
            <filterDescriptors />
          </method>
        </methods>
      </entity>
    </entities>
  </lobSystem>
</model>

Creating External Lists

Creating an external list is very straight forward. Just go to the ribbon “External Lists” and create one.

Here you see a dialog with the Entity to which you want to have a list. Choose a name and that’s it. TADA!

 

The list itself look nearly like a normal list. You will notice the difference in the detail. For example, the number of context menu items depend on if the list is read-only or support the full CRUD methods.

Conclusion

I have shown how to use the BCS Connector. The use of this tool works completely without any code. Most of the work is done by the tool. You can concentrate more on the content because you only need to choose which information you want to present in SharePoint.



Sebastian is an Azure Nerd with focus on DevOps and Azure DevOps (formerly VSTS) that converted from the big world of SharePoint and O365. He was working with O365 since 2013 and loved it ever since. As his focus shifted in 2017 to more DevOps related topics in the Microsoft Stack. He learned to love the possibilities of automation. Besides writing articles in his blog and German magazines, he is still contributing to the SharePoint Developer Community (and PnP SharePoint) to help to make the ALM part a smoother place to live in.

Comments 0
There are currently no comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.