cancel
Showing results for 
Search instead for 
Did you mean: 

MVC: comboBox/dropDownListBox in Page Fragment

Former Member
0 Kudos
61

Hi guys!

I've got the following setup:

Controller: MAIN (DO_INIT redefined to load the values for the user and a menu into a table)

Controller: PAGE (Superclass: MAIN)

View: Calls PAGE if I debug my values are there and in place and my user data is there.

Fragment: Header loaded with "inlcude" in PAGE without the comboBox or dropdownListBox it works and my user data is there, with it and my Application blows up with a short dump

The exception 'CX_BSP_ELEMENT_EXCEPTION' was raised but was not caught at any stage in the call hierarchy.

The reason for this exception is:

phtmlb:comboBox: Klasse CL_HTMLB_FORM wurde nicht gefunden als BSP-Parent-Element.

Anyone got an idea what I'm missing here?

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_schaufler
Active Contributor
0 Kudos

hi craig,

that's the error if you either missed out on the enclosing htmlb:form tag, or maybe because of the include not being called within opening and closing form tag

just have a look at the order in which these elements/tags are used:

*) <htmlb:form>

*) </htmlb:form>

*) include of your fragment (which contains the comboBox)

Former Member
0 Kudos

I use this code


        <phtmlb:comboBox id                 = "MyGlobalMenu"
                         table              = "<%= lv_global_menu %>"
                         nameOfKeyColumn    = "menu_id"
                         nameOfValueColumn  = "menu_img"
                         nameOfValue2Column = "menu_text"
                         onSelect           = "MyGlobalMenuSelect" />

If I remove those lines then it works if I put them in then it dies. Just those lines.

The whole fragment is:


<%@page language="ABAP" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="phtmlb" prefix="phtmlb" %>
<htmlb:group id     = "myHeaderG"
             design = "sapcolor"
             width  = "100%" >
  <htmlb:groupHeader>
    <htmlb:gridLayout columnSize  = "4"
                      rowSize     = "1"
                      cellPadding = "0"
                      width       = "100%" >
      <htmlb:gridLayoutCell columnIndex       = "1"
                            rowIndex          = "1"
                            verticalAlignment = "bottom" >
        <htmlb:image src     = "/sap/bc/bsp/sap/zsol_cen/logos/sap.gif"
                     tooltip = "SAP" />
        <htmlb:image src     = "/sap/bc/bsp/sap/zsol_cen/logos/b_logo.gif"
                     tooltip = "Hella Worldwide" />
      </htmlb:gridLayoutCell>
      <htmlb:gridLayoutCell columnIndex         = "4"
                            rowIndex            = "1"
                            verticalAlignment   = "middle"
                            horizontalAlignment = "right" >
        <htmlb:image src="<%= lv_lang_graphic %>" />
      </htmlb:gridLayoutCell>
    </htmlb:gridLayout>
  </htmlb:groupHeader>
  <htmlb:groupBody>
    <htmlb:gridLayout columnSize  = "4"
                      rowSize     = "1"
                      cellPadding = "0"
                      width       = "100%" >
      <htmlb:gridLayoutCell columnIndex       = "1"
                            rowIndex          = "1"
                            verticalAlignment = "bottom" >
        <htmlb:image src="@LC@" />
        <htmlb:textView text="<%= lv_name %>" />
      </htmlb:gridLayoutCell>
      <htmlb:gridLayoutCell columnIndex         = "2"
                            rowIndex            = "1"
                            verticalAlignment   = "bottom"
                            horizontalAlignment = "right" >
        <phtmlb:comboBox id                 = "MyGlobalMenu"
                         table              = "<%= lv_global_menu %>"
                         nameOfKeyColumn    = "menu_id"
                         nameOfValueColumn  = "menu_img"
                         nameOfValue2Column = "menu_text"
                         onSelect           = "MyGlobalMenuSelect" />
      </htmlb:gridLayoutCell>
    </htmlb:gridLayout>
  </htmlb:groupBody>
</htmlb:group>

maximilian_schaufler
Active Contributor
0 Kudos

can you post the code of the view that calls the include for this fragment as well?

I guess you missed out on the form tag there

Former Member
0 Kudos

Congratulations you just made it back to 3rd place in this forum

The location of my include on the VIEW was the problem.

maximilian_schaufler
Active Contributor
0 Kudos

anytime

Former Member
0 Kudos

Thank you!!!

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I have a question: why use a page fragment at all in a MVC. I usually avoid them like the plague becuase of the problems they cause with debugging. Instead I use the following to call a reusable controller/view:


<bsp:call url     = "labelDetails.do"
          comp_id = "ld" />

I'm just curious if I am missing out on something here.

Former Member
0 Kudos

Nope not missing out just me being lazy trying to convert a program over to MVC and cutting corners.

Former Member
0 Kudos

Hi guys,

I'm trying to do the same thing but not using MVC just a page with flow logic and I'm getting the following error: <b>An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause.</b>

I double check my code and I'm closing my statement <phtmlb:comboBox.... /> but still doesn't work.

Here is part of my code:

<%@page language="abap" %>

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

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

<htmlb:content design = "<%= htmlbDesign %>" controlRendering = "sap" rtlAutoSwitch = "true" >

<htmlb:document>

<htmlb:documentHead> <%@include file="head.htm" %> </htmlb:documentHead>

.

.

.

.

.

<htmlb:gridLayoutCell columnIndex = "2" rowIndex = "4" >

<htmlb:dropdownListBox id = "matkl" width = "100" selection = "<%= matkl %>" onSelect = "getSelection()" table = "<%= zt023 %>" nameOfKeyColumn = "matkl" nameOfValueColumn = "matkl" /> </htmlb:gridLayoutCell>

<%-- Row 5 --%>

<htmlb:gridLayoutCell columnIndex = "1" rowIndex = "5" verticalAlignment = "middle" horizontalAlignment = "left" >

<htmlb:label text = "Material" for = "material" />

</htmlb:gridLayoutCell>

<htmlb:gridLayoutCell columnIndex = "2" rowIndex = "5" >

<b><phtmlb:comboBox id = "matnr" width = "300"

selection = "<%= matnr %>" table = "<%= tmara %>"

nameOfKeyColumn = "matnr" nameOfValueColumn = "matnr"

nameOfValue2Column = "maktx" /></b>

</htmlb:gridLayoutCell>

Thanks in advance for any help.

Juan

Former Member
0 Kudos

I get this error when I don't assign a value to my view from the controller, using the view->set_attribute( name, value ).

Maybe one of your attribute values isn't getting filled somehow on the page. That's my best guess.

Former Member
0 Kudos

I fix the problem.

I got use <htmlb:content id="content" design="classicdesign2002design2003" instead of <htmlb:content design = "<%= htmlbDesign %>".

Apparently, I got use design2002 or design2003 to support or work with phtml.

Thanks any way

Answers (0)