cancel
Showing results for 
Search instead for 
Did you mean: 

IDT SDK - getting object <-> table(s) mapping

Former Member
0 Kudos

Hello,
 
How do I find out which tables (in data foundation) using object in business layer?
 
I try open universe business layer (blx) via sdk and get extra tables, but always return empty list.
 
My code:
 


public void getMapping() {

         SlContext context = null;

         IEnterpriseSession enterpriseSession = null;

         try {

             context = SlContext.create();

             enterpriseSession = CrystalEnterprise.getSessionMgr().logon(CMS_LOG_USER, CMS_LOG_PASS, CMS_LOG_HOST, CMS_AUTH_MODE);

             context.getService(CmsSessionService.class).setSession(enterpriseSession);

             LocalResourceService service = context.getService(LocalResourceService.class);

             RelationalBusinessLayer businessLayer = (RelationalBusinessLayer) service.load(BLX_PATH);

             RootFolder rootFolder = businessLayer.getRootFolder();

             printObjectMapping(rootFolder);

             service.close(businessLayer);

         } catch (SDKException e) {

             System.out.println("Error: " + e.getMessage());

         }

     }

 

     protected static void printObjectMapping(BlItem biItem) {

         if (biItem instanceof BusinessObject) {

             BusinessObject elem = (BusinessObject) biItem;

             RelationalBinding binding = (RelationalBinding) elem.getBinding();

             System.out.println("Object " + elem.getName() + " using tables: " + binding.getExtraTables());

         }

         if (biItem instanceof BlContainer) {

             for (BlItem item : ((BlContainer) biItem).getChildren()) {

                 printObjectMapping(item);

             }

         }

     }


 

BO 4.1 SP1


Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The getExtraTables() method only gives you the additional tables that have been added to an object manually via the extra tables functionality, not those implicitly referenced it its SQL. If you don't use the "extra tables" functionality in your universe, this list is always empty.


The getImplicitTables(BlItem) method of the BusinessLayerService interface will give you the list of implicit tables.

If you want to know ALL the tables associated with an object -- and you use the "extra tables" functionality in your universe -- you'll want to use both of these methods. 

Former Member
0 Kudos

OK, thank You Emily. Sounds great!

But... I don't see BusinessLayerService interface in SDK. Which .jar should I include?

Former Member
0 Kudos

It is in the com.sap.sl.sdk.authoring.businesslayer package.

You obtain the service as you do the other SL services, with the SlContext.getService() method:

 

BusinessLayerService blservice = myContext.getService(BusinessLayerService.class);

Like all the other components of the SL SDK, it is referenced by an entry in the manifest of the all-encompassing sl_sdk.jar.  We've split (or hacked) this apart to put the individual components into our maven build and the internal jar is com.sap.sl.sdk.authoring.jar.  Not sure how you've configured your build but you should be able to find the class.

Hope this helps.


Former Member
0 Kudos

Still don't see BusinessLayerService. Should I have SP2?

Former Member
0 Kudos

I am using SP2 and I have the class, so I suspect that may be the issue.

I notice that in the Javadoc the class is marked 'since 14.1.2' which normally corresponds to 4.1 SP2.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I am getting this error "The query does not reference any table when attempting to build the WHERE clause (IES 00022)" when running the universe created using the semantic layer sdk. After inspection I found that for the columns added in the Business layer there is no associated sql tables assigned.

Is there a way to set implicit table for the fields added in the business layer?

Regards,

Sudheep

Former Member
0 Kudos

I get an exception java.lang.UnsupportedOperationException: csEX

at the line below

RelationalBusinessLayer relBusinessLayer = (RelationalBusinessLayer) localResourceService.load(RET_UNV_PATH);

Please help me on this. Thanks.

Former Member
0 Kudos

Verify that you have added the following argument to the Java Virtual Machine:

-Dbusinessobjects.connectivity.directory="D:\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\dataAccess\connectionServer"

-Prithvi

Former Member
0 Kudos

Thank you Prithvi