cancel
Showing results for 
Search instead for 
Did you mean: 

Commands assignment to Images

Former Member
0 Kudos
54

Hi

I have notived that in 2004s that the new Button Group web Item allows the user to assign commands. eg: Bookmark. It does however not allow the user to assign an image instead of a Button. Yes, my client wants an image rather than a button.

It is also possible to insert an image however I have not been able to assign a command to an image. One of the configurable attributes of the Image is "onclick"

I was wondering if it is possible to assign a command to this attribute?

I have tried unsuccessfully to generate the code for bookmarking using the "script" menu item and then assigned this javascript to the image "onclick" attribute however this has not worked.

If anyone has used this functionality I would appreciate your input.

The following code is generated from the script meu item for Bookmark.

function Bookmark(currentState, defaultCommandSequence)

{

var commandSequence = new sapbi_CommandSequence();

//Create a new object of type sapbi_Command with the command named "EXPORT"

var commandEXPORT_1 = new sapbi_Command( "EXPORT" );

//End command commandEXPORT_1

//Add the command to the sequence

commandSequence.addCommand( commandEXPORT_1 );

//Create a new object of type sapbi_Command with the command named "SAVE_BOOKMARK"

var commandSAVE_BOOKMARK_2 = new sapbi_Command( "SAVE_BOOKMARK" );

//End command commandSAVE_BOOKMARK_2

//Add the command to the sequence

commandSequence.addCommand( commandSAVE_BOOKMARK_2 );

//Send the command sequence to the server

return sapbi_page.sendCommand( commandSequence );

}

I have assigned the javascript function to the onclick attribute and it is not currently working?

Does anyone have any ideas on how I can realise my clients business requirement?

Thanks in advance!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Fortunately I have found the solution:

The XHTML is as follows:

********************************************************

<!--

<p >

<img onclick="executeJS_SAVE_BOOKMARK_XSLT120( )" alt="Bookmark" src="bwmimerep:///sap/bw/Mime/BEx/Icons/bookmark.gif" border="0" />

</p>

<p >

<bi:SCRIPT_ITEM name="SAVEBOOKMARK" designwidth="300" designheight="70" >

<bi:SCRIPT value="biLargeData:3OPOSR8V8QD28TPCWD4GII60G" />

</bi:SCRIPT_ITEM>

</p>

</body>

</html>

</bi:bisp>

-->

<b>Please note that the executeJS_SAVE_BOOKMARK_XSLT120( ) is taken from the javascrript generated from the script item:</b>

The javascript from my script item is as follows:

**/

function executeJS_SAVE_BOOKMARK_XSLT120( currentState, defaultCommandSequence ){

//Note: information can be extracted using the parameter 'currentState'

// and 'defaultCommandSequence'. In either case create your own object

// of type 'sapbi_CommandSequence' that will be sent to the server.

// To extract specific values of parameters refer to the following

// snippet:

// var key = currentState.getParameter( PARAM_KEY ).getValue();

// alert( "Selected key: " + key );

//

// ('PARAM_KEY' refers to any parameter's name)

//Create a new object of type sapbi_CommandSequence

var commandSequence = new sapbi_CommandSequence();

//Create a new object of type sapbi_Command with the command named "SAVE_BOOKMARK"

var commandSAVE_BOOKMARK_1 = new sapbi_Command( "SAVE_BOOKMARK" );

//End command commandSAVE_BOOKMARK_1

//Add the command to the sequence

commandSequence.addCommand( commandSAVE_BOOKMARK_1 );

//Send the command sequence to the server

return sapbi_page.sendCommand( commandSequence );

}

Message was edited by:

Ian Carbonel

Message was edited by:

Ian Carbonel