cancel
Showing results for 
Search instead for 
Did you mean: 

BSP-Error while adding a "Save-Button" to a View

Former Member
0 Kudos

Dear Community,

I have created a UI-Component which contains a Window and a View. I already connected the view to the window. What I'm trying now is to add a "Save-Button" to save the input of the view. This is my Structure:

The Code of USERINPUT.htm is as follows:

Here are my Questions

1) What exactly do i need to put into parameter "id" and "table" within the configCellerator? My window and view are connected and when it opens there should be the "Save-Button".

2) When I select "Test" my browser opens but I cannot see the preview, intead I get this exeption. Is my code wrong or where is my mistake?

Thank you for your help!

Marcel

Accepted Solutions (1)

Accepted Solutions (1)

kutjohn
Active Participant
0 Kudos

Hi Beskau

The ID is the HTML ID of the table controlled and is used in the html page.

The table parameter is actually an attribute of the CN00 class in your case its the node class of the node INPUTNODE

Try removing the config tag and put the xml inside the configCellrator itself.

<chtmlb:configCellerator actions               = "<%= controller->gt_actions %>"

                          id                    = "ConfCellTable"

                          table                 = "//INPUTNODE/Table"

                         width                 = "100%"

                          xml                   = "<%= controller->configuration_descr->get_config_data( ) %>" />

Regards JP

Former Member
0 Kudos

Hi John,

thanks for your fast reply!

I deleted everything except this:

<%@page language="abap" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="bsp" prefix="bsp" %>


<chtmlb:config mode = "RUNTIME"
                 xml = "<%= controller->configuration_descr->get_config_data( ) %>" />


and the "test" is working again:

I created this in the "Configuration" tab of the view with the help of Attributes from the Context Node. What i want now is to have a save button on the upper left. My goal is to input the information into the fields and then with clicking the button to start a predefined WF.

So the id is like the name i choose for my table, right? And my table is that what i created in the "Configuration" tab of the view i think.

Any Suggestions for further steps?

Thank you so much.

kutjohn
Active Participant
0 Kudos

Hi Beskau,

I think you have created a form view instead of table view because the node INPUTNODE is not a table view node.See the super class of the node class _CN00, it should be CL_BSP_WD_CONTEXT_NODE_TV for a table view.

And to add buttons you can add it using the actions attibure of the tag configCellrator.

chtmlb:configCellerator actions               = "<%= controller->gt_actions %>"

                          id                    = "ConfCellTable"

                          table                 = "//INPUTNODE/Table"

                         width                 = "100%"

                          xml                   = "<%= controller->configuration_descr->get_config_data( ) %>" />

Regards JP

Former Member
0 Kudos

Thanks for your help! It's the first time for me using the component workbench. I will try to change everything you mentioned and let you know if it worked!

Regards

Marcel

Former Member
0 Kudos

Is a table view really what I need for my requirement?

In the end I want to have a new entry in my navigationlist on the left side of the web ui. When I click on that this should be shown on the workingarea:

I then want to type in the information and with a click on a button I want to start a predefined workflow.

So I thought I can create a form view like above and connect it with my MainWindow. I then wanted to create this "Save-Button" on the upper left (or right) side which will start a predefined workflow with the input of those fields in the form view. In the last step I wanted to bind my UI component to the navigationlist.

Is my approach completly wrong?

nicolas_busson
Active Contributor
0 Kudos

Hi Marcel,

How to add a button in a form view is explained in a countless number of threads on scn, like this one that has already been locked because considered too basic question:

So it would be better if you could elaborate on what doesn't work out when following those threads.

Regards

Nicolas.

Former Member
0 Kudos

Thank you for your help!

former_member210661
Active Contributor
0 Kudos

Hi Marcel,

if you want to create buttons in your form view there is a method in your implementation class that is

get_buttons.

you have to implement the method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS from your implementation class.


example:

   *****************SAVE***************************************************************************
  CLEAR ls_button.
  ls_button-type     = cl_thtmlb_util=>gc_icon_save.
  ls_button-on_click = 'SAVE'.                              "#EC NOTEXT
  ls_button-page_id  = me->component_id.
  ls_button-enabled = abap_false.
  IF view_group_context IS BOUND.
    IF view_group_context->is_any_view_editable( ) EQ abap_true AND lr_entity->is_changeable( ) =abap_true.
      ls_button-enabled = abap_true.
    ENDIF.
  ENDIF.
  APPEND ls_button TO rt_buttons.

