Quantcast
Channel: Customer Relationship Management (SAP CRM)
Viewing all 228 articles
Browse latest View live

Internal mode for Attachment creation

$
0
0
For a complete list of all my blogs regarding content management, please seehere.
When I am creating attachment for my business object via code provided in solution:

  ls_prop-name = 'DESCRIPTION'.

    ls_prop-value = 'created by Tool'.

    APPEND ls_prop TO lt_prop.

    ls_prop-name = 'CREATED_BY'.

 

    ls_prop-value = XXX - some one else other than sy-uname

    APPEND ls_prop TO lt_prop.

CALL METHOD cl_crm_documents=>create_with_table

      EXPORTING

        business_object     = ls_bo

        properties          = lt_proproperties_attr     = lt_properties_attr

        file_access_info    = lt_file_info

        file_content_binary = lt_file_content

        raw_mode            = 'X'

      IMPORTING

        loio                = ls_loio

        phio                = ls_phio

        error               = ls_error.

I meet with the error below:Characteristic of class CRM_L_DOC is not valid

clipboard1.png


I debugged a little and found it is caused because the content management code regards "CREATED_BY" field as read only ( protected field ) if internal mode is inactive.

clipboard2.png

clipboard3.png


I use where use list on the field internal_mode and found the FM below could activate internal mode with 02 passed into.

clipboard4.png


clipboard5.png

After I call that FM in my program, the error is gone and attachment could be created. Unfortunately, I still could not specify the created_by field, I find it is always filled as sy-uname in line 298.

clipboard6.png


CL_BSP_WD_MESSAGE_SERVICE VS CL_BSP_MESSAGES

$
0
0


In CRM web client UI we use CL_BSP_WD_MESSAGE_SERVICE to raise message into UI.

clipboard1.png

The service class simply appends the message structure to its internal table.

 

During the final UI rendering phase, the message raised by application code is fetched from internal table of the message class.

clipboard2.png

clipboard3.png

Regarding CL_BSP_MESSAGES, as Thomas Jung has clearly explained here, it has similiar usage as CL_BSP_WD_MESSAGE_SERVICE, that is to queue the message raised by application into its own internal table. However, neither of them are responsible for message display in UI, and the message stored by latter will not be handled by Web client UI component errorview2.htm, so if you have to use your own logic to display the messages.

Just a small example:

clipboard4.png


There is a public attribute message with type CL_BSP_MESSAGES and you can add message as below:

clipboard5.png

It looks not so good compared with the message displayed in the message area handled by CL_BSP_WD_MESSAGE_SERVICE. 

clipboard6.png

Change Attachment property CREATED_BY via code

$
0
0

For a complete list of my blogs regarding content management, please see here.

In our CRM social integration project we extract the picture of one tweet from twitter website  and store them in CRM system as attachment.

We are creating attachment in CRM via the approach described in this blog.

 

However, we found the Create by property for an attachment is always hard coded with sy-uname, even we explicitly specify the created_by property when calling

cl_crm_documents=>create_with_table. However our requirement is it should be filled by the screen name in twitter website who posts the tweet.

clipboard1.png

clipboard2.png

 

After some debugging I found the created_by property could only be modified after the attachment is created.

First I query all attachments of a given tweet:

 

     DATA(ls) = VALUE SIBFLPORB( INSTID = iv_guid typeid = iv_bor_type catid = 'BO' ).

 

     CALL METHOD CL_CRM_DOCUMENTS=>get_info

       EXPORTING

          BUSINESS_OBJECT = ls

       IMPORTING

          LOIOS = LOIOS

          phios = phios.

 

Then I use FM SDOK_PHIO_PROPERTIES_SET to change the property

 

 

  DATA(ls_property) = VALUE SDOKPROPTY( name = iv_attr_name value = iv_new_value ).

 

  APPEND ls_property TO lt_properties.

 

 

  LOOP AT phios ASSIGNING FIELD-SYMBOL(<ios>).

 

       ls_header-class =  <ios>-class.

       ls_header-objid = <ios>-objid.

      CALL FUNCTION 'SDOK_PHIO_PROPERTIES_SET'

        EXPORTING

          object_id = ls_header

        TABLES

          properties = lt_properties

        EXCEPTIONS

          NOT_EXISTING = 1

          BAD_PROPERTIES = 2

          NOT_AUTHORIZED = 3

          EXCEPTION_IN_EXIT = 4.

ENDLOOP.

 

I have put the code into a utility class and test it:

 

clipboard3.png

And that's done:

clipboard4.png

Never forget to activate internal mode, or else you will fail with an error message that created_by field is read only.

clipboard5.png

To BDT or not BDT

$
0
0
ComponentSupport Package
SAP_BASISSAPKB73105
SAP_ABASAPKA73105
WEBCUIFSAPK-73105INWEBCUIF
BBPCRM

SAPKU70204

 

Hi,

 

Recently I was involved in a discussion and in a customer requeriment which required a knowledge I didn't have, BDT.

 

A good starting point what's BDT and how it works is the in the SCN Wiki:

 

Business Data Toolset (BDT) - ABAP Development - SCN Wiki

 

Other recommendation is the SAP Press book:

 

ABAP Objects: Application Development from Scratch - SAP PRESS Bookstore

 

But what's the main problem with BDT? well BDT was meant to extend the BP model, User interface, APIs, etc. from a central perspective, that's really cool but the problem here is the user interface when BDT was designed is based on SAP GUI, as we all know SAP CRM has suffered lots of changes since back then, the whole user framework was replaced by the Web UI, its tools and methodology, so, what now? Well some BDT were replaced by BADIs and  Enhancement points and some others simply not, so the BDT events still working in some scenarios, for example during the maintenance of the BP relationships.

 

Force Child Realtionship(ZZ23REEWRel) when creating Parent(BuilRealtionship)

 

Can we still using BDT? Well I like the concept  "all for one and one for all" enhancing the fronted forgetting about the APIs i think is a very big mistake and with BDT we have this covered, but what about BADIs and Enhancement points? of course if there's a BADI or a Enhancement spot shouldn't be a BDT because SAP should replace it, or because this BADI Enhancement point give us more detail about what we can or can't do and how to do it (the BDT FMs usually doesn't have interface so we need to deal with FG memory, i find this very dangerous as is the path is very open, maybe we don't have the time to really analyze how the stack is working and the real impact of what we performing, IMHO if I lack on documentation I prefer to be restricted by the system architecture/design )

 

All said, I will share with you some tips & ticks:

 

  • To invoke the BDT menu use the code BUPT in SAP GUI
  • In order to trace which events are been called or can be called during a process you can check the FG BDT_MEM_CONTROL searching by the FMs *GET, especially the FM BDT_TBZ1F_GET is the one for reading the FM related to events.
  • Usually BUP*CALLBACK FM will be useful as a bridge to retrieve the "in-memory" data, in order to use them, especially in the BDT scenario, be sure your event is preformed after the standard events/FM which manages the global Memory of the FG  which comprehend the callback FM, one very common example is in the event  DSAVC when the system stores the changes of a relationship in memory the first FRM called the standard FM BUB_BUPR_EVENT_DSAVC once this FM is executed without errors the global variables of the FG will be filled so the FM BUPA_BUT050_CALLBACK will return something. If you place your FM before this one you won't be able to read those values.
  • Analyze, analyze and analyze, take a look to various FM which are placed at the same event which you are enhancing in order to use the correct FM in the correct sequence.


