Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

In my first SDN blog I write about using ABAP RFC function modules in SAP NetWeaver Visual Composer and how to solve issues. In the last weeks there were a lot of threads in the SDN SAP NetWeaver Visual Composer Forum about RFC or BAPI issues. There were some threads about “BAPI/RFC does not work” or “There is BAPI available for…” and so on. That’s the reasons, why I decide to write a blog, where I demonstrate you how to build an Visual Composer application, which uses ABAP RFC function modules for displaying BI master data. Then I extend this application with a search function and the possibility of modifying the master data. I also use this application to show you, how useful it is to use external debugging. After I finished my blog I noticed, that this blog became a big blog, that’s why I split it into two parts. For an overview I add a table of contents and a list of the system requirements. You can download the whole blog as a PDF from our company website. The hyperlink is at the end of every blog.


Table of Contents

First Part of the SDN Blog

Connection Lifetime in the Visual Administrator
Create an InfoObject for our example
Create a RFC function module for displaying master data in Visual Composer
Adding example master data in the backend system
Create the Visual Composer Model for displaying master data
Search function

Second part of the SDN Blog

Create another RFC function module for modifying master data
Add “Modify master data” feature to the Visual Composer model
External debugging of RFCs or BAPIs


System requirements

SAP NetWeaver 2004s BI SP08
SAP NetWeaver 2004s EP SP08
Internet Explorer 6 SP2 with flash plugin
MSXML Parser 4
Adobe SVG Viewer 3

First Part of the SDN Blog

Connection Lifetime in the Visual Administrator

Everybody who has already worked with RFC function modules knows the issue, that after a changing of the import or export parameters in the backend system, Visual Composer doesn’t realize the changing in the backend system.

Also the modification of the setting in Visual Composer under Tools > Options > Compiler > Data service retrieval to “Do not cache data service (get latest)” has no effect. Other advices, like restarting the J2EE engine or renaming the function modules were not practicable. Therefore I contacted the SAP support and asked them for a better solution. Expecting that there must be a setting in the J2EE engine which defines when the metadata is read from the backend system. In the end, this was confirmed by the SAP support.

The following pictures illustrate the settings in the J2EE engine.


Click on the picture to enlarge it.

In the Visual Administrator you can change the “Connection Lifetime” as shown in the screenshot above. You can set an interval (in seconds) for updating the metadata of RFC function modules with the backend system. I tested it on our system, which is used by our R&D department and other users, so that I can say, I had tested the system with the new setting under stress. I set the connection lifetime to 60 seconds, so that we can use a changed RFC after approximately one minute. I recommend everybody developing Visual Composer applications with RFC function module to also change this setting, so that you have the latest function module available in your models after approximately one minute.

Create an InfoObject for our example

After logging into your BI system via SAP GUI, you can create new characteristics using the transaction “RSA1” (the screenshot shows the transaction RSA1).


The characteristic gets the technical name “ZZ_BLOG” and the long description “Characteristic for the SDN Blog”.


For this example I use the Data Type NUMC with the length of 8 and an ALPHA conversion Routine.

Under the “Master data/texts” tab we change the settings as shown in the following screenshot, so that we have only a numerical key with short and medium length texts.

To finish this action, you have to activate the InfoObject by clicking on the activate button (as shown in the symbol below) or by using the shortcut CTRL + F3 on your keyboard.

After activating the InfoObject you can look up the name of the table where the texts have been stored (red framed in the screenshot).




Create a RFC function module for displaying master data in Visual Composer

The next step will show you, how to get data from a BI backend system into Visual Composer with using a RFC function module. Therefore, log on to your backend system and start the SE80 transaction.

In the Object Navigator navigate to “Local Objects”. Your user must have a function group, if not, then you create a new function group. Below the function group you can add function modules. Then create a new function module by right clicking on the function module folder as shown in the next screenshot.

You have to enter a technical name and a description. In this example our technical name is “ZZ_SHOWTEXT” and the description “SHOW BI TEXTS IN VC”.

Then go to the “Attributes” tab to the section ”Processing Type” and change the selection from “Normal Function Module” to “Remote-Enabled Module” as shown in the following picture.

Afterwards, click on the tables tab and enter a table parameter as shown in the following screenshot. The associated type is like the text table in the InfoObject.

Now we need a short and easy ABAP Coding to get the data into our T_TEXT_TABLE. Therefore change to the source code tab and enter the following code:

SELECT * FROM /BIC/TZZ_BLOG INTO CORRESPONDING FIELDS OF TABLE T_TEXT_TABLE.

