cancel
Showing results for 
Search instead for 
Did you mean: 

chtmlb displayMode

Former Member
0 Kudos
197

Hi,

I'm trying to display a button only if the fields are not in display only mode. Currently I have the following code:

<chtmlb:config displayMode = "<%= controller->view_group_context->is_view_in_display_mode( controller ). %>"

mode = "RUNTIME" />

<%@extension name="/QAS/V6BPL_BSP_EXT" prefix="QAS" %>

<%

if displayMode = 'INITIAL'.

%>

<QAS:button_thtmlb applicationName = "<%= controller->application_name %>"

applicationNamespace = "<%= controller->application_namespace %>"

componentId = "<%= controller->component_id %>"

controllerName = "<%= controller->controller_name %>"

text = 'Search B2B' />

<%

endif.

%>

I am getting the error DisplayMode is not known.

Appreciate your help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member193352
Active Contributor
0 Kudos

Hi Jamie,

displayMode is an attribute of BSP extension chtmlb and hence can't be outside the chtmlb tag.

Try this code:


<%
data: lv_displaymode type abap_bool.
lv_displaymode = controller->view_group_context->is_view_in_display_mode( controller ).
%>

Now you can use value in variable lv_displaymode to achieve your requirement.

Thanks

Vishal

Former Member
0 Kudos

Thanks Vishal.

I'm now getting BSP_Elem_Factory_Construct is unknown. What does this mean?

former_member193352
Active Contributor
0 Kudos

Hi Jamie,

All these BSP element attributes must be used within the appropriate tags htmlb, thtmlb, chtmlb, etc.

I'm not sure where you have used this attribute in your code. if you could send me the code abstract that can help.

Thanks

Vishal

Former Member
0 Kudos

This is what I have. I just want to be able to check if the fields are in display only mode or not. Thanks for your help!


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<thtmlb:tray id     = "de"
             indent = "FALSE"
             design = "PLAIN" >

  <thtmlb:trayHeader>
    <thtmlb:textView id   = "TrayTitle"
                     text = "Adresse Principale" />
  </thtmlb:trayHeader>

  <thtmlb:trayBody>
    <thtmlb:grid cellSpacing = "1"
                 columnSize  = "1"
                 rowSize     = "2"
                 width       = "100%" >
      <thtmlb:gridCell rowIndex            = "1"
                       columnIndex         = "1"
                       width               = "100%"
                       horizontalAlignment = "LEFT" >
      <thtmlb:gridCell rowIndex            = "2"
                       columnIndex         = "1"
                       width               = "100%">
        <chtmlb:config displayMode = "<%= controller->view_group_context->is_view_in_display_mode( controller ). %>"
                       mode        = "RUNTIME" />
      </thtmlb:gridCell>


      <%
      data: lv_displayMode type abap_bool.
      lv_displayMode = controller->view_group_context->is_view_in_display_mode( controller ).
      if lv_displayMode IS BOUND.
      %>


      <%@extension name="/QAS/V6BPL_BSP_EXT" prefix="QAS" %>
        <QAS:button_thtmlb applicationName      = "<%= controller->application_name %>"
                           applicationNamespace = "<%= controller->application_namespace %>"
                           componentId          = "<%= controller->component_id %>"
                           controllerName       = "<%= controller->controller_name %>"
                           text                 = "<%= otr(Z3CSD01/Z3CSD01_BOUTON_SEARCHQAS)%>" />
      </thtmlb:gridCell>
      <%
      endif.
      %>
    </thtmlb:grid>
  </thtmlb:trayBody>
</thtmlb:tray> 

former_member193352
Active Contributor
0 Kudos

I'm not sure about this piece of code:


      <%@extension name="/QAS/V6BPL_BSP_EXT" prefix="QAS" %>
        <QAS:button_thtmlb applicationName      = "<%= controller->application_name %>"
                           applicationNamespace = "<%= controller->application_namespace %>"
                           componentId          = "<%= controller->component_id %>"
                           controllerName       = "<%= controller->controller_name %>"
                           text                 = "<%= otr(Z3CSD01/Z3CSD01_BOUTON_SEARCHQAS)%>" />

However, you can always use the standard button code:


<%
if lv_displayMode = abap_true.
<thtmlb:areaFrameSetter toolbarButtons  = "<%= controller->gt_button %>"
                                   maxButtonNumber = "2" />
endif.
%>

In order to fill gt_button, you can redefine DO_PREPARE_OUTPUT method and fill gt_button there.

Hope this helps.

Thanks

Vishal

Former Member
0 Kudos

Worked perfectly!

Much appreciated

Former Member
0 Kudos

Oh actually it hides the button just fine, but lv_displayMode is never = abap_true so the button is still not visible even when I am in edit mode.

former_member193352
Active Contributor
0 Kudos

I hope you are using the below statements in sequence.


<%
data: lv_displaymode type abap_bool.
lv_displaymode = controller->view_group_context->is_view_in_display_mode( controller ).
if lv_displayMode = abap_true.
<thtmlb:areaFrameSetter toolbarButtons  = "<%= controller->gt_button %>"
                                   maxButtonNumber = "2" />
endif.
%>

Former Member
0 Kudos

Meant to update this - I had changed the statement to check for abap_true when I was testing, and didn't change back.

It does work as I want. Thanks Vishal

Answers (0)