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

In CRM Product UI, A thumbnail could be displayed in Product header and Thumbmail assignment block.



The Thumbnail assignment block is not available in SAP predefined UI configuration. Customer needs to manually make it visible via UI configuration change:


The thumbnail view implementation itself is very simple, just use the lib thtmlb image tag.


The thumbnail view implementation itself is very simple, just use the lib thtmlb image tag.


If a product has multiple attachments, how does the UI know which one should be displayed as thumbnail? The default attachment with type BDS_IMAGE will be choosen.


However, these two fields are not available in default standard configuration of GS_CM/EditProp


if your application need also allow users to specify these two fields, you can create a new configuration by copying from the one with object type = PRD_MATSRV.


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


During my recent project I found a strange behavior in attachments.

Click the hyperlink of Properties


do not change anything, and click back

After back to product overview page, the overview page looks exactly the same before you click Property hyperlink.

However, if you use SM12 to check in backend, you will find the current product is locked, although it still looks as under display mode in UI!

The same behavior could be observed in one order application. I would assume this as a bug.


By debugging I found the parent node, Product instance, is explicitly locked by content management class.


However, in my application I do not need this behavior - in my application, the whole attachment assignment block has read only mode, so I don't want my BO to be locked after property hyperlink is clicked. The solution is very easy: do not bind my BO node to PARENTNODE of content management UI component GS_CM by commenting out the related code:

  Yesterday when I am doing my development under interaction center environment, I suddenly find I cannot log on interaction center UI any more.

After I choose my business role ZSOCIAL, the UI hangs there with only information "Starting". Ten minutes later, I got a time out error in UI.

I did a quick check on my development objects and I can ensure this is not caused by my new development. I checked SM21 and SM50 and could not find any hints.

So again I have to debug to find the root cause. But where should I set breakpoint? Since in principle the component set for IC CRMIC_DEFAULT will always be loaded when IC UI is launched, it will be a good starting point to set breakpoint in method CL_CRM_BOL_CORE=>load_component_set. Soon I found the application will hang once that method is called, so I know I am not far from the truth.

In this customizing you can find all components belonging to component set CRMIC_DEFAULT.

The timeout must come from loading one of these components.

Finally I found the component ERP is the trouble maker. The system hangs after I click F6 in line 101.


The root cause is that RFC destination EBJCLNT001 does not work, so RFC call hangs until time out occurred.


This RFC destination is maintained in this customizing:

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

When you create attachments for your business objects via cl_crm_documents=>create_with_table, you have to pass in an internal table for attachment property.
The namelist of attribute name could be got from attachment class via function module SDOK_PHIO_ATTRIBUTES_GET.

For example, attachment class CRM_P_DOC has 36 attributes.

The attributes could also be viewed in tcode DMWB

The actual attribute value could be got via function module CRM_KW_PROPERTIES_GET:


The importing parameters are guid of logical/physical object instances:

The attribute values are stored in PROPERTIES internal table.


Do you know why in the backend table, the property is stored in field PROP09?

actually it is because I hard code the content of relative url as the attachment file name.

    ls_prop-name = 'KW_RELATIVE_URL'.

    ls_prop-value = iv_file_name.

    APPEND ls_prop TO lt_prop.


The index of attribute could also be found in tcode DMWB.

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

In the beginning I consider it is very easy to delete attachments via code, just like below.


I have defined one method with following two importing parameters:

iv_bor_type type string - the BOR type of your business object

iv_uuid type raw16 - the guid of your business object instance

rv_successful type abap_bool - indicates whether the deletion is successful