* Toolbar Divider
  CLEAR ls_button.
  ls_button-type     = cl_thtmlb_util=>gc_separator.
  ls_button-enabled  = abap_true.
  APPEND ls_button TO rt_buttons.
*****************************************************************************************************

And write an event handler for this:

   METHOD eh_onsave.

  DATA: lr_core    TYPE REF TO cl_crm_bol_core,
        lr_entity  TYPE REF TO cl_crm_bol_entity,
        lr_tx      TYPE REF TO if_bol_transaction_context.

  lr_entity ?= me->typed_context->btadmini->collection_wrapper->get_current( ).
  lr_tx ?= lr_entity->get_transaction( ).
  IF lr_tx IS NOT BOUND.
    lr_core = cl_crm_bol_core=>get_instance( ).
    lr_tx = lr_core->begin_transaction( ).
  ELSE.
    IF lr_tx->check_save_possible( ) = abap_true.
      CHECK lr_tx->save( ) EQ abap_true.
      lr_tx->commit( ).
    ENDIF.
  ENDIF.
  me->view_group_context->reset( ).


when ever you want to call any transaction while button click go through this link..



you can come to know how to call.

in that doc you have to create one transaction launcher for your standard workflow. then that tcode you

need to call using that concept..


if you want to create table view  go through this link..


SAP CRM WEB UI : 43.CREATING TABLE VIEW FOR LINE ITEMS WITH DEPENDENT CONTEXT NODES


CRM Web UI Technical - Creating Table View In Web UI - CRM - SCN Wiki


Thnaks & Regards,

Srinivas.

Former Member
0 Kudos

Thanks!

I added the following Code to my method DO_PREPARE OUTPUT.

DATA ls_button  TYPE crmt_thtmlb_button.
   CLEAR gt_button.

   ls_button-type         = cl_thtmlb_util=>GC_ICON_OBJECT_USER.

   ls_button-text         = 'Speichern'.

   ls_button-on_click     = 'Click'.

   ls_button-enabled      = ABAP_TRUE.

   INSERT ls_button INTO TABLE gt_button.


I also added this to my .htm view page:


<thtmlb:toolbar id              = "toolbar"
                 buttons         = "<%= controller->gt_button %>"
                 maxButtonNumber = "1" />


and my result is the button like seen on the screenshot



Where can I now define what should happen when clicking this button?

In the Event Handler (just showing EH_ONSELECT & EH_ONSORT) or in my Implementation Class?


nicolas_busson
Active Contributor
0 Kudos

Hi,

You just have to right-click on "event handler" in the component workbench, and select "create" as shown below:

A popup will be displayed where you'll be able to enter the name of the event 'click' that is used in your button (be careful as the value entered here is case sensitive). The system will automatically generate a method that will be called when you click on your button: enter your code there.

Regards,

Nicolas.

Answers (1)

Answers (1)

former_member210661
Active Contributor
0 Kudos

Hi Marcel,

I think this error is came because of your .htm cellerator is not convertng a proper way.

first of all tel me one thing when ever your creating any view that will ask which view you want

in that why don't you choose table view. if this is your requirement then fallow this .htm code.

this might be help full to you.

<%

DATA: lr_iterator1 TYPE REF TO if_htmlb_tableview_iterator.

   FIELD-SYMBOLS: <lt_entries1> TYPE TABLE.

   DATA: lr_entries1 TYPE REF TO DATA.

   lr_entries1 = controller->get_entries( ). " in this method i wrote a logic to fetch entity

   assign lr_entries1->* to <lt_entries1>.

   lr_iterator1 = controller->get_iterator( ). "here im getting iterator instance.

%>


  <thtmlb:gridCell columnIndex = "1"

                    colSpan     = "18"

                    rowIndex    = "2"

                    rowSpan     = "1" >

     <thtmlb:cellerator id                = "docdata"

                        table             = "<%= <lt_entries> %>"

                        verticalScrolling = "TRUE"

                        fillUpEmptyRows   = "FALSE"

                        width             = "100%"

                        selectionMode     = "NONE"

                        personalizable    = "FALSE"

                        scrollRowCount    = "3"

                        iterator          = "<%= lr_iterator %>" >

     </thtmlb:cellerator>

   </thtmlb:gridCell>

Thanks & Regards,

Srinivas.