That’s it! Now you have to activate it and it’s ready for usage in Visual Composer.

Adding example master data in the backend system

After activating this function module the first step is to enter data in the “RSD1” transaction. You have to enter the technical name of the InfoObject “ZZ_BLOG” and then you click on the display button.

Then select “Maintain” by clicking on the button or by using the shortcut F6.

On the next screen, click on the clock or use the F8 button for the next screen.

Now we add some data records by clicking on the create symbol (blank white sheet) or by using the shortcut F5.

As you can see in the picture below, I added six data records for our example application in the Visual Composer.

Now we have all the things we need to test our RFC in Visual Composer: The RFC function module and some example data in the SAP Netweaver 2004s BI backend system.


Before you can use the RFC in your Visual Composer you must connect to the BI system using the Enterprise Portal.


I assume that you have already configured your BI system in the portal, so that you have access to the RFCs and BAPI. If not, please refer to of the configuration documents and how-to’s addressing this topic..(You can also find them in the SDN)


There is also further information available under:


http://help.sap.com/saphelp_nw2004s/helpdata/de/9b/3ac52d74cf4c43b1cf3a71725c951f/frameset.htm


(Defining Portal Systems and Aliases)

Create the Visual Composer Model for displaying master data

Now we start the Visual Composer and test our ABAP RFC function module.

Login into Visual Composer and create a new model. Then create a new iView.

Drill down into the iView. Select “Find Data” in the task panel toolbar. Then choose your system for RFCs and search for already the created service “ZZ_SHOWTEXT”.

Drag the service into the storyboard and add a table as shown in the following screenshot.

The next step is to create an input form.

Then select the input form as shown in the screenshot above. Now you can change the layout of your application as shown in the next screenshot.

After finishing this task, deploy your application by clicking on the deploy button.

In a new window of the Internet Explorer you get the result in the Enterprise Portal as shown in the next screen shot.

Now you get the data from backend system via RFC. If you have more then six records you get several problems as you need a long time finding the correct record. If you even have thousands of records you will reach the limit of Visual Composer or you will have a very bad performance. Therefore you can add a search function, which means changing the ABAP RFC (adding a search function).

Search function

For adding the search function I had to add an import parameter to my RFC function module. I go back to the transaction SE80 in the backend system and edit the function module “ZZ_SHOWTEXT”. I add an import parameter for our search string as shown in the next screenshot.

Then I changed the coding as shown below for our search function:

Then I changed the coding as shown below for our search function: FUNCTION ZZ_SHOWTEXT. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING *" VALUE(I_SEARCH_STRING) TYPE STRING *" TABLES *" T_TEXT_TABLE STRUCTURE /BIC/TZZ_BLOG *"---------------------------------------------------------------------- * we need a local variable for our serachstring data: l_condition type string. * Concatenate the search condition CONCATENATE '''' I_SEARCH_STRING '''' INTO l_condition. CONCATENATE 'TXTSH =' l_condition INTO l_condition SEPARATED BY SPACE. SELECT * FROM /BIC/TZZ_BLOG INTO CORRESPONDING FIELDS OF TABLE T_TEXT_TABLE WHERE (l_condition). ENDFUNCTION.

Now we go back to Visual Composer and replace the old function module with the modified function module. Therefore I select “Find Data” in the task panel toolbar. Then I choose the system and search for the modified function module. Then I put the modified function module on the storyboard and remove the old function module, because there is no refresh functionality available for function modules. After replacing the old function module, the function module on the storyboard must have an import parameter as shown in the screen shot below. Visual Composer realizes the modification of the RFC function module after a minute (if you have set your connection pool time as I described in the beginning of this blog).

Then add an input field in the input form for inserting the search value. Select the form and click on the plus button in the task panel toolbar. Choose an input field and enter a name for the field as shown below.

Select the transition between the form and the RFC and select configure in the task panel toolbar. You have to assign the search value as import parameter as shown below.

Finally, you have to customize your layout with the drag & drop functionality of Visual Composer this is quite easy.

After customizing the layout, I have to deploy the application with the new search function. When I search for my name I getonly the record with my name as the result (shown in the next screenshot).

This application demonstrated you how to use ABAP RFCs in your Visual Composer application. If there is no function available in the SAP standard you have to create it for example with ABAP, you can also use other technologies like a webservice.

That was the first part of my first SDN blog. The whole SDN Blog can also be downloaded from the IBSolution webserver as a PDF file. You can download it the blog here: Download the Blog from the IBSolution Portal




15 Comments