Skip to Content

The second part of my first SDN blog, which extends the Visual Composer application of the first part and shows how to use external debugging of RFC/BAPI for resolving issues.

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

Second Part of the SDN Blog

Create another RFC function module for modifying master data

In the next step I will extend the application, so that the user can modify the master data in Visual Composer. For this new feature we need a further function module. Go back to the transaction SE80 and create a new function module.

For the technical name enter “ZZ_MASTERDATA” and for the description “CHANGE MASTERDATA IN BI”.

Another function module

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

Another function module

I also have to add an import parameter as shown in the screenshot below. This parameter is like the text table, so that you can append your modified records to this table. In Visual Composer you pass the modified records to this import parameter.

Import parameters

Now assign an export parameter called message for returning a result of the operation in Visual Composer, e.g. “Operation successful” or “Operation failed”.

Export parameters

Then I must enter the coding under the tab “Source code”. The following code modifies master data records of the InfoObject “ZZ_BLOG” as they are passed into the import parameter “I_T_TEXTTABLE”. After the modification it returns if the operation is successful or not.

FUNCTION ZZ_MASTERDATA. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(I_T_TEXTTABLE) LIKE /BIC/TZZ_BLOG STRUCTURE *" /BIC/TZZ_BLOG *" EXPORTING *" VALUE(E_RESULT) TYPE STRING *"---------------------------------------------------------------------- * Type pools used by conversion program TYPE-POOLS: RS, RSARC, RSARR, SBIWA, RSSM. data: l_t_texts like /BIC/TZZ_BLOG occurs 10, l_s_minfo Type rssm_s_minfo, l_t_idocstate type rsarr_t_idocstate, l_subrc like sy-subrc. append I_T_TEXTTABLE to l_t_texts. * Change Text of ZZ_BLOG call method cl_rsdmd_update_master_data=>update_texts_static EXPORTING i_iobjnm = 'ZZ_BLOG' i_chavl_enqueue = rs_c_true i_t_data = l_t_texts i_s_minfo = l_s_minfo i_monitoring = rs_c_false i_create_statistics = rs_c_false IMPORTING e_subrc = l_subrc CHANGING c_t_idocstate = l_t_idocstate. if sy-subrc <> 0. E_RESULT = 'Operation without success.'. else. E_RESULT = 'Operation successful.'. endif. ENDFUNCTION.

After finishing this, go back to the Visual Composer and add the new feature we just created.

Add “Modify master data” feature to the Visual Composer model

First add a toolbar to the master data table with a “modify record” button. Therefore select the table “master data table” and click in the task panel “toolbar” on configure and then on edit as shown in the next screenshot.

Add Toolbar

The following picture shows you, how to add the button:

  • Step 1: Click on the plus symbol to add a button.
  • Step 2: Rename the button.
  • Step 3 is to change the action.

Add buttons to the toolbar

Then add a popup iView for editing the selected record.

Add a popup iView

Step 1: Create a new iView. In this popup iView we add a form for editing the master data.
Step 2: Enter a technical name for this new popup iView.

Create a new popup iView

Then select the line between table and popup (step 1) and change the event name to submit (step 2) as shown in the screenshot below.

submit event

Drill down into the created popup iView.

Pull the Data Service “ZZ_Masterdata” into the storyboard and add an input form.

add the data service

Add a start point and connect it with the input form.

add a start point

Select the start point and click on configure in the task panel toolbar (step 1). In the second step add an input parameter by clicking on the plus symbol.

add input parameters

Enter a fieldname and confirm by clicking on the OK Button.

enter fieldname

Repeat these steps for adding the input parameters TXTSH and TXTMD for the short texts and the medium length texts.

By the time you finished this, you have created three input parameters.

three input parameters

Add a data store after the function module for storing the result value of the function. The value is stored in a data store, because this value should be displayed in a plain text field in the editing form as status information.

add a datastore

Add a field to the data store like the output parameter of the function module.

add a field to the datastore

Then you must assign a value to the data store field. Therefore you select the line between the function module and the data store(step 1). Next (2), click on configure in the task panel toolbar. In the last step (3), choose @E_RESULT from the drop down.

assigning values

Select the input form (“I T Texttable Form”) and click on configure in the task panel toolbar.

remove the field

Remove the red framed field “F_BIC_ZZ_BLOG” as this field is not necessary, because we use the field “ZZ_BLOG” from the start point for the InfoObject key.

In order to display the status message, add a plain text field by clicking on the plus button in the task panel toolbar. In the popup you choose “Plain Text” (step 1), then enter the field name (step 2) then click on the OK button (step 3).

