cancel
Showing results for 
Search instead for 
Did you mean: 

Set value for bookmark parameter for a word document

Former Member
0 Kudos

Hi All,

Can you please let me know how to Set value for bookmark parameter when opening a word document.

cl_wd_link_to_url=>new_link_to_url( bind_reference = lv_col_path ) is used to dynamically bind a display table field as URL link.

And the actual link is set using

data lir_element TYPE REF TO if_wd_context_element.

lir_element->set_attribute( name = 'LINK' , 'http://x.com/x.doc' )

I would like to achieve similar to the the following code(used in BSP)

lv_string = 'test'

CONCATENATE `javascript:openForm('http://x.com/x.doc', '`

lv_string `' )`

INTO lv_link.

Thanks in advance.

Regards,

Chamu

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Chamu,

can you be little more elaborate what you wana achive?? if its just changing the Target URL dynamically for a declared HTML element say hyperlink in your case you can use the JavaScript in BSP with

to get the current value of link ~ Document.getElementById( <attribute name> )

to Set the new value of link ~ Document.setElementById( <attribute name>, <new value> ).

Greetings

Prashant

Former Member
0 Kudos

Hi Prashant,

The word application link is created in a WDA.

Is JS allowed in WDA?

In my code

lir_element->set_attribute( name = 'LINK' , 'http://x.com/x.doc' )

I am able to set only the link using set_attribute method of interface if_wd_context_element. I am looking for a method that can set the bookmark parameter for this document..when the document opens it should be filled with the parameter value.

Thanks and Regards,

Chamu

Former Member
0 Kudos
Is JS allowed in WDA?

No Java Script cant be used directly in WDA.

I am able to set only the link using set_attribute method of interface
 if_wd_context_element.I am looking for a method that can set the bookmark 
 parameter for this document..

check the CONTEXT and you should find Attribute LINK then only u could have used

lir_element->set_attribute( name = 'LINK' , 'http://x.com/x.doc' )

if there is also an Attribute BOOKMARK you can use

lir_element->set_attribute( name = 'BOOKMARK' , 'SOMEVALUE' )

else you need to change the structure of the node to put attribute that can contain bookmark.

can you explain what are you trying to achieve, i am not able to understand what would BOOKMARK do within a WORD DOCUMENT ?? ideally bookmark would just be a link refering to some address as good as url.

Greetings

Prashant

Former Member
0 Kudos

Hi Prashant,

Sorry I need to fill a form field in a word document. This works in a BSP using the JS `javascript:openForm('http://x.com/x.doc', '`

lv_string `' )`

where lv_string is the value to be filled in the form field.

Regards,

Chamu

Former Member
0 Kudos

HI Chamu

openForm

seems to be a USER DEFINED JavaScript function, i dont think you will be able to fill field in FORM within a WORD document, directly from webdynpro abap.. without using file processing !! You might even try saving your word document as .XML file and then it with file processing process.

Greetings

Prashant

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you are on NetWeaver 7.0 EnhP1, you would have access to a new UI element called AcfExecute:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b91539878a2d67e10000000a42189c/frameset.htm

With this UI element you can trigger the execution of applications on the desktop and pass parameters to the application. You might be able to set the value of the bookmark this way with a command line parameters into Word or by writting a small script that runs on the client machine.

You might also consider using the OfficeControl UI elment to open the Word Document in place:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b91539878a2d67e10000000a42189c/frameset.htm

Otherwise I think you will have a difficult time performing this operation from WDA, since custom JavaScript is not allowed. You would have to run such code in an iFrame or navigate to a BSP page.

Former Member
0 Kudos

Thank you Thomas.

There is a UI element called officecontrol.Can that be a solution.

Rgds,

Chamu

Former Member
0 Kudos

Yes Prashant you are right. I will have to find a work around in WDA

Thank you for your help.

Rgds,

Chamu

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Thank you Thomas.

> There is a UI element called officecontrol.Can that be a solution.

>

> Rgds,

> Chamu

The office control was one of the items that I suggested that you consider. You will have to experiement and see if it will support your full requierment of setting a bookmark. You can push values into the word document, but might have to adjust how this is done.