DATA: ls_bo          TYPE SIBFLPORB,
          lt_loios    TYPE SKWF_IOS,
          ls_loios    TYPE SKWF_IO,
          ls_error    TYPE SKWF_ERROR,
          lt_badios   TYPE SKWF_IOERRS,
          lv_del_flag TYPE ABAP_BOOL.
    ls_bo-instid = iv_uuid.
    ls_bo-typeid = iv_bor_type.
    ls_bo-catid  = 'BO'.
    rv_successful = abap_false.
    CALL METHOD cl_crm_documents=>get_info
        business_object = ls_bo
        loios           = lt_loios.
    LOOP AT lt_loios INTO ls_loios.
      CALL METHOD cl_crm_documents=>lock
          is_bo    = ls_bo
          is_loio  = ls_loios
          es_error = ls_error.
      IF ls_error IS NOT INITIAL.
    CALL METHOD cl_crm_documents=>delete
         business_object = ls_bo
         ios             = lt_loios
         bad_ios         = lt_badios
         error           = ls_error.
    IF ls_error IS INITIAL. " deletion failed
       rv_successful = abap_true.


Through testing I found it works perfectly well with most of BOR type like product, ibase, BP, and one order.

However, it does not work for my new BOR type CRMSOCPOST in CRM7.0 EHP3 - the relationship between my bo and the attachments is not really deleted until

an explicit call COMMIT WORK is written in the report. However, for any other standard CRM BOR type, the COMMIT WORK is not needed. Why?


After some debugging finally I find answer. Have you already observed the comments below? It is written quite clearly: if the business object exists in the database, the COMMIT WORK is not needed.


Back to my case, since CRMSOCPOST is a new BOR type created in CRM7.0 EHP3, the function module does not recoginize it, so the code reached line 225, and

then the bo instance is regarded as non-exist in DB. So an explicit COMMIT WORK is always necessary to make deletion work.


For a complete list of all my blogs regarding content management, please see here.
I create a utility class with method CREATE_DOC. It has following four input parameters:
iv_data type xstring - the binary data which you would like to store as attachment
iv_bor_type type string - the BOR type of your business object. You can view view business object model in tcode SWO1
iv_guid type raw16 - the guid of your business object instance
iv_file_name type string - the file name which will appear in attachment assignment block.
The source code of method below: ( in fact all attributes for an attachment could be available in the input parameters of this method. For simplicity reason I
just hard code them in the sample code )
         ls_bo              TYPE sibflporb,
         ls_prop            TYPE LINE OF sdokproptys,
         lt_prop            TYPE sdokproptys,
         lt_properties_attr TYPE crmt_attr_name_value_t,
         ls_file_info       TYPE sdokfilaci,
         lt_file_info       TYPE sdokfilacis,
         lt_file_content    TYPE sdokcntbins,
         lv_length          TYPE i,
         lv_file_xstring    TYPE xstring,
         ls_loio            TYPE skwf_io,
         ls_phio            TYPE skwf_io,
         ls_error           TYPE skwf_error.
    ls_prop-name = 'DESCRIPTION'.
    ls_prop-value = 'created by Tool'. " replace it with your own description for attachment
    APPEND ls_prop TO lt_prop.
    ls_prop-name = 'KW_RELATIVE_URL'.
    ls_prop-value = iv_file_name. " in the sample code I just reuse file name as relative url
    APPEND ls_prop TO lt_prop.
    ls_prop-name = 'LANGUAGE'.
    ls_prop-value = sy-langu.
    APPEND ls_prop TO lt_prop.
    lv_file_xstring = iv_data.
        buffer        = lv_file_xstring
        output_length = lv_length
        binary_tab    = lt_file_content.
    ls_file_info-binary_flg = 'X'.
    ls_file_info-file_name = iv_file_name.
    ls_file_info-file_size = lv_length.
    ls_file_info-mimetype = 'image/jpeg'. "use the correct mime type for your attachment
    APPEND ls_file_info TO lt_file_info.
    ls_bo-INSTID = iv_guid.
    ls_bo-typeid = iv_bor_type.
    ls_bo-catid = 'BO'.
    CALL METHOD cl_crm_documents=>create_with_table
        business_object     = ls_bo
        properties          = lt_prop
        properties_attr     = lt_properties_attr
        file_access_info    = lt_file_info
        file_content_binary = lt_file_content
        raw_mode            = 'X'
        loio                = ls_loio
        phio                = ls_phio
        error               = ls_error. " evaluate if there is anything wrong during creation