add a field for the status message

To have a minimum of navigation options, we need two further pushbuttons abort and close. Repeat step 1 – 3 choose “Pushbutton” instead of “Plain Text” in step 1 and in step 2 enter abort and close for the corresponding buttons.

Now we have to customize the layout of our popup iView. Go to the layout mode of Visual Composer for customizing. In my case the modified layout looks like the following screenshot.

customize the layout

I renamed the button “submit” to “save”. I want that the “abort” and “save” buttons are displayed until the user clicks on either one of these. If the user clicks on the abort button, the popup window should be closed. Accordingly, if the user clicks on “save”, the modified data is passed to the function module, which writes the data into the backend system and returns a status message of the operation.

I use the combination of a data store and a plain text field for displaying the status of the modify operation. Under the control properties of the status field you enter a formula into the label as shown in the next screenshot.

status message

In the “control properties” of the “save” button enter a condition as shown in the screenshot, because the save button should be hidden after clicking on it.

hiding condition

Enter as well a condition for the “abort button” under the “control properties” as shown in the screenshot.

hiding condition

In the “control properties” of the “close” button enter a condition as shown in the following screenshot. The close button should be displayed, when the modification of the master data was successful.

hiding condition

But: We still have to define the actions of the abort and close button.

As you want the window to close when hitting the “abort button”, you use the system action “close window”.

system action close window

For the Close button you have to define a custom action called “close”.

custom action close

In the control properties of the field “ZZ_BLOG“ the disabled settings is assigned the value “true”, as it makes no sense to change a key value.

disable field

Back in the storyboard you have to add an end point, which returns the modified short text and medium length text to the parent iView (into the table).

add end pointselect output fields

Choose TXTMD and TXTSH for the endpoint output fields as shown in the second screenshot above.

Select the line between end point and input form (1). Choose configure in the task panel toolbar (2) and change the event name to close (3).

close event

Then go back to the parent iView of the popup (click on “Read Data from BI”).

There you have to assign the popup input values and the popup output values.

First, select the line between table and popup and choose “configure” in the task panel toolbar (2).

In the third step you have to enter the popup input values and in step four the popup output value.

popup input and output parameters

That’s it! Now you can deploy the application and test if it works.

After deploying I want to change the texts of the record with the ID “0000006” from “SDN Blog” to “my SDN Blog”. Therefore I first search for “SDN Blog” and click on the “Modify record” button to do the changes.

the deployed application

The popup appears and I change the texts as I mentioned. When you click on “Save” the success message appears, on “close” it disappears again.

the deployed application

Search again for “my SDN Blog” and you will notice that there is a new record with the ID “00000000”.

the deployed application

The screenshot above shows, that there must be an error. This would be a bad blog, if I show you how to create an application with errors, wouldn’t it? – But: This was intended for showing you how to debug ABAP RFCs and how to resolve issues with RFCs or BAPI, because I’ve read about several issues with BAPIs in the Visual Composer Forum in the last months.

External debugging of RFCs or BAPIs

In the next chapter I will show you how-to debug an RFC (this can also be done with BAPIs). Therefore you go back to the SAP GUI and start the transaction RSD1 and enter the technical name of the InfoObject “ZZ_Blog” and click on the “display button”.

RSD1 start screen

On the next screen, click on maintain or use the shortcut F6 and then F8 (or click on the clock) to display all records.

RSD1 maintain button

The table shows, that our operation was not successful. The texts of the record with the ID six has not been modified, instead there is a new record without a BLOG ID.

RSD1 master data

Maybe this is an error of the function module? To resolve this, go to transaction SE80 and open the function module.

SE80 externale breakpoint

Then set your cursor to line 20 (first step). The second step is to set an external breakpoint.
A symbol appears on the left side of line 20.

After that, go back to the deployed Visual Composer application and try again to change the record with the ID “00000006”. When you click on the save button and the data is passed into the function module, a new window opens with the ABAP debugger.

Within the ABAP debugger you can double click on the “I_T_TEXTTABLE” import parameter. This displays the content of this variable in the tab on the right side of the window. It seems that the function module does not get the right value from visual composer. To resolve this, we go back to Visual Composer and check our model.

ABAP debugger

Navigate to the popup iView. Check the line between input form and the function module, because the data of the input form are passed into the function module.

VC error in the model

Now you will find the error. There is no value passed from the form to the RFC.
To fix this error you must assign the value of the Blog ID (enter: @ZZ_BLOG).

Then test it again. Deploy your model again and try to modify the master data.

The Debugger starts again.

ABAP debugger starts again and display correct values

