cancel
Showing results for 
Search instead for 
Did you mean: 

BSP Element - Dynamic tableView with Internal Table

Former Member
0 Kudos

Once again

I've created a new BSP Element and I have an Internal table of "Table Sizes"


* Type definitions
  TYPES: begin of mygrowthtab,
    name     type sumtabgrow-name,
    type     type sumtabgrow-type,
    size     type sumtabgrow-size,
    extents  type sumtabgrow-extents,
    dyn_siz  type sumtabgrow-dyn_siz,
    growth   type i,
  end of mygrowthtab,

  mygrowthtabtype type table of mygrowthtab.

* Data declaration
  DATA: MYGROWTH_TEMP TYPE MYGROWTHTAB.
  DATA: GROWTHTAB_COPY TYPE MYGROWTHTABTYPE.
  DATA: WGROWTHTAB_COPY TYPE MYGROWTHTAB.
  DATA: growtab TYPE TABLE OF SUMTABGROW.
  DATA: sizetab TYPE TABLE OF SUMTABGROW.
  DATA: wgrowtab TYPE SUMTABGROW.
  DATA: wsizetab TYPE SUMTABGROW.
  DATA: P1 TYPE P DECIMALS 0.

  CALL FUNCTION '/SDF/GET_DB_ORA_TABLES_GROWTH'
    DESTINATION rfcdest
    TABLES
      SUM_GROWTH_ALL    = growtab
      SUM_SIZE_ALL      = sizetab
    EXCEPTIONS
      WRONG_DATABASE    = 1
      NO_PERMISSION     = 2
      HISTORY_NOT_FOUND = 3.

* Concatenation of the output with the flux compensator
    data: table type ref to cl_htmlb_tableView.
    data: columns type ref to cl_htmlb_tableViewColumns.
    data: column type ref to cl_htmlb_tableViewColumn.

    table ?= cl_htmlb_tableView=>factory( id = 'dbsizetable'
                     width = '100%'
                     footerVisible = 'true'
                     fillUpEmptyRows = 'true'
                     table = sizetab
                     design = 'ALTERNATING'
                     sort = 'SERVER'
                     visibleRowCount = '10' ).

However I get the error ""SIZETAB" is not type-compatible with formal parameter "TABLE"."

I've been at it now for about 3 hours with no luck of determining why I get this error - I know it must be something simple that I am overlooking so if anyone can give me that good swift kick to the head I need - much appricated!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi everybody!

I'm trying to write a new bsp element and i'm having the same problems as Craig last time with the different that my internal table is outside of the class.

I pass this table from my new bsp extension to the handler class.


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@ extension name="tester" prefix="tst" %>
<htmlb:content design="design2003" >
 <htmlb:page title  = "Extension Pager ">
      <%
        data:  flight    type flight.
               select *
               from spfli
               into table flight
               where carrid = 'LH'.
  %>

  <htmlb:form>
   <tst:pager table_in="<%=flight%>" />
  </htmlb:form>
 </htmlb:page>
</htmlb:content>

My element has only the attribute "table_in" which is defined in the class as table_in type ref to data


my_table ?= cl_htmlb_tableview=>factory(  
                           id ='mytable'
                             ........
                                        )
get reference of table_in into my_table->table.

The class can be activated but not the bsp application.

I get this error each time the same error:

The type of "%_BSP_ELEM_3->TABLE_IN" cannot be converted to the type of 'FLIGHT'

I've been at it now for some hours trying to determe this error. Could anyone help?- Thanks!

Nestor

-


Message was edited by: Brian McKellar

Added code sequences to make easier reading. Please see on how code can be better appended.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

When you defined the table_in parameter in your custom element, did you mark the <b><i>Call by ref.</i></b> column? If you are going to use the <i>Type Ref To</i>, you will need to mark this. Take a look at the definition of the tableView in the HTMLB Extention if you have any questions. You will see that the table definition is <i>Call by ref</i> and the typing method is <i>Type Ref To</i>, and the assocation is <i>DATA</i>.

former_member181879
Active Contributor
0 Kudos

First question to check: Is this "type flight" really an internal table? Or structure? I could not find any reference to this in our system. Which does not mean anything. You must just ensure that you actually have a table. Or consider "type table of spfli".

