BSP Extensions: method implementation

Hello together,
I am currently trying to implement custom BSP Extensions (taglibs). Almost everything works, I can use my element, it is also shown in the Tag browser in SE80, but I really have no idea on how to implement the rendering.
The documentation exactly leaves out the part on how to actually draw the custom HTML, I can only find info on how to manipulate the element's given content within the BSP. So far, I have overriden (redefined?) the methods DO_AT_BEGINNING and DO_AT_END and somewhere I found that M_OUT attrib. When calling m_out->print_string( 'Hello' ), nothing happens
Has anyone some example coding on how to do the actual drawing of the component? I have taken a look on the standard BSP extensions in HTMLB (like button and so), but could nowhere find the actual rendering stuff.
Please help me
Thanks in advance for any hints or samples.
Greetings, Timo

Let me answer for you the final part of the puzzle.
You write:
<i><% extension ...%>, the elements got printed, otherwise</i>
When we have a BSP page, we can have actually XML on the page. So the pre-processor sees something such as this:
   <myLib:myTag a1 = "v1">
   </myLib:myTag>
It is going to say, aha, here we have some nice XML code coming down the pipe. Good for you. This XML is now placed as a string (what more is XML than a string?) and send to the browser. So if you do a view source in the browser, you should see your XML.
In summary, we aim to please, and XML is high on our list things we like.
So what is a man to do? You must write onto the page:
<%@extension name="myFirstLib" prefix="myLib"%>
This line the pre-compiler eats. And then after a moment of silence, it accepts that you don't like XML. Anything that now just looks like "<myLib:*>" is immediately understood to be a tag. Thus the compiler is informed, and it will generate the correct ABAP code to call this tag.
And this pre-compiler believes in perfection: mylib is NOT equal to myLib. It is case sensitive!
In summary: one slip of the finger, and you tag gets seen as XML and rendered out as raw string.
(With a syntax check step, and not a compile step, you will also get a warning about this. Just to be a little helpful.)