Now the correct values are passed into the function module and the application works fine.

This was a simple example for debugging RFCs. You can also debug BAPIs on the same way. There are often issues with passing the values from Visual Composer, that’s why you should always check the passed import parameters if an error occurs. Often there are issues because the values are not in the correct format. For example dates are stored in the backend system in an internal format. In the application you use a local formatting for the date, e.g. in Germany you use 31.12.9999 .You can also have another formatting in other countries like 9999/12/31. If these dates are from the data type date, the dates will be converted into the correct format by the backend. But at the moment there is a bug with dates in input fields. That’s why many Visual Composer developers use an input field of the type text (string) instead of the type date, and then there is no conversion in the backend system and the RFC/BAPI dumps. Another example is the language key.  Every user knows that the language key for German is ‘DE’ and for English it is ‘EN’ in the front end client like the SAP GUI. But when SAP started in 1972 they only had two languages: German and English. In the 1970’s the memory capacity of the mainframes was very limited, that’s why SAP stored the language key only with one letter: ‘D’ for German and ‘E’ for English. As time goes by, more and more languages are supported by SAP and the language key was changed into a two letter field. But these are only two examples.  

I hope this demonstration helps you to debug and resolve issues on your own with RFC and BAPI in your Visual Composer applications. This Blog also should show you, that it’s quite easy to become acquainted with ABAP RFC programming, nevertheless which programming language is you’re coming from. The combination of ABAP coding and Visual Composer enables a lot of possibilities in application developing. When there is no BAPI or RFC available from the SAP, just write your own RFC!

That was the last part of my first SDN blog. I hope you enjoy it and that you have learned something new. The whole SDN Blog can also be downloaded from the IBSolution webserver as a PDF file. You can download it the blog here: http://www.ibsolution.de/sdn/msa/SDN_Blog01.pdf

That was my first blog about ABAP RFC and Visual Composer. I hope this was a helpful one for you.

Maybe I have more time in the future for writing another blog or publishing a Visual Composer application in the SAP xApp Analytics – Composite Applications Resource Center.

That was the second part of my first SDN blog. The whole SDN Blog can also be downloaded from the IBSolution portal as a PDF file.
Download the Blog from the IBSolution Portal

Please give me a feedback, so that I can improve my next blog.

Thanks in advance and best regards,

Marcel

To report this post you need to login first.

20 Comments

You must be Logged on to comment or reply to a post.

    1. Marcel Salein Post author
      Hi David,

      It gives me pleasure, that this blog is helpful for you.

      As I started to write the blog, I thought there are so much information and the blog becomes bigger and bigger and more detailed, maybe you can call it now a howto guide. During the publishing I collected a lot of experience about publishing SDN blogs, articels etc. from the SDN Team, maybe next time I will publish it as a howto.

      Thanks for your feedback. I’ glad about further comments.

      Best Regards,

      Marcel

      (0) 
  1. Jรธrgen Ruud
    Hello Marcel,

    thank you for a well written, interesting and a practical webblog.

    Hopefully we will see more blogs on this topic from you! :=)

    Best regards,
    Jørgen

    (0) 
  2. Axel Radack
    Hi Marcel,

    excellent blog! Very interesting example and a real how-to-do guide. Hope we see more from you.

    Quick follow-up question regarding the RFC/Visual Composer implementation.

    I remember that in former releases we played a bit around with VC and what we found really disturbing was the fact that input errors (string value into an numeric field/int field had to be handled all by the backend function module. VC had there not much to offer at all.

    Is this now improved? Performs the new VC version simple input data checks before submitting the data to the RFC (e.g. whether the input data is compliant to the input data types etc.)

    Cheers,
    Axel

    (0) 
    1. Marcel Salein Post author
      Hi Axel,

      thanks. I’m planning a new blog, which will be finished in the next two weeks.

      You are right with the errors of the input fields, that made me crazy in the beginning, but there are some workarounds, so that you can handle that. I hope that these bugs are fixed with the next SPS or next release. I’m sorry that I couldn’t say, if it is improved now, because I don’t know your former release.

      I always realize the checks in the backend system, because there you have more possibilities. Indeed this is a weakness of VC, but I think this will be improved with the next release.

      Best Regards,

      Marcel

      (0) 
  3. John Varughese
    Thanks marcel. I understood the concept of VC through this weblog. Very well written practical guide and good walkthrough for beginners.Expecting more from you.
    (0) 
  4. Shlomi Weiss
    Hi Marcel,

    Thanks for your great blog, it was very helpful.
    One question though, you are talking about modifying master data but your examples are dealing only with texts.

    I’m looking on changing attributes. It doesn’t make sense to go and change the “P” table!

    Thanks
    Shlomi Weiss
    shlomiwhrz@keter.co.il

    (0) 
    1. Marcel Salein Post author
      Hi Shlomi,

      there is also a method with update_static_attributes, but I have no system at the moment to confirm this. With this method you can update master data. For using this method you must pass a table with the structure of the M-table.

      Best Regards,
      Marcel

      (0) 
  5. Nimmi S
    Hi Marcel,

    Great Blog!!! This blog helped me understand how to use VC.

    One question, do u know which class and method to use for creating new master data records.

    Thanks,
    Nirmala

    (0) 
    1. Marcel Salein Post author
      Hi Nirmala,

      you can use the same class method for updating the master data (update attributes static), but you have to check if the record doesn’t exist, because if it exists then the record will be updated.

      Hope that helps!

      Best Regards,
      Marcel

      (0) 
  6. Anthony SCIASCIA
    Hi Marcel,

    I saw you wrote a doc called ‘Analytic Composite Application — Maintaining BI Master Data with SAP NetWeaver® Visual Composer’.

    Could you tell me more about that ?

    Is this a IBS solution that you sell to customers ?

    Thanks

    Anthony

    (0) 
    1. Marcel Salein Post author
      Hi Anthony,

      that’s correct I have developed this application for IBSolution, which sells them as a product. All the ABAP coding is developed in the IBSolution namespace /ISV/. The Visual Composer solution uses some workarounds, so we have decided to redesign the application with ABAP Webdynpro. There is an actual version 2.1 which is sold as ABAP Webdynpro solution. I have quit my job at IBSolution and will work for IBSolution until second July. If you are interessted in buying the product resp. you want to see a live demo via webex you can contact me and I will inform the product management of IBSolution.

      Best Regards,
      Marcel

      (0) 
  7. Hasba Younes
    Hi Marcel,

    is there a solution to allow the users to updated both Master data and Texts in one application?

    in the first part you’ve added a search field, can i also make searches as Marcel*? the result should show all records that begins with Marcel…

    very Good Blog. Just Continue ๐Ÿ™‚

    thanks,

    BR,

    Younes

    (0) 
    1. Marcel Salein Post author
      Hi Younes,

      yes that’s possible. You have to make sure that the characteristic has attributes and texts (you need the m-table and the t-table for the methods). Then you have to call the methods for updating texts

      cl_rsdmd_update_master_data=>update_texts_static( )

      and you have also to call the class method cl_rsdmd_update_master_data=>update_attributes_static( ). If you want to use it for several characteristics you can use the ABAP RTTI for creating dynamic data structures.

      If you want to search with an asterisk you can add a field in VC which passes the search string to the backend. Then you can use the:

      replace all occurences of ‘*’ in l_your_search_string with ‘%’.

      Then all asterisks will be replaced with the wildcard symbol of OpenSQL and you only have to check the sy-subrc to add it with LIKE or EQ to the SQL where condition.

      Hope that help, if not don’t hesitate to ask again.

      Best Regards,
      Marcel

      (0) 
  8. Hubert Horszczaruk
    Hi Marcel,

    great blog! Thanks!

    But I have a question:
    if I wanted to call a BAPI/RFC Function which updates two or more tables in the system at one click (2+ internal tables sent to the BAPI).
    Is is possible? Would you have any hints on how to do it?

    I would really appreciate it… ๐Ÿ™‚

    Thanks in advance for any hint!

    Best regards,
    Hubert

    (0) 
  9. Hubert Horszczaruk
    Hi Marcel,

    I am having another problem, maybe you will know how to solve it.

    We have a dropdown box on the page, which value help is filled by RFC function (data are read from a table). This is fine.
    In the second step we are adding a new entry into this table, which should then appear automatically in this dropdown list of values. But this doesn’t work – we have to click Refresh (F5) button of the browser to get this new value in the dropdown box, but that’s not the way we are looking for.
    Would you have any idea how to solve it?

    That would be really, really nice! ๐Ÿ™‚

    Best regards,
    Hubert

    (0) 
  10. Kiran Kumar
    Thank you for sharing information via this blog! Very useful!.

    When I go to Visual Composer on my BI Portal, I am able to select the SAP_BW system and find the queries/reports on the BW. However, this doesn’t give me the ability to search on Function Modules or BAPIs on BW. To be able to find BAPIs and Function Modules on BW system, I think there has to be a new system defined with system type SAP_R3 on the Portal and use that in VC. Is that true?

    Thanks,
    Kiran

    (0) 

Leave a Reply