I write a piece of code to test it. After report runs I could see the generated attachment.
You can also test whether the attachment is created successfully in the backend. Test class method get_info in SE24.
Specify importing parameter BUSINESS_OBJECT:
Execute and you should get result as below: one physical object and one logical object according to how-is-attachment-physically-stored-in-database-table-in-cm-framework.
Never forget to call COMMIT WORK in your code, since the persistence of the relationship between attachment and your business object are implemented via generic object service in a update process.You could easily find this via SAT trace on your code
or switch on update debugging in your debugger settings.

If you want to know more technical detail, please find my blog list here.



Content Management(CM) was introduced in basis release 6.10 and implemented in CRM 3.0. Before CM was used, CRM applications was using the Business Document Service (BDS) or Generic Object Services (GOS) to implement Document management requirement. BDS was used in most applications like Business partners, products, product catalogues, solution database, campaigns. GOS was only used in the One Order objects like activities and opportunities. All BDS applications changed to CM in 3.0, the One Order objects only in 3.1.


A document in CM consists of several objects. The most important two are so called “logical info object” (LOIO) and a “physical info object” (PHIO). A LOIO as a logical folder or bracket which holds PHIOs together, while a PHIO represents the content of a specific version of a document. Let's use the word edit in the real world as example. If one works on a Word document and changes the document over time, each saved version would be represented by a PHIO. The LOIO would be the word document itself. This is much like if one looks at SE38 in ABAP: The program name is the LOIO and each transported version of the code is the PHIO.

Let's see an example. I have a product ZCM_DEMO with guid 0090FA0D8DC21ED395FD7C687F99BFF7, BOR type = BUS1178.

I create one attachment for it:


Go to table SKWG_BREL, input product guid 0090FA0D8DC21ED395FD7C687F99BFF7, and we see two entries belonging to this product. The first entry indicates a folder instance which is actually a logical container to hold all attachments for the given product. 



The content of column INSTID_B has naming convention as <type: F(older) or L(ogical object)><Logical object type name><guid>.

The guid in the first row can be found in table CRM_FOLDER:


The guid 0090FA0D8DC21ED395FD830F8DD9DFFF in the second row can be found in table BDSLOIO22, together with the name of attachment.



You are asking how I get to know the name of table BDSLOIO22? If one application wants to use CM to store document, it should have its dedicated class for physical object and logical object, or use the default one CRM_L_DOC. The relationship between application and its class is maintained in tcode DMWB:


in table BDSPHIO22, by specifying logical information object ID, we can get all phyiscal object lists.


once you get phyical object id 0090FA0D8DC21ED395FD830F8DD9FFFF, you can find the respective entries in table BDSCONT22.


The real content of attachment is stored in a claster way, so you cannot see its detail in SE16.


How do I know the database table name BDSCONT22?

1. Get the storage category BDS_DB22 by physical class name.


2. execute function module SCMS_SDOKSTRE_LIST to get all lists of database table. Then you can find the table name BDSCONT22 for your storage category BDS_DB22.


Hi Friends,
It is a common requirement that a certain assignment block in overview page should only be displayed under some condition, for example under control of a business switch.
Here are three ways which could control the visibility of one assignment block via code.

Approach1: dynamical view detachment

refine method DETACH_STATIC_OVW_VIEWS of the controller class of your overview page. All views put into internal table rt_viewid will be hidden by UI framework in the runtime.The code below just means you can evaludate some condition in line 3, and if the condition is met, the assignment block SearchResult will be hidden.

Approach2: dynamic UI configuration load

