Semantic Object and Actions in SAP FIORI - sap-fiori

In SAP Fiori Launchpad configuration we use semantic object and Action. I am trying to understand that what a developer should do if there is need to create one for either t-code or WebDynpro app.
What will happen, if we assign Semantic Object and Action for more than one FIORI app?
In an organization, who is responsible for creating of these object (I am trying to understand the process, how a developer tackle a situation where there is need to create these objects for an app)
Thanks,

Related

UI5/OData: Providing Functionalites and Data depending on active User?

I am relatively new to the UI5 Framework and I have a new use-case in my company that I want to implement with UI5 and OData Services.
Basically the application has two functionalities with different stakeholder:
Role A is able to create new requirements
Role B is able to check the requirements and update them with new
information
How can I implement this the best way? My previous thoughts on that:
Possibility 1:
I have the OData Service in the Backend that is used by two separated application depending on the role. The access is controlled through the launchpad over the PCFG objects. So a specific user can only use the application that he actually needs. I believe that matches the basic granularity of Fiori apps. On the other hand, it invalidates the DRY principle since I would have redundant code like most of the view.
Possibility 2:
I check in the UI5 Framework or OData Service which user is currently using the app and enable/disable the required controls in the controller class. I haven’t come across on how to do this. Is there a way to check which user is logged on? Or how can I implement in the OData service, that only specific information is delivered to the client?
What is the correct way to implement such a use case? Is there a better option that I am not aware of? I would appreciate any thoughts on that matter, thanks :)
Best regards
Suggested Approach
If two roles do not share any common functionalities, then I would go for two separate UI5 apps, so as to keep them simple. In that case, each app would have it's own OData service. But in the backend, you can always have a common class for 'Requirements' which is called by both the OData service implementations. (So as to maximize code reuse). So most of your business logic should be inside the 'Requirement' class, and the OData implementations serve as dispatchers.
To check which user is logged in
This is a common requirement for most of the business applications and it is possible in Gateway/ABAP as well. Within the ABAP context, there is always a system variable available named SY-UNAME, which will provide you the current logged in user's name. You can use it further to derive the user's role.

Using Web Services with EF Code First approach

I have developed some MVC applications by using Entity Framework code first approach and now I am developing a new application that will also use web services for mobile applications that we will create. So, I have trouble about the issues below. Could you clarify me please one by one regarding to the issues?
Which web service technology should I use i.e. Web API, WCF, etc? (I am using MVC5 and EF version 6 in my project)
Can I use the same CRUD methods for my web application and for web services? If so, which modifications should be made on the methods and on the other fields i.e. models, etc?
For a current MVC application where EF code first approach was used, is it better to create a new methods for web services or should the current methods be updated by adding ability to support also web services?
Thanks in advance...
I highly recommend to use Commands and Queries. It's covered in this and this articles.
The Command is simple DTO object, and it could be easily sent over the network. In this case you have control over the fields and behaviour you want to make public.
Because commands are simple data containers without behavior, it is
very easy to serialize them (using the XmlSerializer for instance) or
send them over the wire (using WCF for instance), which makes it not
only easy to queue them for later processing, but ot also makes it
very easy to log them in an audit trail- yet another reason to
separate data and behavior. All these features can be added, without
changing a single line of code in the application (except perhaps a
line at the start-up of the application).

Model View Controller Store - Should I create more than one store object in this situation?

I'm still not used to the MVCS design pattern. I read in a book that if I was planning to create an app that gets information from an external source, it's better to use MVCS instead of MVC.
I'm currently working on an ios app that gets information from multiple external sources. For example, I'll be fetching info about the weather from a web service, driving directions/time probably from Google, and data from our database via a web service as well.
My question is, do I need to create more than one store object in this situation? Like create a store object for each of the external sources? Or do I just create one for all of them?
I think it really depends on your design approach as you can have dozens of different design approaches which all respect the MVC principles and that therefore are all correct.
Personally I would suggest to try to decompose the problem as much as you can in smaller problems, in order to get the most from the flexibility that a objected oriented environment gives you.
In this case, for instance, you could think about having an abstract store class in which you implement the common functionalities you need to have and then subclassing it for each different web service you need to use and implementing the other functionalities related to that specific service. It's just an idea! I hope this helps.

ASP Membership tables -> add new property to user?

I would like to start using ASP.NET's membership classes and tables with a new MVC4 project I am building.
Let's say for example I want to keep track of user's birthdays. When creating the account, how do I add in the birthday? Is this something I keep track of with Profiles? I'm a bit confused on the correct way to add new 'columns' of data for users?
To specifically answer your question, here's how Microsoft advises to create extra tables for storing additional user information: Storing Additional User Information
Here is another posting (I would take this approach), its implementing your own profile provider, rather than using default one, so you have full control over what is happening, how it stored etc.: Implementing Profile Provider in ASP.NET MVC
Another great article by Microsoft about the same is Manage Web Users With Custom Profile Providers
It totally depends on utility and use. You can either
use default profile provider (exercising)
use custom profile provider (small scale sites)
use your own tables to store user information (enterprise level).
In the latter case you can link between default membership (assuming you using default membership provider) and your custom profile information by including user.Guid inside your table, which is used by default membership as unique identifier.
Hope this information will help you.
Profiles is the right way although it has its disadvatages. The data in the database is not in a readable way but in special strings, and profile is loaded on every postback.
Look here:
http://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx

asp.Net MVC Add Properties to User class

In my app I want to add properties to the user class.
How should I do it?
My current solution is to create Users table in th database, but I just read that Asp.Net provides out-of-the-box users registration API and functionality.
How can I update the new properties?
Thank you
Do you mean you want a custom Principal? In that case you want to hook into the AuthenticateRequest method and add your own, derived principal. I recently answered a question regarding the creation of a custom principal here. While that question deals with WindowsAuthentication, the idea is the same:
Get the current authenticated principal,
use it to create your own custom principal,
set your principal on the HttpContext and Thread.
You can write a custom Membership Provider that plugs into the membership & authorization features built into the framework. You can also write your own custom User class that inherits from the standard class. You can design it so that it uses your existing users table if you want.
This has worked out well for us on a couple different projects.
Here's some documentation:
http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx

Resources