Skip to Content
avatar image
Former Member

Different Listboxes in Tableview-Colum

Hello,

in a tableview using an iterator I try to display listboxes with different content in one column as kind as a F4-Help. The type is always the same: shsvaltab.

I tried different things to pass the reference into p_replacement_bee for the dropdownListBox in the iterator:

- store the data in the row/line itself and get it in the iterator

- store the data in an own public table and access the line via read table in the iterator

- using the "p_replacement_bee = CL_HTMLB_DROPDOWNLISTBOX=>FACTORY(..) thing

The result is always the same: the cell is empty. The reference is passed correctly to p_replacement_bee as I saw in the debugger.

Do I use always the same table content for the column the listbox is displayed correctly. But for performance reasons we don't want to provide the same list box 30 times in each row but load the values "on demand" with the onSelect-Event. Initially the default entry - which can be different for the rows - should be the only entry in the list.

Does anyone faces the same problem or has a solution?

Thanks in advance,

Bernd

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

7 Answers

  • Jun 15, 2004 at 09:59 PM

    Hallo Bernd,

    First, whenever I see things such as "the cell is empty" it points to some programming bug. What I usually find is that some table you feed into the ddlb is a local "data:" type table. So once the method is completed, the table is gone. Be careful to hook the tables onto class attributes to keep them alive a little longer.

    Now the real question is this: do we have N * exactly the same listbox? If yes, then it is easy. Long time ago we developed the <htmlb:dataContainer>. This is effectively the content of the table rendered once under a specific ID. And then all <htmlb:dropdownListbox> tags are told to use the dataContainer. So they are rendered empty, and once in the browser, all DDLB will load themselfs from the dataContainer.

    Here are bits and piece as example:

    <% DATA: cols TYPE TIHTTPNVP, col TYPE IHTTPNVP.
       col-name = 'red'.    col-value = 'Apple'.             APPEND col TO cols.
       col-name = 'yellow'. col-value = 'Bananana'.          APPEND col TO cols.
       col-name = 'orange'. col-value = 'Orange & Tagerine'. APPEND col TO cols.
    %>
    
    <htmlb:dataContainer name              = "dC"
                         table             = "<%=cols%>"
                         nameOfKeyColumn   = "NAME"
                         nameOfValueColumn = "VALUE" />
    
    <htmlb:dropdownListBox id = "d1" dataContainerName = "dC" />
    <htmlb:dropdownListBox id = "d2" dataContainerName = "dC" />
    <htmlb:dropdownListBox id = "d3" dataContainerName = "dC" />
    

    ++bcm

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 16, 2004 at 06:55 AM

    Hello Brian,

    I was aware of this local data problem - that's the reason I uses a static attribute of another global class.

    The data container reduces the amount of data which is transported via the network. But our problem is the rendering time. We have about 30 lines in our table and 30 times a listbox with 100 entries as F4-help. The rendering takes about 4 seconds on a 2,8 GHz PC. So we want to reduce the amount of the listbox entries to excatly one -the preselected one - and load the complete list when the onSelect-Event is triggered.

    Unfortunatley the onSelect-Event does not work with the datacontainer-tag.

    Any ideas?

    Regards,

    Bernd

    Add comment
    10|10000 characters needed characters exceeded

    • Bernd,

      I like the idea to delay loading of the DDLB from the dataContainer until it is actually requested (onSelect event). Why not make a code suggestion (or discuss tomorrow with Vitaly), and see if we can ship this in next SP.

      If you are using design2003 and are in a hurry, you can consider to directly render with UR. Slightly messy, but doable.

      ++bcm

  • avatar image
    Former Member
    Jul 09, 2004 at 10:53 AM

    Hi,

    on this DDLB topic, I have a problem...

    First the Disclaimer 😊

    I have studied the blogs

    I have studied the SBSText_HTML DropDownListBox example

    This is another piece of scaffolding for my app

    I have searched the forum and found this similar thread

    Question:

    This thread and the DropDownListBox example show how to use:

    DATA: t TYPE TIHTTPNVP, entry TYPE IHTTPNVP.

    entry-name = 'key_red'. entry-value = 'Red'. APPEND entry TO t.

    entry-name = 'key_green'. entry-value = 'Green'. APPEND entry TO t.

    entry-name = 'key_blue'. entry-value = 'Blue'. APPEND entry TO t.

    entry-name = 'key_black'. entry-value = 'Black'. APPEND entry TO t.

    %>

    <htmlb:dataContainer name = "myDataContainer"

    table = "<%= t %>"

    nameOfKeyColumn = "NAME"

    nameOfValueColumn = "VALUE" />

    <htmlb:dropdownListBox id = "myDropdownListBox14"

    dataContainerName = "myDataContainer" />

    (this code is from the htmlb example)

    my Problem is, I am prototyping this example in my BSP as a stepping stone to filling the dataContainer with results from SAP-ABAP.

    But when I put this code in my prototype I get the error message Field t is unknown it is neither in Tables or a Data statement

    I have tried putting the data statement into different events in the Event Handler but to no avail - and I have tried creating a Table t in the page attributes but no success.

    Do you have any idea where I am going wrong ?

    Please forgive me if this is a dumb question.

    Thanks,

    Milan.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2004 at 12:02 PM

    too slow...

    I answer my own question, I got it to work with the Data: part in the 'layout' of the BSP like..

    <%

    DATA: t TYPE TIHTTPNVP, entry TYPE IHTTPNVP.

    entry-name = 'key_red'. entry-value = 'Red'. APPEND entry TO t.

    entry-name = 'key_green'. entry-value = 'Green'. APPEND entry TO t.

    entry-name = 'key_blue'. entry-value = 'Blue'. APPEND entry TO t.

    entry-name = 'key_black'. entry-value = 'Black'. APPEND entry TO t.

    %>

    but this isn't really what I want as I am trying conciously to separate the xml/htmlb and markup from the logic which is why I would like this data statement to be handled by one of the event handlers - just can't get it to work with this code in one of the event handlers.

    Thanks,

    Milan.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 09, 2004 at 12:33 PM

    Hi Milan,

    why don't you try it with the tabstrip item "Page attribute" which you can find in each page/view?

    Regards,

    Rainer

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 09, 2004 at 12:39 PM

    Hi Rainer,

    thanks for your reply,

    as I said in the first part of my question, "and I have tried creating a Table t in the page attributes but no success".

    I keep looking, maybe I am doing something daft and it will be resolved, but the main question remains, I can get this <% ABAP %> to work in the layout but if I move it to one of the events the page will not compile.

    Thanks,

    Milan.

    Add comment
    10|10000 characters needed characters exceeded

    • <i>"event->event_x" ... in the above example which is taken from the TAG Library doco we can see that event->event_x can have two forms type and name, but there must be more and it is this documentation that I cannot find.</i>

      Two things to help guide you. (Maybe you should write your own FAQ to publish!).

      (1) Usually, but not always, we tried to follow the concept of onX will return an event Xed. For example onClick given an event clicked, onSelect gives an event selected.

      (2) What I usually do, is just add some debug code to my page while developing:

      <%
        DATA: event       TYPE REF TO if_htmlb_data.
        event = cl_htmlb_manager=>get_event_ex( request ).
        IF event IS NOT INITIAL.
      %>
      <table border="1px" cellpadding="1px" cellspacing="0px" >
      <tr><td>Class</td>  <td><%=event->event_class%></td></tr>
      <tr><td>ID</td>     <td><%=event->event_id%></tr>
      <tr><td>Name</td>   <td><%=event->event_name%></tr>
      <tr><td>Type</td>   <td><%=event->event_type%></tr>
      <tr><td>svrName</td><td><%=event->event_server_name%></tr>
      <tr><td>Defined</td><td><%=event->event_defined%></tr>
      </table>
      <% ENDIF. %>
      

      Or maybe you can consider a slightly lightweight version. Just past this code at the bottom of each page.

      <%
         DATA: _event TYPE REF TO if_htmlb_data,
               _str   TYPE string.
         _event = cl_htmlb_manager=>get_event_ex( request ).
         IF _event IS NOT INITIAL.
           CONCATENATE `Event:`
                       ` Class=`       _event->event_class
                       `/ID=`          _event->event_id
                       `/Name=`        _event->event_name
                       `/Type=`        _event->event_type
                       `/Server_Name=` _event->event_server_name
                       `/Defined=`     _event->event_defined
                  INTO _str.
         ENDIF.
      %>
      <script>
      window.setTimeout("window.status='<%=_str%>'",250);
      </script>
      

      (3) I have completed a new weblog that describes how to use the HTMLB event system. Not everything that you want to know, but interesting. It will be published later this week.

      (4) Peek at CL_HTMLB_MANAGER=>CLASS_CONSTRUCTOR. It will go a very (very) long way into helping you get a complete overview of all events. (Keep in mind that this list is not 100% complete. The system is designed to work also with entries that are not on this list. It is only for rendering optimization: byte count.)

  • avatar image
    Former Member
    Jul 13, 2004 at 04:00 PM

    Hello All,

    Can you please tell me how to implement drop-downlist box in an iterator of the TableView control? I am building the Drop-Downlist element inside iterator class. But don'nt know how to populate values in that.

    Thanks in advance.

    Thanks And Regards

    Rajeev Patkie

    Add comment
    10|10000 characters needed characters exceeded

    • Rajeev,

      One interesting aspect I like about these new forums, in the find function. At the overview page for the forum, you can search for any keyword. It is like digging for gold, the only challenge is to think of some keywords to search for.

      My search found the dropdownlistbox-within-table-view-iterator that I had appended some time ago.

      The matching articles are:

      <b>BSP Programming: BSP Element Expressions (BEEs)</b>

      /people/brian.mckellar/blog/2003/10/30/bsp-programming-bsp-element-expressions-bees

      <b>BSP Programming: HTMLB TableView Iterator</b>

      /people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator

      The important aspect is always to make sure that the tables you fill are not local data (data: statements) in methods, as these will be gone when the iterator call returns. You must create the table as class attribute, or use the CREATE DATA call in ABAP.

      ++bcm