Create a new configuration within which only Search view is displayed. The configuration is bound to a certain UI object type.
Now we have two UI configurations. The standard configuration will display two assignment blocks by default, the configuration with UI object type = CRM_SMC will only display Search view.
  " IF search result view should be hidden
     me->set_config_keys( iv_object_type          = 'CRM_SMC'
                          iv_propagate_2_children = abap_false ).

Approach3: Control the visibility via business switch

This is a most elegant way, however it could only be used if you would like to control the visibility of your view via a business switch.
When you are assigning your assignment view to the view area of Overview page in runtime repository, a business switch can be assigned as displayed in the picture below. If the switch is turned off, the related view will be automatically hidden by UI Framework.
After you have assigned a view to the view area of oviewpage, the switch ID is displayed after view name.
You could first find the related business function for switch CRM_SOC_SFWS_SMI_2 via tcode SFW1,
then find the business function status in SFW5:
If the business function is deativated, the assignment block will also be hidden automatically.
Divya Gupta

Default text in notes

Posted by Divya Gupta Nov 21, 2013

Hi All,


This one takes us back to the basics of CRM, power of text determination procedure. We have been using notes in CRM transactions very
frequently to capture various texts entered by different Users during the process. Through this blog I am trying to showcase one of the old features
available in text determination procedures i.e. access sequence to source the content in the note type.



In my recent project, I got a requirement from customer where they wanted a default text to appear in the notes. As this note type was to be
used for printing CRM generated letter, it was acting as template for the letter and also it was supposed to be changeable by user during the process and
the changed version of the template should go for printing. As this criteria came into picture, we couldn’t just create a smartform with hardcoded text
instead found the standard way to find solution.


Access sequence in text determination procedure can be used in this case.



Following are the steps to make this work:



  1. Create the text template using SAPscript Tcode SO10



  Maintain the default text here:




2.  Create you text determination procedure and create access sequence for the text type for which the default text has to be sourced:



3. The function has to be created by technical team which has a small code for calling the SAPscript created in step 1:






CLEAR: es_reference.

  es_reference-tdobject = 'TEXT'.

  es_reference-tdid = 'ST'.

  es_reference-tdname = 'ZTEMPLATE'.

  es_reference-tdspras = 'E'.






4. Once the access sequence is created, assign this access sequence to the text type:





Leave the changes column as empty as you want it to be editable and select value “A” in transfer column for this text type.



That’s it. When this procedure is assigned to a transaction and when user creates the transaction, the default text appears in the
respective note type (text type) which can be changed by user.




A small configuration changed helped us in meeting the requirement. Thought of sharing this as a lot of us sometimes miss these
excellent features available as part of std CRM.


Hope you enjoyed revisiting the basics. sometimes it really helps.

With System Upgrade SAP delivers a whole new set of features and functionality to the end users but it takes also takes away some of the GUI transactions from the end users. In case of CRM solutions , the same functionality would be available from the WebUI but for developers it is a pain because it was possible to debug the same functionality easily and with a lesser effort. But now with the transaction not available in the backend , we have to go through the tedious process for debugging through WebUI.


I am big fan of SAP tools available in the ABAP backend as they make the task of the developer much much easier. For me it is like playing in the familiar territory and easier to ramp-up on newer areas. For some days I was struggling to understand how to debug Info-sets in Marketing area and I came across transaction CRMD_MKTSEG to perform the segmentation in ABAP backend. But the Transaction was no longer available. So I looked for another system we have and I could execute the transaction CRMD_MKTSEG. Thank god I could run it but then I wanted to run the same transaction in my system to analyze my problem. So I came across an ingenious idea. I did the following

  • I went to the trx SE93 in my another system. The trx CRMD_MKTSEG was available
  • As the transaction was available , so was the underlying program in the se93 transaction information.(  CRM_MKTTG_SEG_UI_START )
  • So I copied the program and ran it in my actual system.
  • And then I continued on doing what I love to do what I love to do-running scenarios from ABAP backend.


