Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hi again,

today is a great day!

I am going to solve the biggest problem in the SAP Cloud Application studio!

Raise your hands those who have never had the problem of


sharing a value between two different BOs, or between two different solutions.

Unfortunately the SAP Cloud Application studio has this limitation.

So what can we do?

We will never be able to share contents between BOs and Solutions?

Oh no guys, we will not give up so easily. We all are SAP developers and simply we don't give up, never :smile:

This is why there is already an out of the box solution.

Just follow the steps below, and let me know if you liked it :smile:

I will be in SAP TechEd in Berlin 11-12-13 November for all the people that wants to share ideas and discuss about Cloud 4 Customer.

Ok let's start!

Step 1.

- Download the solution template Attributes_sharing_bt_objects_and_solutions_V2.zip from SAP-Cloud-4-Customer---Ready-Templates/Attributes_sharing_bt_objects_and_solutions_V2.zip at master ...

- Create a new solution "just for this feature" (you can name it ContentShareManager for example)

- Import the template in your solution as shown in the Figure 1

- Activate all the objects in the solution template (right click on the root and activate all objects)

Figure 1

Step 2.

- Now is the time to update the WebService Integration with the correct WSDL containing your solution namespace (the embedded wsdl contains MY namespace :grin: ). Take a look to Figure 2 and Figure 3

Figure 2

Figure 3

Step 3.

- Now activate your Brain. It is time to think a little. I embedded into the solution template a webservice consumer, named "ExternalWebServiceIntegration". This consumer is there just for your tests, but you need to re-create this consumer on each solution where you want to use the sharing functionality.

So just create an External Web Service integration, give him the WSDL that you downloaded at point 2, and for each of these ws consumers create the associated communication scenario (A2X) and Integration arrangement (integration arrangement you need to create also for the Test consumer because it is not possible to include it in the solution template). So sorry for that.

Figure 4 - SEE THE PART HIGHLIGHTED WITH '1'

Figure 5

Figure 6

Step 4.

- Don't worry... we reached our destination... the last step is to use the feature :smile: . Create your test BO inside the "ContentShareManager" solution, or in one of your solutions (if you already trust me :grin: ).

Figure 7 - SEE THE PART HIGHLIGHTED WITH '2'

- Now you have to write the actions implementation. Yeah. I am not giving you any help for this, only two docx files with my code :cool:

Retrieve:

SAP-Cloud-4-Customer---Ready-Templates/Retrieve.docx at master · Gh14Cc10/SAP-Cloud-4-Customer---Rea...

Store

SAP-Cloud-4-Customer---Ready-Templates/Store.docx at master · Gh14Cc10/SAP-Cloud-4-Customer---Ready-...

Generates the screens for your test BO, assign the permission of the WOC to your user, and start the debug. Et voilà!

Figure 8

- And don't forget to give the right permissions to use the WS to the users you provided in the communication arrangements, and for the user that is using the functionality!

Figure 9

How it works

STORE

When store is pressed, a new AttributesManager instance will be created using the parameters your provided. The instance is automatically saved because the WS call is happening in a different session of the actual user session.

During the before-save event of the AttributesManager, if existing, a collection of attributes matching the provided attribute is retrieved inside the newborn instance. This is not the case because we are storing a new attribute :smile:

After that, the instance is retrieved again (using another ws call). On this instance is called the "CREATE_ATTRIBUTE" action, that save persistently the attribute in the AttributeDataCenter BO.

Finally the last ws call is performed: the AttributesManager instance is removed because is no longer useful.

RETRIEVE

When the retrieve button is pressed we have 4 steps:

Again a new AttributesManager instance will be created using the parameters your provided. The instance is automatically saved because the WS call is happening in a different session of the actual user session.

During the before-save event of the AttributesManager, if existing, a collection of attributes matching the provided attribute is retrieved inside the newborn instance. In this case, yes! The collection will contain your new created attribute.

Second call: we need to read again the instance now, because the first call was only useful for the creation. Let's read our instance with the data :smile:

Third call: let's delete the attribute now... we don't need it anymore for our example.

Last call: always remember to remove the AttributesManager instance or your AttributesManager table will be full of unuseful things.

17 Comments
Labels in this area