Next problem, in your tag, you already have a reference onto a table. (I assume you declared it exactly the same as the table attribute of tableView.) Then you don't want to get another reference onto a reference. You should just write "my_table->table = table_in."

++bcm

Former Member
0 Kudos

Once again!

I've changed the type of my table flight to 'table of spfli' . But I'm still having the same problem.

The type of "%_BSP_ELEM_3->TABLE_IN" cannot be converted to the type of 'FLIGHT'

<%@page language="abap" %>

<%@extension name="htmlb" prefix="htmlb" %>

<%@ extension name="tester" prefix="tst" %>

<htmlb:content design="design2003" >

<htmlb:page title = "Extension Pager ">

<% data: flight <b>type table of spfli</b>.

select *

from spfli

into table flight

where carrid = 'LH'

.

%>

<htmlb:form>

<tst:pager table_in="<%=flight%>" />

</htmlb:form>

</htmlb:page>

</htmlb:content>

-


The reference in my tag was defined as: table_in type ref to data

Here is the code:

data: my_table type ref to cl_htmlb_tableview.

my_table ?= cl_htmlb_tableview=>factory(

id = 'mytable'

columnheadervisible = 'false'

design = 'alternating'

width = '100%'

footervisible = 'false'

selectionmode = 'none'

fillupemptyrows = 'false'

).

<b> my_table->table = table_in.</b>

while m_page_context->element_process( element = my_table ) =

co_element_continue.

What's wrong?

Thanks,

Nestor<b></b><b></b>

former_member181879
Active Contributor
0 Kudos

<i>What's wrong?</i>

I suspect a small case of reading carefully. I wrote once already before: "<b>I assume you declared it exactly the same as the table attribute of tableView.</b>"

You did not set the reference checkbox for your attribute table_in.

Former Member
0 Kudos

Hi Brian!

You are great. It works

Thanks

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I don't know what type of systems you are going against, but I checked by landscape (R/3 46C and WebAS 620). The function /SDF/GET_DB_ORA_TABLES_GROWTH wants /SDF/SUMTABGROW for that table defintion. However your code is passing it type SUMTABGROW. In my 46C system there are actually two different structure defintions. However in the WebAS there is only SUMTABGROW. You might just try using the BAPI Browser to generate a local type defintion for this interface parameter. That way you know you will match.

Former Member
0 Kudos

Thanks Thomas,

However I don't think that is the problem as the code works fine in a BSP itself. I am getting the error when I give the table to the tableView.

"SIZETAB" is not type-compatible with formal parameter "TABLE".

If I remove the table assignment it works. Have you create a BSP Element using the tableView yet?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

OK it is really early in the US and I'm still half asleep. Your right your problem is else where. The factory method wants type ref to data. The way that I have always done this is to leave the table out of the factory call. Right after the factory call add a line of code like the following:


table ?= cl_htmlb_tableView=>factory( id = 'dbsizetable'
                                   width = '100%'
                           footerVisible = 'true'
                         fillUpEmptyRows = 'true'
                                  design = 'ALTERNATING'
                                    sort = 'SERVER'
                         visibleRowCount = '10' ).

get reference of sizetab into table->table.

This will put a pointer to your internal table into the table parameter of the tableView.

Former Member
0 Kudos

Thank you that solved the problem!! So tell me is that something you learned from the years of ABAP or is that something specific to BSP's?

You on the East Coast or West? I mean being on the East Coast and being up is bad but if you are on the West Coast that's not much better

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Well the <i>type ref to data</i> isn't specific to BSP, but that was the first time I saw it used. Actually I figured it out when I wrote my first custom extension by setting a break point in a BSP view and switching to code view. You can then see the generated code that actually works with the classes behind the BSP Extensions. Since then I have used it in Table View Iterator classes and in some of the XML coding in ABAP I have done.

I am closer to the East Coast than the West, but we consider ourselves in the Middle. I am in Indiana so it was 2:xxAM when I first responded to your note.

Former Member
0 Kudos

You are either an early riser or a night owl. I was in Detroit before Germany.

Thanks a million for the help. I hadn't gotten to the debug mode as I couldn't get it to activate because of the error. Fall back on my Java days I guess - I need to have a better look at the whole ABAP debugging I have a feeling it's one of those things I've been missing