Similar Messages

  • When to use abstract classes instead of interfaces with extension methods in C#?

    "Abstract class" and "interface" are similar concepts, with interface being the more abstract of the two. One differentiating factor is that abstract classes provide method implementations for derived classes when needed. In C#, however,
    this differentiating factor has been reduced by the recent introduction of extension methods, which enable implementations to be provided for interface methods. Another differentiating factor is that a class can inherit only one abstract class (i.e., there
    is no multiple inheritance), but it can implement multiple interfaces. This makes interfaces less restrictive and more flexible. So, in C#, when should we use abstract classes
    instead of interfaces with extension methods?
    A notable example of the interface + extension method model is LINQ, where query functionality is provided for any type that implements IEnumerable via
    a multitude of extension methods.

    Hi
    Well I believe Interfaces have more uses in software design. You could decouple your component implementing against interfaces so that
    you have more flexibility on changing your code with less risk. Like Inversion of Control patterns where you can use interfaces and then when you decide you can change the concrete implementation that you want to use. Or other uses for interfaces is you could
    use Interceptors using interfaces (Unity
    Interceptor) to do different things where not all of these is feasible or at least as straightforward using abstract classes.
    Regards
    Aram

  • Problem in following the webblog "Using TimeStamps: BSP Extensions"

    I try to follow the webblog "Using TimeStamps: BSP Extensions for a TimeStamp UI."
    However, after I have created the method 'RESOLVE_MODEL_BINDING' and compiled it, it shows me an error message
    <b>'Method "ADD_TO_CHECK_TABLE" is unknown or PROTECTED or PRIVATE.'</b>
    This is some part of that code.
      model = m_page_context->get_model( model_name ).
      name = model->get_attribute_name( attribute_path = value_path ).
      valuelow = model->get_attribute( attribute_path = value_path ).
      IF id IS INITIAL.
        id = name.
      ENDIF.
      IF disabled IS INITIAL.
        bspmodel ?= model.
        bspmodel->add_to_check_table( control_id = name ).
      ENDIF.

    I defined the bspmodel above the if block like the tutorial code.
    DATA: model             TYPE REF TO if_bsp_model_binding,
          model_name        TYPE string,
          metadata          TYPE REF TO if_bsp_metadata_simple,
          metadata_base     TYPE REF TO if_bsp_metadata,
          value_path        TYPE string,
          is_valid          TYPE i,
          error_value       TYPE string,
          bspmodel          TYPE REF TO if_bsp_model.
    I further looked into the interface <b>if_bsp_model</b> in my system. It doesn't include any interface, and only five methods were found:
    1) INIT
    2) GET_BINDING_INTERFACE
    3) GET_ERRORS
    4) INSTANTIATE
    5) RESET_ERRORS

  • BSP Extension Composite Element with Body

    Hello,
    I created an own BSP Extension element "myLink" which should be a composite element containing HTMLB:LINK element.
    The myLink-DO_AT_BEGINNING looks like follows:
      DATA: orgLink  TYPE REF TO CL_HTMLB_LINK.
      orgLink = CL_HTMLB_LINK=>FACTORY( id = id
                                      reference = reference
                                      text = text ).
      WHILE m_page_context->element_process( element = orgLink )
        EQ CO_ELEMENT_CONTINUE.
      ENDWHILE.
      rc = CO_ELEMENT_CONTINUE.
    This works fine for  - Tag (coming from DO_AT_END of HTMLB:LINK) is inserted before the body of my element.
    It is possible to add the text "LinkText" as a literal in the WHILE - loop. But: I don´t find a way to do this dynamically! The body of a myExtension:myLink can contain text, images, other BSP elements. How can I access this during runtime so that I can supply the BODY-parameter of method "element_process"? How to do this? Or isn´t this the solution for this problem?
    Maybe I´m to silly to see obvious things. I read a lot of articles about composite BSP elements - but I didn´t find an example handling dynamic or unknown element-bodies.
    Thank you for any help,
    best regards,
    Stefan

    Hi Stefan,
    I understand what you want to achieve - maybe you have to play around with the "delegated" attributes/methods to really achieve what you want using HMTLB:LINK from within your element this way.
    Here is what I did for a similar problem: I created my own tooltip-on-mouseover extension, which can be wrapped around any kind of other elements that are placed in the tooltip element body.
    I also have a special attribute in this element, "contentAsLink". If this attribute is set, I render the opening href HTML tag (<a>) in method DO_AT_BEGINNING, and the closing tag (</a>) in DO_AT_END. Not the best way if you really want to stick with HTMLB everywhere, but it's nice and easy.
    Here is the precise opening tag I use:
    <a class="urLnkFunction" href="javascript:void(0);">
    Hope this helps you to find a solution for your needs.
    Cheers,
    Max

  • Custom BSP Extension

    Hi to all,
    I need to have one more attribute in button element for selecting picture for displaying on it.
    For this I made a copy of htmlb button element into custom bsp extension,
    and copied CL_HTMLB_BUTTON  into ZCL_HTMLB_BUTTON, but I am getting some error while activating this.
    Please suggest me some way to make this happen.
    Regards,

    <% data image type   ref to cl_htmlb_image.
            data: image_string type string.
            create object image.
            image->id = 'UserSelectionCancel2'.
            image->src = cl_bsp_mimes=>sap_icon( 'ICON_CHECKED' ).
            image->tooltip = ''.
            clear image_string.
            image_string = image->IF_BSP_BEE~RENDER_TO_STRING( page_context ).
          %>
          <htmlb:button id            = "UserSelectionEnter"
                        onClientClick = "closeiframe();"
                        text          = "<%= image_string %> ENTER"
                        encode        = "FALSE" />
    I had seen following code to make icons, now if I have lot of icons to make I need write this code several times,
    If I write one method of mine application class using above code and use one parameter to change icon name. will it work??

  • Integrate bsp-extension into htmlb_manager

    I have problems integrating my BSP extension in the HTMLB-manager.
    My BSP extension has a "table" attribute (TYPE REF TO DATA). In DO_HANDLE_EVENT of the controller, i try to get this reference but I don't get it to work.
    I call
    lorv_tt ?= cl_htmlb_manager=>get_data(
                       request      = request
                       name         = 'ZpuGen:tt'
                       id           = 'my_id' ).
    and a reference to my handler class is returned. however, the table attribute is empty (while id is not).
    probably i have to modify event_initialize or restore_from_request, but i am not sure how.
    any ideas?

    Hi,
    Just for future references, please add this code in the OnInitialization Event:
    DATA: event TYPE REF TO if_htmlb_data.
    event = cl_htmlb_manager=>get_event_ex(
    runtime->server->request ).
    IF event IS NOT INITIAL
    AND event->event_name = cl_xhtmlb_buttongroup=>co_event_name.
    ELSE.
       DATA: bee_html TYPE REF TO cl_bsp_bee_html.
       CREATE OBJECT bee_html.
       bee_html->add(
       html1 = '' ).
       bee = bee_html.
    ENDIF.
    The issue in this example seems to be related with the constructor method of BEE, so it is useful to manually initialize the content.
    I hope this helps.
    Regards,
    Eze.

  • What is BSP extension?

    Could anyone please let me know what is BSP extension?
    Thanks in Advance.
    Best Regards,
    Vijaya

    Creation our own BSP Extensions
    Advantages of BSP Extensions –
    1.     Reduces the complexity of the BSP pages.
    2.     Reuse.
    3.     Clear-cut role distribution.
    4.     Tool support within the workbench by the BSP extension editor.
    Firstly while creating an element under the extension there is a provision for entering the attributes and then tin the element handler class Generally these are the methods that are to be redefined while creating our own BSP Extensions-
    1.     COMPILE_TIME_IS_VALID
    2.     RUNTIME_IS_VALID
    3.     DO_AT_BEGINNING
    4.     DO_AT_END
    COMPILE_TIME_IS_VALID –
         Determines at compile time whether correct values have been assigned to element attributes. The validation result is written to the return parameter valid.  The possible values for valid are ‘X’ or ‘’ (blank).
    RUNTIME_IS_VALID –
         Determines at runtime whether correct values have been assigned to the element attributes.
    DO_AT_BEGINNING –
         This method is always accessed at the beginning of the element call when the BSP page is processed.
    Using the return parameter RC you can control whether the content of the current BSP element is to be evaluated or not. The possible values of the return parameter RC are therefore: CO_ELEMENT_CONTINUE and CO_ELEMENT_DONE
    DO_AT_END –
         This method is accessed, whatever the case, at the end of the element call. Since the entire element content is available at this point, this method can be used for Manipulation of the Element Content.
    Using the return parameter RC, you can control whether the entire BSP page is to be evaluated further or not. The possible values are therefore: CO_PAGE_CONTINUE and CO_PAGE_DONE.

  • C# compiling error: 'System.Array' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)

    Hello experts,
    I'm totally new to C#. I'm trying to modify existing code to automatically rename a file if exists. I found a solution online as follows:
    string[] allFiles = Directory.GetFiles(folderPath).Select(filename => Path.GetFileNameWithoutExtension(filename)).ToArray();
            string tempFileName = fileName;
            int count = 1;
            while (allFiles.Contains(tempFileName ))
                tempFileName = String.Format("{0} ({1})", fileName, count++); 
            output = Path.Combine(folderPath, tempFileName );
            string fullPath=output + ".xml";
    However, it gives the following compilation errors
    for the Select and Contain methods respectively.:
    'System.Array' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'System.Array' could be found
    (are you missing a using directive or an assembly reference?)
    'System.Array' does not contain a definition for 'Contains' and no extension method 'Contains' accepting a first argument of type 'System.Array' could be
    found (are you missing a using directive or an assembly reference?)
    I googled on these errors, and people suggested to add using System.Linq;
    I did, but the errors persist. 
    Any help and information is greatly appreciated.
    P. S. Here are the using clauses I have:
    using System;
    using System.Data;
    using System.Windows.Forms;
    using System.IO;
    using System.Collections.Generic;
    using System.Text;
    using System.Linq;

    Besides your issue with System.Core, you also have a problem with the logic of our code, particularly your variables. It is confusing what your variables represent. You have an infinite loop, so the last section of code is never reached. Take a look 
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.IO;
    namespace consAppFileManipulation
    class Program
    static void Main(string[] args)
    string fullPath = @"c:\temp\trace.log";
    string folderPath = @"c:\temp\";
    string fileName = "trace.log";
    string output = "";
    string fileNameOnly = Path.GetFileNameWithoutExtension(fullPath);
    string extension = Path.GetExtension(fullPath);
    string path = Path.GetDirectoryName(fullPath);
    string newFullPath = fullPath;
    string[] allFiles = Directory.GetFiles(folderPath).Select(filename => Path.GetFileNameWithoutExtension(filename)).ToArray();
    string tempFileName = fileName;
    int count = 1;
    //THIS IS AN INFINITE LOOP
    while (allFiles.Contains(fileNameOnly))
    tempFileName = String.Format("{0} ({1})", fileName, count++);
    //THIS CODE IS NEVER REACHED
    output = Path.Combine(folderPath, tempFileName);
    fullPath = output + ".xml";
    //string fullPath = output + ".xml";
    UML, then code

  • Is the BSP extension better than this solution(Text and Image in Button)?

    Hi guys,
    I have a  concept question to decide whether a BSP extension is needed.
    I want to put text and image in htmlb button, and used the solution like below:
    <%
      data image type ref to cl_htmlb_image.
      data: image_string type string.
      create object image.
      image->id = 'back'.
      image->src = cl_bsp_mimes=>sap_icon( id = '@9S@' ).
      image->tooltip = 'Go back'.
      clear image_string.
      image_string = image->IF_BSP_BEE~RENDER_TO_STRING( page_context ).
            %>
            <xhtmlb:toolbarButton id      = "back"
                                  onClick = "back"
                                  text    = "<%= image_string %>" />
    But this solution is not desired by customer, since they don't think it looks nice. So is it possible to create my own BSP extension to get a nicer element?
    Thanks for any hint.
    Regards,
    Liying

    Hi,
    By a nicer element...did you mean to display a better image...or a nicer image ????
    if yes, the you can upload any image you need and then use it here...
    Tell me if you need more information...!!
    Hope this helps.
    <b><i>Do reward each useful answer..!</i></b>
    Thanks,
    Tatvagna.

  • BSP Extensions doesn't work with Pocket PC2003

    hello,
    i faced out following problem, that i have alreday posted in the BSP-forum. They said the guys here may have a solution.
    I want to write an application using webas on abap 6.20 SP 41 using BSP-Extension. The Extension framework
    dumps:
    browser not supported!
    Any solution?
    On which platform can i write web-apps for pocketpc 2003.
    Also the ep 6.0 dumps, if called via browser on a handheld under pocketpc 2003.
    Best regards, Stefan

    HI,
    Where did u find the extension for the BSP pages for Pocket PC .
    I am also trying to do the same thing and not getting desired result .
    If u find the solution then please let me know the detail on [email protected] .
    Thanks
    Gyan

  • Is XHTML better option than BSP extensions?

    Hi,
    for some strange reason my project team wants to use XHTML for layout rather than any of the existing BSP extensions...the reason being the HTMLB does not generate XHTML in the back-end or something like that. Is anyone aware of any such lackings in BSP extensions that we have? Are there any alternatives with in BSP extensions? I want to convince the team to use standard BSP extensions...
    Thanks
    Kiran

    Ahha... I have just seen as I logged on this...
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/developerareas/ibm">IBM integration area or somesuch</a>
    but I dont think it is going to have what you are looking for. I have had some experience with itegrating output from BSP into a Websphere portal and it wasnt that much fun. We used iframes to host the bsp application in portal which wasnt ideal. This was only for a prototype of a large application and the full blown applicaion would have probably used websphere making bapi calls to get the info from sap. One option was using EP between BSP and WebSphere but this is probably not an option due to budget  constraints.
    This isn't a great deal of help but hopefully it is food for thought.
    regards,
    Nigel

  • Accessing Sender parameter attribute in event hander method implementation

    Hello knowledgeable friends.
    I would like a single event handler to manage two alv grid objects.  There is a parameter SENDER that is available in the method implementations to say which object triggered the event.  I would like to get at the attribute MT_OUTTAB but this syntax does not work:
    local_variable = sender->mt_outtab
    Any help would be greatly appreciated

    Ok, MT_OUTTAB is a protected Attribute.  I would settle for just the name of the Sender.  This code checks:
        call method sender->get_name RECEIVING name = l_name.
    but l_name is empty.  I was hoping for 'GRID1'; when I created the object I used:
        CREATE OBJECT alvgrid
          EXPORTING
            i_parent = container_top
            i_name = 'GRID1'.

  • Creating shared library of native method implementation using gcc

    Hi
    I am using Dev-C++ IDE for writing and compiling C Programs. It supports gcc.
    I have to build a shared library of a native method implementation using gcc compiler.
    In JNI tutorial build script is given for VC++ which is as follows
    cl -Ic:\java\include -Ic:\java\include\win32
    -LD HelloWorldImp.c -Fehello.dll
    Similarly I wanted build script for gcc compiler.
    Thanks
    Shailesh

    Here is an example of building a library from one module with CygWin's gcc:
    # Must set JAVA_HOME and LIBRARY_MODULE before
    gcc -mno-cygwin -D__int64="long long" -I $JAVA_HOME/include/win32 -I $JAVA_HOME/include -shared -Wl,--kill-at -o $LIBRARY_MODULE.dll $LIBRARY_MODULE.c

  • BSP extension on Pocket PC2003 doesn't work

    Hello,
    i have to write some mobile applications for t-moblie mdaII on Pocket PC2003-Platform. We work on webas SP 41.
    All application with bsp-extension are dumping:
    An exception occurred. This exception is dealt with in more detail below       
    . The exception, which is assinged to the class 'CX_BSP_ELEMENT_EXCEPTION', was
    not caught,                                                                   
    which led to a runtime error.                                                  
    The reason for this exception is:                                              
    <htmlb:content>:  (*) This browser is not supported.                           
    (IE>=550;NN>=700;Mozilla>=9999;IE=401)                                                                               
    What about the SAP Message to support mobile platforms?
    Does anyone knows how to fix this problem?
    Best regards, Stefan

    Stefan,
    I am interested in the solution that you mentioned in your last post. I made the change to the registry on a test iPac and was able to circumvent the error message, but find that no events are triggered once the page is loaded in the application.
    This is the content of the page:
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="classicdesign2002design2003" >
      <htmlb:documentHead title="Asset Inventory" >
        <link rel="stylesheet" href="../PUBLIC/BC/BSP/Styles/z_asset.css">
        <H1><LO>
        <htmlb:image src="../PUBLIC/BC/Icons/z_duke_icons/z_dukesh.JPG" />
        </LO>Asset Inventory</H1>
    <script language="JavaScript">
      </htmlb:documentHead>
      <htmlb:page title="Asset Inventory Main Page" >
        <htmlb:form>
          <P>
          <htmlb:button id      = "view"
                        text    = "View / Change Asset"
                        onClick = "onView" />
          </P>
          <P>
          <htmlb:button id      = "list"
                        text    = "Inventory by Department"
                        onClick = "onList" />
          </P>
          <P>
          <htmlb:button id      = "legend"
                        text    = "Icon Key"
                        onClick = "onLegend" />
          </P>
          <P>
          <htmlb:button id      = "help"
                        text    = "Application Help"
                        onClick = "onHelp" />
          </P>
        <a href="https://sapitsdev.oit.duke.edu/scripts/wgate/sapextauth/!?modwebauthcookiemagic=logout"
           style="font:10pt Arial; background:#F5DEB3;color:black; "
           onClick=exitBSPApplication('session.htm'); >Logoff</a><br>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    Do you have any suggestions as to why the buttons don't trigger the event?
    Thanks for your input,
    Joanne.

  • BSP-Extension Event

    Hi everybody!
    I've made a simple BSP-Extension which generates a button like this:
    data: htmlb_button type ref to cl_htmlb_button.
    htmlb_button = cl_htmlb_button=>factory(
                                id = 'Knopf01'
                                text = 'Knopf 1'
                                onclick = 'test'
    while me->m_page_context->element_process( htmlb_button ) = co_element_continue.
    endwhile.
    And now i want to handle the fired event from that button in the same BSP_Extension. I did it like this:
    DATA: event       TYPE REF TO if_htmlb_data,
          htmlb_event TYPE REF TO cl_bsp_htmlb_event.
    event = cl_htmlb_manager=>get_event_ex(mc_runtime->server->request  ).
    IF event IS NOT INITIAL AND event->event_class = 'CL_BSP_HTMLB_EVENT'.
        htmlb_event ?= event.
    ENDIF.
    So i can check the event by getting event->event_id. That works fine. But now my Question:
    Can i send some parameters with the event, so that i can handle them after the event was fired?
    regards,
    Fabian

    Fabian,
    No and yes. The HTMLB button itself does not have any way to carry your additional parameters. But the one thing it does offer you is the onclick string. And this is the yes part. This is a simple string, that has a meaning only for you, and not interpreted in any way by the framework. So do something such as:
    data: on_click type ref to string.
    concatenate 'test~~' 'parm~' value ... into on_click.
    htmlb_button = cl_htmlb_button=>factory( ...
                                onclick = on_click
    Effectively, you are just storing your parameters in the event string.

Maybe you are looking for

  • 2010 - displays "There are no items to show in this view" when choosing Display by

    This just started happening. Display by date works, but not Subject, From, etc. I've tried all the advice online for this problem. The only other odd thing is that in Display by Date - after a few days in the past, the display is blank, last Sunday t

  • Is there a way to allow for two lines in "running header (character style)" text variable?

    In my "running header (character style)" text variables, some of the items are quite long and take up more space in my header than I have room for - because I have another "running header (character style)" text variable beside it - and I am trying t

  • Single file to multiple IDOC's (on Multiple R3 Clients):

    Hi, We have a complex Landscape with multiple (4) businesses (multiple R3) instances and most common R3 --> DEV 4 instances with 5 clients each, QAS 4 instances with 2 clients each with some additional clients, PRD 4 instances with a client each and

  • BI content for E-sourcing in BI 7

    Hi, I have to activate e-sourcing standard reports in BI. Any idea where shall I get BI content for e-sourcing (under which application componnent) ?

  • Fcpx 10.1.4 tutorials

    I just bought Final Cut X 10.1.4 Iḿ a newbie when it comes to Final Cut X. I went from Premiere to final cut x. Do apple have some tutorials in App Store for 10.1.4? or do you have some good links to share with me? Any ideas like lynda.com? I know th