I hope you find this blog helpful.



Cheers!

 

 

Luis


Another way to preview PDF in CRM web client UI with little coding

$
0
0

There is a good blog about how to get PDF preview in CRM web client UI. However several development are invovled in that solution. You have to implement your own ICF node to make PDF displayed in UI, and you have to generate the binary code of PDF by yourself.

 

There is just another approach to achieve the same result but with much less coding by leveraging the standard control "Adobe Interactive form" in ABAP webdynpro. In this way no ICF node implementation, no manual PDF binary code generation, just a few model task.

 

1. Create an form interface in tcode SFP.

clipboard1.png

Choose interface type as ABAP Dictionary-Based Interface.

clipboard2.png

Just create two parameter NAME and SCORE. Activate the interface.

clipboard3.png

2. Create a new form template via tcode SFP.

clipboard4.png

Click "Context"tab, drag the two parameters from Interface to the right part Context ZPF_EXAMPLE and drop there.

clipboard5.png

Click tab Layout, design your form layout. Here I create a caption and two text fields. Bind the data source of the two fields to your form context parameter. Here text field NAME is bound to ZPF_EXAMPLE.NAME and Score field bound to ZPF_EXAMPLE.SCORE.

clipboard6.png

3. Create a new ABAP webdynpro in SE80. A view MAIN will be created by workbench automatically.

Just put a new Adobe Interactive form control into the empty view. You can choose "Insert Element" from context menu and choose "Interactive form"

clipboard7.png

clipboard8.png

Specify the form template name ZPF_EXAMPLE to property "templateSource" created in step2.

clipboard9.png

After that the property "dataSource" is also determined automatically.

clipboard10.png

Click tab "Context", now you should see the two parameters defined in form interface is also displayed in context node of view MAIN.

clipboard11.png

4. Create a new Webdynpro application and assign two parameter NAME and SCORE to it.

clipboard12.png

5. Double click WDDOINIT to implement:

clipboard13.png

The init method will retrieve name and score from application parameter included in url. The url will be populated from CRM webclient UI side.

Till now the development of ABAP webdynpro is finished. You don't care about the PDF generation and display, it will be handled by ABAP webdynpro framework.

 

method WDDOINIT .  data(lo_node) = wd_context->get_child_node( 'ZPF_EXAMPLE' ).  DATA: lv_name type string,        lv_score type int4.  lv_name = cl_wd_runtime_services=>get_url_parameter( name = 'NAME' ).  lv_score = cl_wd_runtime_services=>get_url_parameter( name = 'SCORE' ).  lo_node->set_attribute( name = 'NAME' value = lv_name ).  lo_node->set_attribute( name = 'SCORE' value = lv_score ).
endmethod.

6. The left task would be quite easy for a CRM UI developer:

 

I create a simple view with two input fields for Name and Score, and one hyperlink.

clipboard14.png

The event handler for hyperlink click:

 

DATA: lr_popup    TYPE REF TO if_bsp_wd_popup,        lr_cn       TYPE REF TO cl_bsp_wd_context_node,        lr_obj      TYPE REF TO if_bol_bo_property_access,        lt_parameters TYPE tihttpnvp,        ls_params   TYPE crmt_gsurlpopup_params.  data(lo_data) = me->typed_context->data->collection_wrapper->get_current( ).  DATA(ls_line) = VALUE ihttpnvp( name = 'NAME' value = lo_data->get_property_as_string( 'NAME' ) ).  APPEND ls_line TO lt_parameters.  ls_line = VALUE ihttpnvp( name = 'SCORE' value = lo_data->get_property_as_string( 'VALUE' ) ).  APPEND ls_line TO lt_parameters.  cl_wd_utilities=>construct_wd_url(      EXPORTING        application_name = 'ZADOBEFORM'        in_parameters    = lt_parameters      IMPORTING        out_absolute_url = mv_url ).  lr_popup =  me->comp_controller->window_manager->create_popup(  iv_interface_view_name = 'GSURLPOPUP/MainWindow'                                                                  iv_usage_name          = 'GSURLPOPUP'                                                                  iv_title               = 'Adobe Interactive Form Control' ).  lr_cn = lr_popup->get_context_node( 'PARAMS' ).           "#EC NOTEXT  lr_obj = lr_cn->collection_wrapper->get_current( ).  ls_params-url = mv_url.  ls_params-height = '700'.                                 "#EC NOTEXT  lr_obj->set_properties( ls_params ).  lr_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_plain ).  lr_popup->set_window_width( 700 ).  lr_popup->set_window_height( 700 ).  lr_popup->open( ).

Of course you need to add component GSURLPOPUP via component usage.

 

In the runtime after name and score fields are maintained in CRM UI and hyperlink is clicked, the corresponding PDF will be generated and displayed by ABAP Webdynpro framework.

clipboard15.png

3D tag cloud is also possible via BSP in CRM system!

$
0
0

Actually the code of this example comes from a Thoughworker in China and this is his blog.

I just move his code to a BSP component. Feel free to have a look at his blog directly, in case you understand Chinese

 

Once the bsp application is launched, all the tags will move in an ellipse trace:

 

 

clipboard1.png

clipboard2.png

clipboard3.png

To achieve it you just need a BSP component with a simple view:

clipboard4.png

paste the html source below to main.htm:

 

<%@page language="abap"%><%@extension name="htmlb" prefix="htmlb"%><script type="text/javascript" src="test.js"></script><div id="tagCloud"><style type = "text/css">  #tagCloud {    height: 300px;    width: 600px;    position: relative;    margin: 0;    overflow: hidden;
}
#tagCloud a {    position: absolute;    text-decoration: none;    color: #0B61A4;    text-shadow: #66A3D2 1px -1px 1px;
}</style>    <ul>        <li><a href="#">ABAP</a></li>        <li><a href="#">BSP</a></li>        <li><a href="#">Webdynpro</a></li>        <li><a href="#">RFC</a></li>        <li><a href="#">Interaction Center</a></li>    </ul>    <script type="text/javascript">          var tagCloud = new JsTagCloud({ CloudId: 'tagCloud' });          tagCloud.start();    </script></div>

 

Note:

a. define an CSS ID selector "tagCloud". It is used as the container for all tag clouds. Specify a default width and height. Set position property to relative.

b. define an CSS class selector for tag cloud. The position is set as absolute, as we will change X and U coordinate of tag cloud elements by Javascript.

 

Create an text file locally and paste the javascript code below into it:

 

function JsTagCloud(config) {    var cloud = document.getElementById(config.CloudId);    this._cloud = cloud;    var w = parseInt(this._getStyle(cloud, 'width'));    var h = parseInt(this._getStyle(cloud, 'height'));    this.width = (w - 100) / 2;    this.height = (h - 50) / 2;    this._items = cloud.getElementsByTagName('a');    this._count = this._items.length;    this._angle = 360 / (this._count);    this._radian = this._angle * (2 * Math.PI / 360);    this.step = 0;
}
JsTagCloud.prototype._getStyle = function(elem, name) {    return window.getComputedStyle ? window.getComputedStyle(elem, null)[name] :            elem.currentStyle[name];
}
JsTagCloud.prototype._render = function() {    for (var i = 0; i < this._count; i++) {        var item = this._items[i];        var thisRadian = (this._radian * i) + this.step;        var sinV = Math.sin(thisRadian);        var cosV = Math.cos(thisRadian);        item.style.left = (sinV * this.width) + this.width + 'px';        item.style.top = this.height + (cosV * 50) + 'px';        item.style.fontSize = cosV * 10 + 20 + 'pt';        item.style.zIndex = cosV * 1000 + 2000;        item.style.opacity = (cosV / 2.5) + 0.6;        item.style.filter = " alpha(opacity=" + ((cosV / 2.5) + 0.6) * 100 + ")";    }    this.step += 0.007;
}
JsTagCloud.prototype.start = function() {    setInterval (function(who) {        return function() {            who._render();        };    } (this), 20);
}

 

Then import it via context menu->Create->Mime Object->Import:

clipboard6.png

In the javascript we first get the radian of each tag cloud element, and change its X and Y coordinate, that is left and top property based on calculation on it from time to time( in 20 millisecond's interval ). The same logic is done on font size, the opacity and Z-Order index so that we got a Pseudo 3D effect: the more the element is near to us, the bigger and more vivid it is, and vice visa.

SAP Fiori apps for SAP CRM: hands-on

$
0
0

SAP Fiori is everywhere these days. If you don't know what it is, I'd recommend to go through a few blog posts available here on SCN (non exhaustive list):

What is SAP Fiori

Fiori arrives - first impressions and thoughts

What is SAP Fiori? Maybe it's more than you think

SAP Fiori Wave 2 is here - so what's new ?

 

To sum it up very quickly Fiori allows end users to access some "transactions" from their mobile phone, tablet or desktop with the same user experience. All you need is a browser recent enough to display HTML5. As a SAP CRM consultant I wanted to give it a try and see what we can get with those ~10 apps dedicated to sales representatives... And the good news is: a few weeks ago I noticed this big orange button on http://marketplace.saphana.com/Line-of-Business/Sales/SAP-Fiori/p/3570 to try Fiori for free!

pict1.png

In fact this button never worked for me: I was just directed to a page asking me to actually buy the whole package... So I contacted someone from SAP support, who asked me to contact someone else who knew the guy that heard someone tried Fiori etc. (you got my point :-) But in the end I could finally get the links I was looking for (thank you Mr. Enrique Espinosa):

www.sap.com/natrysapfiori (americas)

www.sap.com/emeatrysapfiori (emea)

 

If you click on one of those links (depending on your location) and enter promotion code TRYFIORI during checkout, you'll be able to download everything you need to install SAP Fiori applications on your CRM system to test it during 45 days for free.

 

That's what I did, except that I didn't have any CRM7.0 EhP3 (minimum required) available. So I created a virtual machine on my laptop running Win7 64bits, with 8Go RAM and 120Go free hard drive. I must admit that the installation process went quite smoothly until I had to download support packages: can you believe that you need someone to "approve" your download basket via Solution Manager? I'll probably write another blog post about it because obviously I didn't need to install SolMan to complete my installation, however I did had to contact a friend with a valid user on SolMan to be able to download the needed files from SAP Service Marketplace (which makes me think that this is a cra**y piece of software otherwise SAP wouldn't have to force people to use it).

 

Anyway, now it's working fine so I began to create a series of video showing what it looks like. I'll update this blog post as soon as new videos are ready to go so don't forget to click the "follow" button or "receive email notifications" on the right hand side of the page if you want to get notified when new stuff is out :-)

Video 1 >> SAP FIORI for CRM: Getting started

Video 2 >> SAP FIORI for CRM: My appointments

Video 3 >> SAP FIORI for CRM: My appointments app vs WebUI calendar

Video 4 >> SAP FIORI for CRM: My accounts

Video 5 >> SAP FIORI for CRM: My tasks

Video 6 >> SAP FIORI for CRM: My opportunities

 

Enjoy!

PS: for the record after everything was up and running, I downloaded the following OSS notes to fix a few bugs:

1878995    LPD: Display of further attributes in LPD_CUST

1907696    New synchronization functions in the launchpad

1927493    Mapping Formats are saved inconsistently

1928317    News Tile Drill Down image correction

1929563    ACE Checks for Contacts and Accounts

1930670    BP_SRV: Runtime error GETWA_NOT_ASSIGNED in FSBP_CNS_TYPE_HA

1930684    KPIs for Account FactSheet not available

1930800    Performance improvement 'resolvelink'in INTEROP Service

1930931    My Leads: Filtering the Search Results

1931051    SAPUI5 upgrade to version 1.16.4

1931635    Hotfix for UI AddOn 1.16.4 SC: UI2_SRVC

1931654    UI2_FND (SP06): Improving performance of Fiori Startup Page

1933579    UI2_FND, UI2_700 (SP06): Improving performance of UI2 Intero

1939288    Hotfix for UI AddOn 1.16.5

Cloud for Customer Integration with ERP and CRM: How-to Guides

$
0
0

In a previous blog postE-Learning for Integration of SAP Cloud for Customer with SAP ERP and SAP CRM we shared elearning and recorded demo links for integrating SAP Cloud for Customer (C4C)  with SAP ERP and SAP CRM.    The elearning and demos describe how the integration works.  The intent of this blog is to share some new how-to guides on how to implement the integration.

 

At https://service.sap.com/cloud4customer you can access all the integration guides.   The following integration guides are on SMP:

  • C4C integration with ERP using SAP NetWeaver PI
  • C4C integration with ERP using SAP HANA Cloud Integration
  • C4C integration with CRM using SAP NetWeaver PI
  • C4C integration with CRM using SAP HANA Cloud Integration

 

In addition to the integration guides, we now have How-To guides that will walk you through specific configuration with screenshots.     Here are the new guides with a brief description of what they cover:

 


Webclient UI vs ABAP webdynpro: performance loss in BOL / Genil Layer discussion

$
0
0

For several CRM projects in China which I am involved, I found the partner have chosen ABAP webdynpro when custom development is necessary. When asked why they do not consider webclient UI as the first choice, they argued that "Webclient ui is slower than ABAP webdynpro." or "the performance of Webclient UI is bad compared with ABAP webdynpro, since it has additional layers as BOL and Genil". From my point of view, such conclusion without concreate performance benchmark does not make too much senses.


clipboard1.png

Let's do not consider what we can benefit from webclient ui framework( for example better achitecture, cleaner code, better Maintainability, consistent session magement, consistent navigation management etc ) for the moment. I would like to figure out what is the percent of performance loss caused by additional layers introduced in webclient UI framework - the BOL and Genil. So I made the following performance testings.

 

Test Preparation

I have created one webclient UI component and one ABAP webdynpro component. Both have the exactly the same functionality:

 

1. Click search button to get several BO instance ( Social post) in result table. I choose the new Genil model named CRMSM delivered in CRM7.0 EHP3, as the structure of it is quite simple.

2. Click post ID hyperlink of one search request row, then we can navigate to detail page.

3. Click Edit button in detail page to switch to change mode, make some changes on post content, click save button to persist the change.

 

In the webclient UI component, I ensure that the view controller only calls methods defined in BOL interface, like cl_crm_bol_core~query and modify, cl_crm_bol_entity~set_property and get_property, and if_bol_transaction_context~save. In ABAP webdynpro component, I directly call the lower layer function modules SOC_POST_SEARCH, SOC_POST_MODIFY and SOC_POST_SAVE in view controller method.

 

The ABAP webdynpro search page:

clipboard2.png

CRM webclient UI Search page:

clipboard3.png

ABAP webdynpro detail page:

 

clipboardd.png

Webclient UI detail page:

clipboard5.png

Test using STAD


Then I compare the response time of both application via STAD. Below is the performance data of Search button click. We observed the memory consumption of webclient UI component is almost twice than ABAP webdynpro. This makes sense since webclient UI framework needs additional memory to store the model metadata in the runtime and also for objects necessary for BOL / Genil framework processing.

clipboard6.png

And this is the performance data of post ID hyperlink click. Here webclient UI is slower than ABAP webdynpro, however the absolute time is less than 1 seconds, which does not make too much difference from end user point of view.

clipboard7.png

This performance data is for Edit button click. Again webclient ui is slower, total time less than 1 seconds.

clipboard8.png

This is for save button click:

clipboard9.png

Test using SAT


From this rough test, we are still not clear about what is the exact performance loss caused by the additional layers in webclient UI compared to ABAP webdynpro. So I plan to SAT to do more accurate performance testing using the following categories. I choose three Genil Models in CRM, the technical name of the model is CRMSM, PROD and BT accordingly. I want to know the percent of execution time spent in BOL & Genil layer compared with the total execution time of Search, Modify and Save. ( Category Modify means the property of a Genil model node is only changed in buffer. The change will not persisted into database until save call is performed ).

clipboard10.png


o(x): Additional Layer overhead of a given BOL model x

f(x): absolute execution time spent in BOL and GenIL layer

a(x): absolute execution time of application API


I have written the following report to perform Social post search via cl_crm_bol_core~query. Then I can get the exact time spent on a(x)|x=CRMSM and calculate the o(x)|x=CRMSM.

 

 

REPORT  ZSAT_POST_SEARCH.

PARAMETERS: po_id type socialdata-internal_id,

            maxhit type i.

DATA: lo_core               TYPE REF TO cl_crm_bol_core,

      lo_collection         TYPE REF TO if_bol_entity_col,

      lo_root_entity        TYPE REF TO cl_crm_bol_entity,

      lv_view_name          TYPE crmt_view_name,

      lv_query_name         TYPE crmt_ext_obj_name VALUE 'PostSearch',

      lt_query_parameter    TYPE crmt_name_value_pair_tab.

START-OF-SELECTION.

  SHIFT po_id RIGHT DELETING TRAILING space.

  IF po_id NE space.

    DATA(ls_query_parameter) = VALUE crmt_name_value_pair( name = 'INTERNAL_ID' value = po_id ).

    APPEND ls_query_parameter TO lt_query_parameter.

  ENDIF.

  IF maxhit EQ space.

    maxhit = 100.

  ENDIF.

  ls_query_parameter = VALUE #( name = 'MAX_ROWS' value = maxhit ).

  APPEND ls_query_parameter TO lt_query_parameter.

  lo_core = cl_crm_bol_core=>get_instance( ).

  lo_core->load_component_set( 'CRMSMT' ).

  lo_collection = lo_core->query(

      iv_query_name               = lv_query_name

      it_query_params             = lt_query_parameter

      iv_view_name                = lv_view_name ).

  DATA(lv_size) = lo_collection->IF_BOL_BO_COL~SIZE( ).

  WRITE:/ 'Number of ' , lv_size, ' Posts has been found!'.

 

 

Here is the result for Social post search:

clipboard12.png

clipboard13.png

Total execution time of post search: 934 milliseconds

 

Overhead in Additional Layer: 218( spent on component set loading) + ( 634 – 234 – 289 ) = 329 ( 35% in total time ).

Considering that the component set load will only be performed once in the application lifetime, and it would be further improved by using share memory to store model metadata, so I do not regard the time spent on component set loading as overhead. As a result, the final overhead is 329 - 218 = 111 milliseconds, that is 12% of total time.

 

 

Post Modify test:

clipboard14.png

 

Total time in Post Modify: 55

 

Overhead in Additional Layer : 55 – 53 = 2 ( 3.6% )

 

Post save:

clipboard15.png

 

Total time in Save & Commit: 13 + 6 = 19

Overhead in Additional Layer : (13 – 12) + ( 6 – 3 ) = 4 ( 21.1% )

 

Product Search:

clipboard16.png

clipboard17.png

 

Total execution time: 2348 milliseconds

 

Overhead in Additional Layer : 896 – 348  = 548 ( 23.3% )

 

Product Modify:

clipboard18.png

 

Total execution time: 58

 

Overhead in Additional Layer: 58 – 52 = 6 ( 10.3% )

 

Product Save:

clipboard19.png

 

Total time in Save & Commit: 282 + 263 = 545

 

Overhead in Additional Layer : (282 – 280) + ( 263 – 41 – 97 ) = 127 ( 23.3% )

 

Note: 97 milliseconds spent on program SAPMSSY4 should be deducted since it contains the execution of routines registered on COMMIT, such as middleware logic, the workflow event, update function module etc. Those are nothing to do with BOL & Genil framework processing.

 

Sales Order search:

clipboard20.png

clipboard21.png

 

Total execution time: 1160 milliseconds

Overhead in Additional Layer : 658 – 608  = 50 ( 4.3% in total time )

 

Sales Order modify:

clipboard22.png

clipboard23.png

 

Total execution time: 105

 

Overhead in Additional Layer : 105 – 93 = 6 ( 11.4% )

 

Sales Order save:

clipboard24.png

clipboard25.png

clipboard26.png

Total time in Save & Commit: 6202 + 354 = 6556

Overhead in Additional Layer: (6202 – 6199) + ( 354 – 24 – 175 ) = 158 ( 2.4% )

 

Conclusion

 

The testing result about overhead percent for the three Genil Model could be found in below graph:

clipboard27.png

clipboard28.png

 

clipboard29.png

According to the formula, the more complex the application API is, the less performance loss caused by additional layer overhead in Web client UI. Also in reality, the performance bottleneck resides in application API, not in the call stack of BOL & GenIL delegation. So in my opinion, performance reason should NEVER be used as the excuse when you do not use Webclient UI as the first choice for custom development in CRM.

 

Please kindly let me know your opinion on this topic. Thank you very much!

Issue lists of using ABAP Webdynpro in CRM UI

$
0
0


Background of this blog


The reason to write the blog is recently we found that in several CRM projects in China, the ABAP Webdynpro is wrongly chosen by local partners as custom devopment UI technology, which has caused several issues after project is on line and led to huge maintenance effort. Many partners choose ABAP Webdynpro because they are more familiar with it and they consider Webclient UI has performance issue compared with ABAP webdynpro.


in my previous blog Webclient UI vs ABAP webdynpro - performance loss in BOL / Genil Layer discussion I made some performance discussion regarding CRM Webclient UI and ABAP webdynpro and finally my conclusion is when talking about CRM custom development, we should always stick to Webclient UI technology and avoid the ABAP webdynpro if possible.


In this blog, I will try to collect issues if ABAP Webdynpro is unfortunately used in CRM application. Feel free to raise your parts, if they are not mentioned here


Issue list

Some of the issues described here do not immediately make the application stop working, but can lead to potential issues in the future, make the application unstable, or cause inconsistent user experience for end users. All of these inconsistency makes your application really inprofessional.


Back Button

in CRM UI, there is a Back button in top right part of window, and UI developers could implement page navigation and back ( so called breadcrumb )  by implementing respective methods defined in Component Workbench.

clipboard1.png

Of course this is not available for ABAP webdynpro components. After ABAP webdynpro component is integrated CRM UI, end user would see two Back buttons - the red one is CRM standard one, and the green one is developed by developers on their own.

clipboard2.png

The issues would be:

These two buttons will make end user confused.

Additional effort must be paid to implement the back button function by developers.

It is technically impossible to register an ABAP webdynpro UI component to CRM Breadcrumb framework, so when the red button above is clicked, end user will not return to the expected search view, but to home page instead. This makes sense, since CRM Breadcrumb framework does not recognize the ABAP webdynpro component at all.


Data loss handling

in CRM webclient UI, you can follow the wiki to implement data loss. The steps are quite simple, as most of tasks are done by UI framework.

When you make some changes on UI without save and plan to navigate to other UIs for example by clicking other work center in the left navigation bar, the data loss dialog will be popped up automatically.


clipboard3.png

It is difficult to implement data loss scenario in ABAP webdynpro(See SCN discussion here). Developer have to take care the logic how to detect the ABAP webdynpro UI element is changed, which has already been done by CRM UI framework. Developers have to write lengthy and dirty code to achieve it.

The toggle between display and edit mode

In Webclient UI framework, the edit button plus switching all editable UI elements to edit mode is quite simple:


 

  method EH_ONEDIT.

    DATA:   lr_entity             TYPE REF TO cl_crm_bol_entity.


    lr_entity ?= me->typed_context->socialpost->collection_wrapper->get_current( ).


    CHECK lr_entity IS NOT INITIAL.


    IF lr_entity->lock( ) EQ abap_true.

      me->view_group_context->set_all_editable( ).

    ENDIF.

  endmethod.

The task to switch the element into edit mode is done by method set_all_editable.

However, in ABAP webdynpro you need to do all of these tasks by yourself: The read only properties of all editable UI elements must be bound to a new context attribute POST_LOCKED, and you also need to set the content of that attribute every time the object is locked or unlocked.

clipboard4.png

clipboard5.png

Session issue

For example, when we log on to CRM system via a business role:

clipboard6.png

use tcode SM04, we observed there is only one user session for the current UI:

clipboard7.png

When we go to the integrated ABAP webdynpro page:

clipboard8.png

Go to SM04 again, we can observe there is a new user session generated for ABAP webdynpro, which means the ABAP webdynpro UI resides in a different user session, whereas the left CRM UI page in the original user session.

clipboard9.png

The technical session isolation makes it difficult to exchange data between ABAP webdynpro UI and CRM webclient UI, as they are residing in two different user sessions.

clipboard10.png

if you need to pass data from CRM UI page to embedded ABAP webdynpro UI, One approach is to define the parameters in ABAP webdynpro applications, fill those parameter in CRM and populate the URL containing the passed parameter via cl_wd_utilities=>construct_wd_url:

clipboard11.png

clipboard12.png

However, this approach is not appropriate to pass large amount of data like internal tables. It is also difficult to pass data from ABAP webdynpro back to CRM UI. What's more, careful coding is necessary to ensure a consistent transaction state.


Inconsistent configurability

 

By clicking the configuration icon, we can directly enter configuration mode to make adaptations on UI layout:

clipboard13.png

clipboard14.png

clipboard15.png

When an ABAP webdynpro is displayed, the configuration icon is still enabled.

clipboard16.png

However, since it makes completely no sense to configure an ABAP webdynpro component via Webclient UI framework, once the icon is clicked,

We only get one notification saying currently no UI part is configurable.

clipboard17.png

ABAP webdynpro UI component configuration has a different development mechanism than Webclient UI. The coexistence of both leads to an inconsistent configuration experience for the end user.

clipboard18.png

Location of message area

The message raised in ABAP webdynpro via message manager will appear by default on top of the application UI page,

clipboard19.png

Whereas in CRM Webclient UI, the message appears in the right top of the UI framework, and the message text could also be collapsed or expanded by the small triangle.

clipboard20.png

Put the mouse onto the message text, then the technical information of the message could be displayed as tooltip, which is not available for the message raised by ABAP Webdynpro.

clipboard21.png

Incorrect use of underlying layer API

Let's review the benefit of using Webclient UI framework:


 

  • The object oriented BOL API is simple, generic, uniform and easy to use.
  • Your UI components are decoupled from any interface changes in the underlying application specific APIs, it is even not necessary for you to know the detail of underlying API at all; Your application is easier to maintain and sustainable for future development
  • Development of WEBCUIF applications is made easy, since the BOL has been designed to work hand in hand with the UI parts of the framework
  • The built-in buffer accelerates your applications: Once data it is read, the Object is buffered and could be retrieved in nearly no time. Way faster than calling various function modules again and afterwards preparing the data for business use.

 

so if you choose ABAP webdynpro, you will lose all of these benefits: Your UI component would bypass the BOL & Genil Layer and directly struggle with the underlying API.

clipboard22.png

When I am supporting customer on site customer has complained to me about the "poor quality" of FM CRM_ORDER_MAINTAIN. They directly call this FM in their ABAP webdynpro view controller and complain it does not work as expected. After investigation in their system with quite a time, finally I find it is caused by the inproper importing parameters passed in. Such issue could have been avoided if using BOL API in UI layer - you just need to fire the very simple and generic BOL API and all left things like interaction with the complex underlying API will be handled by Genil implementation. Such UI component will them be easier to maintain and more robust.


Conclusion


When you plan to fulfill the customer requirement by developing ABAP webdynpro and integrating them into CRM UI( via transaction launcher), please always think twice whether it is really necessary. If you decide to do this, you have to confront with all troubles described in this blog. Please kindly raise your findings, if it is not included in this blog


ANST: a new tool to help customers help themselves

$
0
0

Can you imagine a new way to get support from SAP, without the need to search for notes in SMP or opening an incident because you can’t find a code correction for a specific error?

 

With this opened question we started our presentation on “Automated Note Search Tool” (ANST) during the ASUG Ontario Chapter last November. The reaction from the audience was “It sounds great!!”, and it really IS great.

 

As you may know, ANST is new approach to help out customer searching for notes and also for troubleshooting and root-cause analysis for of any SAP related issue within ABAP environments.

 

The fact you don’t have to identify keywords to do the search in SMP or double-check if you can or can’t implement a note, makes ANST a very powerful tool for our customers, saving them time and eliminating re-work.

 

If it won’t be enough, customer does not have to wait for an SAP Engineer to review and provide feedback about a known bug. Check out the following diagram for the complete work flow revolutionized by ANST:

Blog #2.png

 

The tool was not only for note searches but also about customer code and customizing tables and how following this simple process makes the difference, saving time and efforts they would have otherwise have to spend in an incident/message.

 

It was an amazing experience to get in touch with our customers and show them life demos where they can validate how this tool works and how their work (and life) can be easier. If you want to learn more about ANST please take a look at the following videos ANST @CRM and ANST @ECC.

SAP UI5 and Data Binding in CRM - An Overview

$
0
0

About UI5 for Beginners

   

     SAP UI5 run time client side HTML5 rendering library with a rich set of standard and extensive controls. Used in developing lightweight business application which runs multiple background across devices such as desktops, mobiles, smartphones, tablets. Based on extensive JavaScript, it supports RIA (Rich Internet Applications). Initially named in as a'Phoenix Project' then evolved into SAP UI5.

 

Principles

  1. Any screen on any device,
  2. Cutting-edge controls,
  3. Powerful theming and branding,
  4. Efficiency and Performance.

 

1. Any screen on any device - Flexibility in adapting new technology across multiple devices. List/Table views flexibility in designing screens. Supporting RIA like client-side features based on JavaScript.

2.Cutting-edge controls - Focused on user-experience. Supports extensibility concept for business relevant controls such as Calendar, Charts and Index to extend the current functionality.

3.Powerful theming and branding - Easily customizable themes which supports CSS5, which adapts themes to brand in an effective manner. SAP UI5 tools integrated into Eclipse supports in creating and modifying themes with an enhanced CSS editor and application preview capabilities.

4. Efficiency and Performance - Fully supports SAP product standards including security globalization, accessibility and performance. Allows usage of own JavaScript and HTML.

 

Browser Support

     Safari,

     Internet Explorer,

     Mozilla Firefox,

     Opera,

     Chrome browsers support the web tool.


Data Binding


     Model View Controller architecture is used in binding the data between request and response of the system. Binding modes can be of one-way or two-way.

Example: Updating relationship and synchronization of calendar utilities.


Model Implementation


     SAP UI5 can be implemented through JSON, XML, ODATA models.


JSON Model

 

     Implementation of JSON has a slight edge over other models since it uses a REST interface. REST is a web application interface model through which the client communicates with the server by modifying the state of resources through representations. This interface manipulates the state of resource oriented decomposition of business processes.

 

CRUD Application and ICF service based on REST and JSON configurations are provided in the development toolkit references. Implementing the REST service using model and DDIC objects and CRUD methods will summarizes the response of the web service.

 

*CRUD - Create, Read, Update and Delete methods

*REST - REpresentational State Transfer

*ICF - Internet Communication Framework

*JSON - JavaScript Object Notation



Attachments


     1 - Web Service request

     2 - Response from the server.

SAP CRM Middleware Monitoring – Basics

$
0
0


CRM Middleware integrates various data producers both SAP and Non-SAP systems with the SAP CRM landscape.

This document gives you a basic introduction on middleware monitoring on erred BDOCs and reprocessing it to clear the queues. Document restricted in finding the queue names and error segments of the BDOC. Hope this document serves the purpose at some point of time. Thanks and happy reading. Feedbacks are welcome!.




Step1: Start SMW01 with the following settings.

        

     Choose ‘Errors’ in ‘Bdoc State’.

     On execution, BDOCs with mistakes can be seen.S1.png

Relevant BDOCs for monitoring at a particular customer were the following


BUPA_MAIN                      Contains the master data of a business partner (triggered on creation and change of a business partner)

BUPA_REL                        Used when you create a relationship between two business partners

PRODUCT_MAT                Used for data exchange of products/materials

CRM_EQ_DMBDOC           Used for data exchange of equipments

BUS_TRANS_MSG            For data exchange of transactional data

 

Step2: Selecting the particular row of the BDOC with error and click on the extensive data button.S2.png


Step3: Extensive error data segments.

           S3.png

Step4: Data error segments further navigate into segments in details.     S4.png

           

Step5: Number ranges for contact persons are different in CRM and R/3 systems. For customer the business partner number is the           same in both CRM and R/3.


Lookup for Business partner (Customer/Contact Person/Employee)       BP

Lookup for Customer in R/3                                                                 XD03

Lookup for a Contact Person                                                               VAP3


Step6: In order to know who created, for example a business partner in SAP CRM, you can look up this information in table BUT000 via transaction SE16.


Step7: Using transaction SU01/SU01D we can see who the user is.


Step8: Reprocess the BDOC is necessary to further send/receive the data segments.


Cheers,

Vivek Raj Kumar M.


Condition with zero rate

$
0
0

After appying below support packages, or SAP Note 1884286 into the CRM system, you will see the condition with rate "0" being activated in a CRM transaction. Before that, the condition is marked as inactive if its rate is zero.

 

BBPCRM700SAPKU70014
BBPCRM701SAPKU70111
BBPCRM713SAPKU71302
BBPCRM702SAPKU70209
BBPCRM712SAPKU71204
BBPCRM500SAPKU50024
BBPCRM600SAPKU60015

 

Due to this change, depends on the used pricing procedure's settings, below symptoms may occur:

- A non-static condition (class B) with proper rate is set to inactive

- The item's net value becomes zero.

- Item's net value is changed to a unwanted value if a new pricing is executed.

 

Now, there is a new SAP Note 1968594 created to make the system behavior customizable based on the client’s business scenario. After applying this note, the client can control whether the condition with zero rate should be set to active with parameter “KEEP_ZERO_PRICE”. More detailed information can be found in the note.

How to quickly locate the code where the error message is raised for Business Transaction Application

$
0
0

 

In my blog "Six kinds of debugging tips" Fabian Geyer raised a very good point about the trouble during ERP Application trouble shooting.

Let me just quote his good statement:

 

"Several ERP applications (esp. Financials) often use a "message collector" technique especially when handling "multiple objects", where after the application ist "detecting" an error it will be "stored" to an "error collection" and after all checks have been done the list of maybe many erros is shown in a popup or list.


In these cases, when the message is "shown" is far to late to analyze, because the application data/situation which is causing the error is analyzed somewhere else (far earlier in the runtime). In these cases I often use breakpoints in FM "MESSAGE_STORE".

 

Similar handling is needed in case the BC Application Log-technique is used (SLG0, SLG1 etc.) a breakpoint in FM BAL_LOG_MSG_ADD can help. "

 

Actually in CRM application the error message handling logic is the same. Let me just use the example of Service Contract processing as example:

 

How to find the code where the nessage CRM_ORDERADM_I with number 505 is raised?

clipboard1.png

Approach1: Use the source code scan


For more details about how to use source code scan, please refer to my previous blog.


When I am using this approach to write the blog, it just took me several minutes to find the exact code position.

 

First we use the source code scan tool ( search keyword = 505) to find the constant ITEM_TYPE_NOT_FOUND for message number 505,

 

clipboard2.png

Then use the source code scan once again, this time the search key would be "item_type_not_found".

 

We get seven candidates, then just set a breakpoint at each and repeat your scenario.

clipboard3.png


The third one in result above is proven to be the location we are just looking into:

clipboard4.png

Approach2: Use function module BAL_LOG_MSG_ADD

 

 

This tip is suggested by Fabian Geyer and is also very good. Just set a breakpoint on functon module BAL_LOG_MSG_ADD and repeat the scenario in service contract. The breakpoint is triggered( you can observe the FM is now displayed in the top-most of callstack ) and the code position we found this way is just exactly the same as Approach1.

 

In this case the Approach2 is even more efficient than Approach1 to quickly locate the code we look for. Thank Fabian for sharing us such useful tip.

clipboard6.png

Why neither approach works for me? Why the breakpoint is not triggered in my application?

 

Still use service contract for example, the business transaction like Sales Order, Service Order and Service Contract are implemented via so-called One Order Framework. And as clearly described by Fabian which I quote in the beginning of this part, the error detection logic of One Order Framework, in this example is the logic in form DETERMINE_ITEM_TYPE, is ONLY done for the first time the item is inserted. Once an error is found, the respective function module in the function group CRM_MESSAGES will be called to persist the error message. Later on when the erroneous service contract is opened once again, there are no item type check any more, instead the error message is fetched via read function module in the function group and displayed in the UI.

 

clipboard8.png


When I delete one item product in the service contract, the obsolete error message for that item would also be deleted by the corresponding FM CRM_MESSAGES_DELETE.


clipboard9.png

So when I am trouble shooting the error message raised in Business Transaction application, I will either delete the old erroneous item then recreate it, or create a new one from scratch. Of course if we need to do debugging in production system, both could be inappropriate.


In this case if you can ensure that the error message raised in customer production system could also be reproduced in your dev system, then you can still use the tips in this blog to find the position in an efficient way.


The baseline has changed , the CRM experience is evolving !

$
0
0

Less face a fact, the world of customer relationship management is no more just a traditional automatic Happy new year campaign email or a after service survey. Since the beginning of 2012 we have seen a revolution in CRM systems around the world. The focus today is not just about the customers but also on the ease of usability and features to the employees.

 

Phew ! Our systems are very friendly but wait ... did we hear "features" ? Yes features in terms of an applications is a collection of addons which makes the experience more interactive or fun to work with.

 

How great would it feel if my SAP CRM system plans my day automatically after reading my calendar, making a note of my important meetings, missed alerts, closing opportunities, creates a day-wise agenda and mails me the same every morning at 8 AM. Wooohoo !!! " My employees would love this and I can pay anything for such a great feature " , would be the words of a customer. Friends, there are many apps which are providing such features ! Traditional features are considered just a baseline these days.

 

The second thing which a lot of us ( CRM experts ) must have seen now a days are a set of silly kind of requirements ( sounds to us ) like I want to see a list of users in my organizational position who are using the CRM system or online ! ( Trust me, I had this encounter ). " Why do you need this feature ? you have office lync or GTalk for this feature " , were my words to him. "I need to know who I can transfer my service cases for the fastest response and if it's not possible in CRM please let us know as this is very important for us and Sales-force already has a plugin for this" , was his response.

 

Seems legit , isn't it ? Yes it is , at first it sounded useless but the explanation along with the comparison of another product was good enough for me to help him solve this.

 

Every time we tend to refuse for a requirement, just because we have no idea of how it can be done kills the trust ! Still there are situations which cant be implemented at all. One of my customers asked for providing him an auto-complete features in text boxes on CRM Web-UI, which simply was not possible due to the data throughput it will put on the system but we let him know about a work around which was accepted by him. Bottom line : "We just should not close an impossible requirement with a NO, provide an alternate solution". Trust me when you talk in business terms with the customer, the relation builds stronger and the trust grows.

Useful SAP Middleware transactions

$
0
0

SAP CRM Middleware uses Business Document (BDoc) messages when transferring data between systems.

 

Sometimes problem during the replication requires monitoring the Middleware. SAP offers standards tools to monitor BDoc errors messages in the system. The most used transaction is SMW01 (Display BDoc messages) accessed via menu path Middleware>Monitoring>Message Flow>Display BDOC Messages. However there are other useful transactions in the system.

 

 

Middleware Common Transactions

When checking Middleware problems, a review of configuration is necessary. The following transactions are useful.

 

CRM Generation

SMOGTOTAL

Generate required objects for CRM Replication

GENSTATUS

Check Status of Generation Jobs                    

SMOGIND

Generate Industry Specific Objects

SMQR

qRFC Monitor/ Register CSA Queue

SMOHQUEUE

Queue demon

 

 

CRM Connectivity

SALE

Define Logical system

SM59

Configuration of RFC Connections

SMOEAC

Administration Console

 

 

ERP Connectivity

SMQ1

Outbound Queue

SMQ2

Inbound Queue

SALE

Define Logical system

SM59

Configuration of RFC Connections



CRM Replication Setting

R3AC3

Adapter object overview (replication filter for customizing objects)

R3AS

Start Initial Load

R3AM1

Monitor replication status

R3AC1

Adapter Object Overview

 

 

Troubleshoot BDoc Replication

 

When a BDoc is not replicated successfully, is necessary to check the logs and understand the reason that causes the problem.

The following transactions are useful:

 

SMW01

Display BDOC Messages

SMW02A

BDoc Message Error Analysis: Sum of Errors

SMQR

qRFC Monitor

SMQ1

Outbound qRFC Monitor

SMQ2

Inbound qRFC Monitor

SMWP

CRM Middleware Monitoring Cockpit

SMWT

Middleware Trace

SMOHQUEUE

Monitor R&R Queues

SMO8REORG

Delete Processed BDocs

SMW03

Show stats of unproc. BDoc messages

SMW19

Copy BDoc and process

SMW20

Process BDocs

SMW3RBM

Convert BDoc Messages to XML

SMW3RC

BDoc Message Error Recovery

SMW3WD

Watchdog for failed BDoc Messages

 

Tx SMW02A “BDoc Message Error Analysis: Sum of Errors”

 

This transaction is useful to get a detailed error message for “BDOC type”. That allows summarising all errors founded in the system.

 

BDOC error analaysis.png

The result list not only show the “Bdoc Type” but also the component affected that is useful information when researching SAP Notes that could give any indication of the reason for the error.

 

BDOC Summary of errors.png

 

When pressing button “Detail Analysis” system navigate automatically to transaction “SMW01 Display BDOC Messages” and displays the BDocs Message affected.

 

press detail analysis button.png

 

smw01.png

 

 

Tx SMO8REORG “Delete processed BDocs”

 

This transaction allows deleting BDocs logs from the system. It could be run in a test mode and filtered by BDoc Type, BDoc Message ID, User or change date/time. Cleaning the log will allow users to focus on unresolved system issues.

 

Delete BDOCS.png

 

In summary, middleware problems are usually based on configuration. Always have a look not only to the middleware configuration but also to the component configuration.  Using monitor tools, issues in more detail could be checked and knowing the "Application Component", a better filter could be used when looking for SAP Notes.

CL_BSP_WD_MESSAGE_SERVICE VS CL_BSP_MESSAGES

$
0
0


In CRM web client UI we use CL_BSP_WD_MESSAGE_SERVICE to raise message into UI.

clipboard1.png

The service class simply appends the message structure to its internal table.

 

During the final UI rendering phase, the message raised by application code is fetched from internal table of the message class.

clipboard2.png

clipboard3.png

Regarding CL_BSP_MESSAGES, as Thomas Jung has clearly explained here, it has similiar usage as CL_BSP_WD_MESSAGE_SERVICE, that is to queue the message raised by application into its own internal table. However, neither of them are responsible for message display in UI, and the message stored by latter will not be handled by Web client UI component errorview2.htm, so if you have to use your own logic to display the messages.

Just a small example:

clipboard4.png


There is a public attribute message with type CL_BSP_MESSAGES and you can add message as below:

clipboard5.png

It looks not so good compared with the message displayed in the message area handled by CL_BSP_WD_MESSAGE_SERVICE. 

clipboard6.png

Step by Step to create web service in CRM UI and consume it in ABAP- Part1

$
0
0


In this blog I will create a web service which is exposed via Genil model PROD in CRM web client UI and consume it via a simple ABAP program.

 

Create web service in CRM Webclient UI

 

1. log on CRM Web ui with business role SERVICEPRO, work center Service Operation, Create a new Web service:

 

Choose Material as Business Object, choose Product/Individual Product as Component, Product as Root object.

Mark check box Read, Create and Change.

clipboard1.png

Click the new button to also create a webservice operation which is implemented via the query object of Genil model

clipboard2.png

Click new button:

clipboard3.png

2. in step2 of the creation wizard, simply click select all to ensure all attributes in Genil model PROD are involved in the web service.

clipboard4.png

click Confirm Selection to continue.

clipboard5.png

3. in step3, it is allowed to specify certain fields as read only.

clipboard6.png

4. In final step of wizard, we can specify the security profile of created web service. The differences of the two can be found in the chapter when we talk about how to consume the web service. In this blog I choose BASIC as security profile.

clipboard7.png

Click Activate button and then click Productive button in toolbar. Now we have finished the creation and the webservice PROD_WS is ready to be consumed.

clipboard8.png

Create new binding for Service Definition PROD_WS

 

use tcode SOAMANAGER, click Web Service Configuration.

clipboard9.png


Search by object name = PROD_WS:

clipboard9.png

Select search result and click Create Service button:

clipboard10.png

Specify Service name and Binding name:

clipboard11.png

Select SSL as Transport Level Security

clipboard12.png

If you select SECURE as security profile in web service creation step, the Authentication Level will be Strong instead of Basic, and the checkbox "User ID/Password" will be disabled, which means in that case, only X.509 SSL Client Certificate or Single Sign On are allowed.

clipboard13.png

In this blog, since both the creation of web service and service consumption are done in AG3, I mark "Make Local Call" as Local System Call.

clipboard14.png

Click Finish button, click the icon "Open Binding WSDL Generation",

clipboard15.png

write down the WSDL link:

clipboard16.png

Create the service consumer proxy in ABAP backend

 

 

1. tcode SE80, choose tab "Enterprise Services Browser", right click on Objects, choose "Create new Object",

clipboard17.png

Choose Service Consumer and click continue:

clipboard18.png

clipboard19.png

clipboard20.png

Specify a prefix:

clipboard21.png

Lots of proxy objects for runtime usage will be created:

clipboard22.png

Finally the ABAP consumer proxy class ZZCO_PROD_WS has been generated, which would be used in the ABAP program to consume the web service.

clipboard23.png

Now the consumer proxy class is ready for use. We can find all its available methods and signature in class builder.

CLASS.png

In part 2 of this blog, we will discuss how to use this proxy class to consume web service in ABAP program.

Step by Step to create web service in CRM UI and consume it in ABAP- Part2

$
0
0

In previous blog we have finished the creation for web service PROD_WS, and ABAP consumer proxy class ZZCO_PROD_WS. Before it can be used in ABAP program to consume the web service we created, a logical port is needed.

 

Create a new Logical Port in SOAMANAGER


1. Go back to SOAMANAGER and search PROD_WS again, this time the ABAP consumer proxy ZZCO_PROD_WS is also visible in search result list.

clipboard1.png

2. Click consumer proxy class and click button Create->WSDL Based Configuration:

clipboard2.png


3. Specify Logical Port name:

clipboard3.png

Specify the WSDL link of new binding for service definition created in previous step. Specify a valid user and password for WSDL access.

clipboard4.png

clipboard5.png

clipboard6.png

Click finish button to finish logical port creation. Click Ping button and ensure it works successfully.

clipboard7.png

Consume the web service in ABAP program

 

Use the following source code to consume the query and read service operation. Pass the logical port name LP__TEST1 in constructor of consumer class. The data type and method signature could be easily found in class builder for consumer proxy class ZZCO_PROD_WS.

 

 

 

DATA: lo     TYPE REF TO zzco_prod_ws,

           input  TYPE zzcrmost__pro001prodadvsea01,

           output TYPE zzcrmost__pro001prodadvsea00.

CREATE OBJECT lo

  EXPORTING

    logical_port_name = 'LP_TEST1'.

 

input-input-searchforproducts-created_by-sign = 'I'.

input-input-searchforproducts-created_by-option = 'EQ'.

input-input-searchforproducts-created_by-low = 'WANGJER'.

TRY.

    lo->crmost__pro001prodadvsea001d(

      EXPORTING

        input                   = input

      IMPORTING

        output                  =  output ).

  CATCH cx_root INTO DATA(lv_text).

    DATA(ls) = lv_text->get_text( ).

    WRITE:/ ls.

ENDTRY.

 

DATA: ls_read_input  TYPE zzcrmost__prod_ws_read,

           ls_read_result TYPE zzcrmost__prod_ws_read_respo.

TRY.

    ls_read_input-input-prod_ws-product_id = 'ARNO_TEST004'.

    lo->crmost__prod_ws_read(

       EXPORTING

          input  = ls_read_input

       IMPORTING

          output = ls_read_result ).

  CATCH cx_root INTO lv_text.

    ls = lv_text->get_text( ).

    WRITE:/ ls.

ENDTRY.

program execution result: 100 results found with CREATED_BY = WANGJER:

clipboard8.png

The result is exactly the same as when we manually run the advanced search in GENIL_BOL_BROWSER:

clipboard9.png

And the result for read operation consumption:

clipboard10.png

Viewing all 228 articles
Browse latest View live