So if you want don't find a transaction in any system , you just have to look for another system where it runs. Also I was surprised that surprised that SAP just removed the transaction and left the underlying program. Instead it could have easily left it for the developers and put an extra authority object so that only developers could use it.

Hi friends,


I am CRM developer in SAP and our team has already integrated twitter ( also facebook ) into interaction center in CRM7.0 EHP3.


You can see an example below:


Create a tweet in twitter website:





Now I can see the tweet created just now in the web site.




And I can also see it in CRM IC agent inbox:




select the first row and I can directly reply it in CRM by clicking reply button:




just click the send button:




after click send button, I can see the reply also in twitter website:



Here below the screenshot is for Facebook:


I create a post in Facebook:



And the post could also be found in CRM system:



if you would like to integrate other social channel than twitter and facebook, you just have to implement your own client class for the new social channel, and all left tasks are centrally done by us from framework side.


you can get more detail information from consulting note 1832462 about social integration achitecture. Implementation detail for facebook client class: note 1832481. And note 1832480 for twitter.


Update on 2013-11-20 for reply to Kavindra:


We have defined a BAdI enhancement spot which you could do your specific analysis on the data extracted from web site.





We have delivered a sample implmenetation which could calculate the sentiment of the text posted in twitter & facebook like "Positive, Negative, Strong Positive, Neutral", with the help of SAP HANA Text Analysis Engine. Of course you could use your own TA engine within that BAdI enhancement implementation.



Welcome to post any questions you have here if you are interested with this topic.

New features available in EHP3 SP4

See the detail here.

