How to update object IDs in bo universe designer? - sap

We work with different versions and data sources of our clinical information system.
Therefore, we have different versions of our universes issued from Universe Designer.
Nevertheless, we want that our reports use the same objects Ids in the different version of our universes.
We started from the oldest version and we added new objects simultaneously in every version of the universes.
Unfortunately, we have gotten a gap when we added an object in the latest universe version and we forgot to do it in the oldest.
So, we need now to update some of the “Object Id” fields in our latest universe version trough VBA or any other mean.
How could we do it?
Thank you for your assistance.

I'm assuming this is a unv universe. It's not possible using standard means (including the SDK) to change universe object IDs.
There are a couple of options, although none are ideal.
Let's say you were in sync up through object 1234. You have:
New universe:
ObjectA 1234
ObjectB 1235
ObjectC 1236
Old universe:
ObjectA 1234
ObjectC 1235
Now, create a new, dummy object in the old universe, which will get ID 1236. Then, delete that object as well as ObjectB and ObjectC from both. This leaves:
New universe:
ObjectA 1234
Old universe:
ObjectA 1234
If you now re-create ObjectB in both universes, it will have ID 1237. It will be different that ObjectB's previous ID in New universe, but at least it will be the same in both. You are now back in sync and can continue to create objects. Of course, if the original ObjectB or ObjectC were used in any reports, they will need to be re-added.
It's worth noting that in BI4, if you switch a WebI report to a different universe, you have the option of mapping based on class and object name rather than ID. So, as long as the names are lined up in both universes, the report will switch correctly.

Related

Find SAP modifications of function groups includes

(access key for SAP standard modifications needed for test data of this question)
Introduction:
I want to find a certain type of modification to a certain SAP standard repository object (IDES test dataset).
The modification is located in the include of a function group (it is listed under System-defined Include-files in the functionpool of the function group).
So far, I found the table SMODILOG as a central list of modifications (Log of Customer Modifications to Dev. Env. Objects).
Test Data:
My test data is function group V07A, that has e.g. the include LV07A014 (Part of the LV07ANNN include). This was modified by inserting stuff in its source code (one needs an access key in order to be allowed to do this) such as:
*{ INSERT IDSEXAMPLE 1
* this is a comment, which was added
*} INSERT
Goal:
Subsequently I want to find a table where all modifications like this are listed. I want to find the place of modification, i.e. the object type and program id of the object that was modified.
2 Questions:
I realize that the SAP standard include of a function group has a different object type and program ID than the top-include and uxx-includes.
Whereas the latter are of type PROG and prgmid R3TR (found in object catalog entry), the LV07A014 has an object catalog entry identical to the function group that it belongs to, namely R3TR FUGR. This is already peculiar to me. This seems to me as if the resolution to the sub-level (include level) is missing.
In addition, the modification to LV07A014 is listed in table SMODILOG as having the object type (field sub_type) REPS (the pgmid is not included in SMODILOG). I would expect PROG, as for the other inclueds (LTOP, LUXX).
-> Why is there a difference of object types, programids between L_TOP, L_UXX on the one hand and L_NNN Inclues on the other? (Or am I mistaken?)
-> Where can I find information of all SAP standard modifications in my system and the true object type,pgmid belonging to these modified objects (and not the function group that the modified object belongs to, this resolution does not suffice)?
There is no table or something similar where all modifications are listed. The table E071 is a good source to check pgmid and object type.
Why there is a difference of object types, program IDs between L_TOP, L_UXX on the one hand and L_NNN Includes on the other remains a mystery. SAP...
Why do you need a table? For what? Is it purely academic question or connected with real life tasks?
Have you ever tried SE95 transaction? It lists all modifications that were done in system disregard of object type and name. Yes, and function groups too. They are easily searchable by hierarchy
If it is FUGR include that was modified, then it will be listed in the node Outside of modularization units
Finally RTFM, bro...

Remove object from Active Record Relation without deleting it

I'm working in Ruby on Rails 4 with Postgresql, and I've hit a bit of a snag. We have an Active Record model called AttendanceRecord which belongs to an AttendanceDay, AttendanceSwipe, Course, and CourseTimeSlot. Attendance Records were supposed to be unique on these fields, but something went wrong and duplicates snuck in. So, I wrote a method to find all of the Attendance Records which were duplicated and only keep one of them.
In the course of that method, I built an Active Record Relation of objects that shared the same attributes, like so:
records = AttendanceRecord.where(course_id: attributes[0], course_time_slot_id: attributes[1], attendance_swipe_id: attributes[2], attendance_day_id: attributes[3])
Nice relation, right?
Next, I found the object that I wanted to keep and named it to_keep. Then, I tried to remove just that object from the relation, like this:
records.delete(to_keep)
Unfortunately, I discovered that the delete method works a little differently on a Relation than it does on an Array. Instead of simply removing the object from the list, it actually does delete it from the database (without the callbacks).
So: I'm wondering if there is a method that I'm missing that will remove my to_keep object from the Relation without actually touching the object itself. Then, I'll be able to safely call records.destroy_all and happily go about my business. :)
If you want to exclude an object from a relation you can do so by id. For example:
records.where('id <> ?', to_keep.id).destroy_all
or, thanks to #trushkevich, in rails 4 you can do:
records.where.not(id: to_keep.id).destroy_all
This means that destroy_all will be called on the records you've identified already but excluding the to_keep record.

NHibernate associate class without pulling from repository

I'm sure I've done this before but I can't recall how. I have 2 classes, say Person and Company. I'm instantiating a new Person and want to set it up so that when I save it to repository it will be associated with Company A. Company A already exists but I don't want to pull the entire thing from the DB just so I can write:
person.Company = CompanyA;
How can I set the Person's Company property so that it will be associated with CompanyA without pulling CompanyA from the DB? I definitely don't want to map the CompanyID property btw!
Use ISession.Load(id). Ayende has a good post about Get vs. Load.
person.Company = session.Load(companyAId);

NHibernate: If two calls are made to CreateCriteria, which list is Get<T> going to retrieve the object from?

Under one UnitOfWork (session) I may call CreateCriteria twice. My first call is to populate a grid for data editing. Let's say the data has been edited and flushed (saved) to the database and the grid is still open. After the data is edited, I may call CreateCriteria a second time to retrieve a list of objects that are validated and found in error.
Lets say ObjectA was retrieved by both calls to session.CreateCriteria. It was edited in the grid but found in error within the second list.
The first question would be: Considering first level cache, is ObjectA--that was retrieved from the second call to CreateCriteri--represent the one retrieved from the first call? or, better yet, did NHibernate "detect and reuse" ObjectA from the first call assuming the keys did not change?
To my final point in question: I want to edit ObjectA which was found in error, and let's say it was brought up in a ListBox. Therefore, I want to highlight that object, call session.Get()(key) in order to retrieve it from cache, then bring up a change form to change ObjectA's properties. Which object am I changing? The one from the first call to CreateCriteria or the second call? Are they the same?
Thank you in advance.
Second level cache
Take a look at http://ayende.com/Blog/archive/2006/07/24/DeepDivingIntoNHibernateTheSecondLevelCache.aspx and http://www.javalobby.org/java/forums/t48846.html
From the former:
The second level cache does not hold
entities, but collections of values
So, with caching setup properly, NHibernate will be able to recreate your object without having to get the actual values from the database. In other words, the object will be created the same as when it wasn't in cache, except that since the values are cached, NHibernate won't actually query the database since it already knows what's in there.
I'm not quite sure what you mean by "validation" and "found in error". Are you validating before insert? Typically my entities are validated before the insert/update and won't actually be inserted/updated if invalid.
Validation aside, what I think you're asking is that if you:
save something
do a flush
retrieve an item (from a new session) with the same key as the one saved in step 1
will you be retrieving the same reference to the object you saved in step 1(?). And the answer is no since NHibernate does not cache the OBJECT but rather the values so it can create a new entity populated with the cached values (instead of actually performing a DB query).
However, does that really matter? If you overload Equals such that equality of 2 entities are based on their ID, then finding the same (not reference equal, but same) item in a grid (or a hash of any kind) should be a snap.
First level cache
I didn't realize you were talking about 1st level cache. 1st level cache works as an identity map and does cache the instance of the object. Therefore, if you do 2 selects from the db based on the same ID, you will retrieve the same instance of the object.

Check if a given DB object used in Oracle?

Hi does any one know how to check if a given DB object (Table/View/SP/Function) is used inside Oracle.
For example to check if the table "A" is used in any SP/Function or View definitions. I am trying to cleanup unused objects in the database.
I tried the query select * from all_source WHERE TEXT like '%A%' (A is the table name). Do you thing it is safe to assume it is not being used if it does not return any results?
From this ASKTOM question:
You'll have to enable auditing and then come back in 3 months to see.
We don't track this information by default -- also, even with auditing, it may be very
possible to have an object that is INDIRECTLY accessed (eg: via a foreign key for
example) that won't show up.
You can try USER_DEPENDENCIES but that won't tell you about objects referenced by code in
client apps or via dynamic sql
There's code in the thread for checking ALL_SOURCE, but it's highlighted that this isn't a silver bullet.