cancel
Showing results for 
Search instead for 
Did you mean: 

calling BSP on click button event

Former Member
0 Kudos

Hello,

I have the following button defined in a view:

<htmlb:gridLayoutCell id    = "Basic_Functions_1-1-1"
                columnIndex = "1"
                rowIndex    = "1" >

<bsp:call url="upwb.do">
  <bsp:parameter name="view_name" value="Button.view" />
  <bsp:parameter name="view_component_id" value="SaveButton5" />
</bsp:call>

</htmlb:gridLayoutCell>

And in <b>Button.view</b> to build this button:

<htmlb:button id       ="<%= r_button->get_id( ) %>"
                  text     ="<%= label %>"
                  tooltip  ="<%= title %>"
                  onClick  ="<%= onclick %>"
                  onClientClick = "<%= onclientclick %>"

Finally, in the view I call another BSP:

CALL METHOD
    cl_bsp_runtime=>construct_bsp_url
EXPORTING
    IN_APPLICATION = 'BSP2'
    IN_PAGE = 'index.htm'
    IN_PARAMETERS = params
IMPORTING
    OUT_LOCAL_URL = url.

How can I make this call to <b>BSP2</b> <i>ONLY</i> when the button (defined above) is pressed??

Thanks,

Timothy

Accepted Solutions (1)

Accepted Solutions (1)

Private_Member_9643
Active Contributor
0 Kudos

hi timothy,

for that u have to write code in OnInputProcessing event of EventHandler.

Try this,

DATA: event TYPE REF TO CL_HTMLB_EVENT.

CLASS cl_htmlb_manager DEFINITION LOAD.

event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

case event->ID.

DATA: event TYPE REF TO CL_HTMLB_EVENT,

CLASS cl_htmlb_manager DEFINITION LOAD.

event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

case event->ID.

when <!-- here ur button id will come --!>

here code will come which u like to perform when u click on that button.

like,

navigation->set_parameter(here whatever page attribute u like to set)= value for that attribute .

navigation->goto_page('index.htm').-> it will call index.htm with the page attributes u defined in that page using query string.

endcase.

regards,

kamaljeet

Former Member
0 Kudos

Thanks Kamaljeet,

I have implemented your solution and it is ok except that in my case statement, I call a separate BSP using a CALL METHOD. It never calls though!

The following is inside the event: <b>OnInputProcessing</b>:

-


...
...
DATA: event TYPE REF TO CL_HTMLB_EVENT.
CLASS cl_htmlb_manager DEFINITION LOAD.

event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

case event->ID.
  WHEN 'SaveButton5'.
  ...
  <!-- I fill in params -->
  ...
  CALL METHOD
    cl_bsp_runtime=>construct_bsp_url
  EXPORTING
    IN_APPLICATION = 'ZEPCTESTMCG'
    IN_PAGE = 'update.htm'
    IN_PARAMETERS = params
  IMPORTING
    OUT_LOCAL_URL = url.
endcase.

-


When I debug, when it arrives at the above CALL METHOD, it skips over it and never executes it! Why?

Thanks,

Timothy

Private_Member_9643
Active Contributor
0 Kudos

hi timothy,

its not working because the id is not matching, so just check out that u used id name as 'SaveButton5'or something else.

regards,

kamaljeet

Former Member
0 Kudos

Thanks for your help,

My table view is displayed fine now... the only thing left to do is that I made the last field editable by user. How can I write the user input into my SAP table (non-standard SAP table)??? You said with BAPIs?? Can you explain?

Thanks,

Timothy

athavanraja
Active Contributor
0 Kudos

in oninputprocessing collect the values into an internal table and use statement

<b>modify <dbtable> from table <itab>.</b>

modify <your Z table> FROM TABLE <internal table where you have the values> .

Please note that the structure of the itab has to be same as the structure of the DBtable.

Regards

Raja

Answers (1)

Answers (1)

rainer_liebisch
Contributor
0 Kudos

Hi Timothy,

if you click a button you fire an event to the server. This event can be handled in the method do_handle_event of the controller of your view (normally in the main controller). So don't use the coding to create a new URL inside your view. Move it to the do_handle event method and put it inside an if-clause where you chack that the correct button was pressed.

Regards,

Rainer