Hi Friends,
in one of my post, I talked about how to open ABAP webdynpro page via pop up window to resolve a real customer issue.
Now I have another solution to navigate to ABAP webdynpro page via CRM navigation framework.
The CRM navigation framework is using a so-called navigation object which can tell framwork what the target UI view and the respective operation ( Display, Edit, Search etc ). The navigation object relies heavily on CRM ui concept like UI object type, BOR and BOL type which do not make sense for a ABAP Webdynpro page.
So the main idea of this solution is, to use a wrapper CRM ui component which encapsulate ABAP webdynpro page and make configurations to achieve the navigation from source UI component to the wrapper component. After the wrapper component is opened, it will then open ABAP webdynpro page itself.
The finaly result would look like below:
compared with the solution in my previous blog, this solution does not need any enhancement on standard UI component, instead only several customizing work
( with corresponding mapper class development )and the development of a new wrapper UI component with tiny effort. The main steps are below:
create a simple wrapper UI component. ( Please ignore view main, which is for another blog )
create an inbound plug for window MainWindow and implement as below.
  method IP_FROM_WF.
    data(lo_entity) = iv_collection->get_first( ).
    CHECK lo_entity IS NOT INITIAL.
    data(lv_guid) = lo_entity->get_property_as_string( 'DOCMNT' ).
    cl_zmeta_mainwindow_impl=>gv_url = zcl_url_utility=>get_url( CONV #( lv_guid ) ).
The idea is to get the target ABAP webdynpro page url from iv_collection which is passed by CRM navigation framwork and set it to a static attribute of window controller class. That gv_url is just used in view windowOpen.htm. So it means when this wrapper UI component view is about to be rendered, it will open the target ABAP webdynpro page via javascript
SM30, view name BSPDLCV_OBJ_TYPE create a new UI object type. please AlWAYS double check in the system whether there are already existing UI object type in the system!
Here I create a new UI object type CRM_WF. You can input any name in BOL Object name. There is no validation check, just input a meaningful name.
The Genil component specified here will be loaded automatically by framework in the runtime. In most time your ABAP webdynpro page does not have respective Genil component in CRM, you just can maintain a dummy one.
create a new entry in table CRMS_UI_OBJ_MAP. The object name comes from step2.
the mapping class must implement interface IF_CRM_UI_OBJ_MAPPER. If your scenario is just navigation from CRM ui to ABAP webdynpro,
you only need to implement GET_ENTITY_FROM_UI_OBJECT.
Here I just retrieve respective document data from database with document key passed in from framework ( iv_entty_key_value )
in SPRO-Customer Relationship Management-UI Framework-Technical Role Definition-Define Work Area Component Repository:
create a new entry for your wrapper UI component:
in inbound Plug Definition, create one entry:
in SPRO-Customer Relationship Management-UI Framework-Technical Role Definition-Define Navigation Bar Profile:
create an entry in "Define Generic Outbound Plug mapping" for your profile.
And that's all.
Hi Friends,
in my recent customer project customer complains to me that they can not navigate from the workflow search result to the target UI.
The workflow work item is a document generated via SAP document builder. They would likt to navigate to the document detail page and then decide whether to approve the document or not. With SAP standard solution so far in CRM7.0 EHP3, this is not possible since this work item does not have any BOR type but instead modelled via ABAP class /IPRO/CL_WFL_DOCUMNT. What's more, the target document page is built via ABAP webdynpro which has not respective concept like UI object type, Genil component or BOL object name.
So in order to enable customer to see the document page, I just enhance the standard table to add a new column named "Document URL". By clicking the hyperlink of that column, it will create a new popup window to display the document page.
The solution could be concluded as below steps:
enhance a new attribute DOC_URL in standard context node SEARCHRESULTNODE, implement Getter and P getter.
in getter, just get the target document page url via utility class:
  method GET_DOC_URL.
    value = zcl_document_utility=>get_display_value( iterator ).
in p getter, set the event handler for hyperlink click event:
CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
        rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
    WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
        rv_value = 'DISPLAY_DOC'.
define component usage GS_CMSRCH:
and in event handler for DISPLAY_DOC:
    DATA(lv_title) = cl_wd_utilities=>get_otr_text_by_alias( 'Document(to be approved) Preview' ). "#EC NOTEXT
    DATA(lr_popup) = io_wd_manager->create_popup(  iv_interface_view_name = 'GS_CMSRCH/CMDisplayContentWindow'
                                                   iv_usage_name          = 'GS_CMSRCH'
                                                   iv_title               = lv_title ).
    DATA(lr_cn)  = lr_popup->get_context_node( 'PARAMS' ).
    DATA(lr_obj) = lr_cn->collection_wrapper->get_current( ).
    READ TABLE st_url_buffer ASSIGNING FIELD-SYMBOL(<buffer>) WITH KEY uuid = iv_guid.
    CHECK sy-subrc = 0.
    DATA(ls_params) = VALUE crmt_gsurlpopup_params( url = <buffer>-url height = '1000' ).
    lr_obj->set_properties( ls_params ).
    lr_popup->set_display_mode( if_bsp_wd_popup=>C_DISPLAY_MODE_PLAIN ).
    lr_popup->set_window_width( 1000 ).
    lr_popup->set_window_height( 10000 ).
    lr_popup->open( ).
And that's all.
Interface window CMDisplayContentWindow is a new window created by SAP in EHP3 SP3. There is no magic inside it: just open the target window via javascript
you can also use the reuse component GSURLPOPUP, which can achieve the same result but with different html markup.
After I finish it, I soon realized that in this dedicated case, it is possible to "navigate" to the target ABAP webdynpro page via CRM navigation framework itself. I will explain how to do it in my next blog.
The source code of zcl_document_utility could be found from attachment.

The topic of the blog may seem queer but as I would illustrate later it is very relevant in the lives of technical consultants. I would illustrate with examples how these approaches would help you succeed or if fail then fail gracefully ( read exception and dumps ) . Lets look into each of one at a time.




  • For e.g. if you want to do something like this then this a recipe for sure shot disaster. If lv_entity is not bound then you would run into a dump/exception.You can use this in possibly many ways and you should use this as much as possible.
lv_bo ?= lv_entity.
lv_bo->set_property( iv_attr_name = ‘CITY’
iv_value = ‘Walldorf’ ).


the better way to the similar coding would be

lv_bo ?= lv_entity.
CHECK lv_bo is bound. 
lv_bo->set_property( iv_attr_name = ‘CITY’
iv_value = ‘Walldorf’ ).


lv_bo ?= lv_entity.
if lv_bo is bound.
lv_bo->set_property( iv_attr_name = ‘CITY’
iv_value = ‘Walldorf’ ).


This is a very common failure scenario and is so common that we often tend to ignore this.


  • The second variety is when you write a new method/form etc. , then check whether the importing parameters are proper. This would mean if you expect a reference variable to be passed then it should be bound or if you have a mandatory parameter passed then it should be having some value. Similarly pass export only those parameters which are requested. ( This is not a disastrous case but can save performance).For e.g. if you are sending a collection as an importing parameter to a method then you can write the following statement. This way you know that the col is bound and contains entities


          CHECK ir_col is bound and ir_col->size(  ) > 0. 





This one is my personal favorite. Often uncleared variable could cause embarrassing problems and of magnitude you cannot even imagine. For e.g. you are in a conditional statement where you fill some variables based on condition being true and condition was false and since the variable were not cleared you still get data in variables. Or for e.g. you failed to clear an entity reference variable it would cause you lots of issues. I am providing some examples


lv_bo ?= lv_person.
lv_*** = lv_bo->get_property( ‘***’ ). “Key code
if lv_person->get_parent( ) is not initial.
lv_bo ?= lv_person->get_parent( ).
lv_*** = lv_bo->get_property( ‘***’ ). “Key code


Now if the if condition is not true , then lv_*** is line no 5 should be blank but it would be filled with value fetched in line no 2. In this case it may not seem disastrous but in some cases it is extremely catastrophic.


The better way to do this would be following. As a general rule for methods which have returning or exporting parameters , clear the variables which are collecting values.

lv_bo ?= lv_person.
clear lv_***.
lv_*** = lv_bo->get_property( ‘***’ ). “Key code
if lv_person->get_parent( ) is not initial.
lv_bo ?= lv_person->get_parent( ).
clear lv_***.
lv_*** = lv_bo->get_property( ‘***’ ). “Key code


In my case , I was trying to create multiple DOCFLOW entities but I not have cleared the variable through which I was passing the data to docflow and I was passing the same docflow instance every time hence the data was getting overwritten in same entity. 




Another of my personal favorite. Exceptions are pretty common while we execute a scenario in WebUI. But they are handled in the framework and hence even though exceptions are raised , gracefully WebUI screen opens. If I call a method and it runs into an exception , then it could result in a dump or exception. Both of them are not appreciated by the users hence it makes a lot of sense to fail gracefully and provide exception handling. As a general rule if you are coding in WebUI , don't raise exceptions and don't fail to catch exceptions. Both of them are absolutely necessary.


while lr_current_entity is not initial and lr_entity is not initial .
 *  Add the entitiy
                Clear lr_entity.
CHECK lr_ent is bound.
 lr_ent ?= lr_entity.
 if lr_ent->alive( ) = abap_true.
 Clear lr_adminh , clear lv_object_type.
 lr_adminh ?= lr_ent->get_related_entity( 'BTOrderHeader' ).
 if  (Your_Condition).
  lr_current_entity ?= lr_iterator->get_next( ).
 lr_entity ?= ir_valuehelp_collection->get_next( ).
 catch cx_root.
 lr_current_entity ?= lr_iterator->get_next( ).
 lr_entity ?= ir_valuehelp_collection->get_next( ).

Now this code serves two purposes

a) It handles the exception hence there would not be any disruption in WebUI.

b) In case of exception occurs , there is a handling in that case.


Some of these guidelines may appear didactic but in reality they help in avoiding embarrassing code mishaps.


Filter Blog

By author:
By date:
By tag: