cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Value to Java Script Code in a BSP

Former Member
0 Kudos

Hi Guys,

In order to use BSP Extension in my BS i need to specify the "ID" for the field / Text area / Table i want to work with.

Now these elements (Field / Text Area / Table) are created by SAP CRM automatically and i am not sure how i can get the name of the ID for such a element.

I tried using FIREBUG in firefox to get this ID but the problem is that this ID changes dynamicaly and i cant hardcode it in my BSP application.

Can anybody point help me taht how can i determine the ID dynamically at runtime and then use it in my BSP application.

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

arunprakash_karuppanan
Active Contributor
0 Kudos

Hi,

You can pass data from SAP to javascript in the following way. Suppose I have created an input field like


<thtmlb:inputField id      = "IF1"
                   type    = "string"
                   visible = "false"
                   value   = "//mynode/myattr" />

Note that I have bound the input field to a context node attribute. This is only necessary if you wish to access this field inside your controller methods.

Now, you can access this input field in your javascript in the following way. Inside the script, setting th evalue or reading, whatever,


document.all("<%= controller->component_id %>_IF1").value = "some text" ;

Regards,

Arun Prakash

Former Member
0 Kudos

Hi Arun,

I am trying to do exactly as mentioned by you but i am getting an exception:

"Exception Class CX_SY_RANGE_OUT_OF_BOUNDS - Part-field access (offset = 0, length = 549) to a data object of the size 534 exceeds valid boundaries.

Method: CL_BSP_WRITER=>IF_BSP_WRITER~PRINT_STRING"

This is the piece of code which i am trying to work.

document.getElementById("<%= controller->component_id %>_iepcurrentlevel_struct.conc_lines")

Thanks in advance.

Edited by: Jeet on Mar 26, 2010 11:31 AM

rb
Active Participant
0 Kudos

You have the dynamic part ( e.g. C12_W21_V34 Component/Window/View) as an attribute in your controller. The attribute is named COMPONENT_ID. Just place a break point in your WebUI Event and navigate in the debugger to "me".

The static part of the id can you get via firebug. The only thing left is concate the hole thing.