cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert a dynamic link in an image

Former Member
0 Kudos

Hi all,

i was wondering if it is possible to insert a url to an image field so that the respective image will appear each time the user inserts a specific article in an ABAP program.

Or a respective sollution maybe..

Is it possible to pass a url through a program to the form??

Thank you in advance !

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi all,

i wanted to inform the ones still intrested for an answer that we have achieved this by using FormCalc.

The script goes like these:

$.value.#image.href = $record.TABLE[0].FIELD

, where table is your structure and field is the field where i pass my exact URL.

Thaank you all for participating

Former Member
0 Kudos

Dear All

I have a requirement to display the image after calling my web service program. Web service is fine and am returning the xstring with image data but how do i convert it to image in abap web service. Please assists me i really need this requirement to work because its urgent.

Regards

William Mutero

Former Member
0 Kudos

Not answered

Former Member
0 Kudos

Hi,

in my application it's the same behaviour. I see the image in the PDF Preview but not if I run the application. Did you solved the problem?

Best regards

Stefan

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I think your functionality can be achieved with Image Field Object.

These image fields are standard object in the libraray.

Please check the ALD help for detail.

Cheers

Satya

Former Member
0 Kudos

Hi,

i checked the Help file before posting but could not find any reference regarding my question.

If anyone is aware of JavaScript,

can i insert a url in the URL field of the Image Object by merging 2 fields ? What kind of code is needed for that ?

Thank you in advance.

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

I hope this post will definitely help you to solve your problem.

I am also attaching the sample java script with this post.

Steps to be followed

1. You have to use ImageField for dynamically displaying images

2. You have to write the following code in the initialise event of the image field

this.value.image.href = <URLof the Image>;

Dynamically you can populate this URL from the context. This URL can be a hidden field on the form and you can access that through java script.

Javascript sample code

if condition 1 -

this.value.image.href = "

<MachineName>
RED.GIF";

else

this.value.image.href = "

<MachineName>
GREEN.GIF";

Note : This is just the code template not complete code.

Cheers

Satya

Former Member
0 Kudos

Thanks Satya,

you provided me with the proper road

Regards,

Alex.

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Are you able to solve it completely? Or you are still facing some issue with it.

Cheers

Satya

Former Member
0 Kudos

Well,

i pass the exact url i want from my abap program into a field of the structure i use at the form.

Then, i use the following javascript :

this.value.image.href = URL.rawValue;

But still, the image does not appear although it has the proper url..

Any suggestions ?

EDIT: As far as i can see the PDF Preview tab (in the designer) shows me the image, but when i run my program i cannot view it neither after printing or print preview..

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Now We are at the last stage of solving the issue. This will work fine, just missing some minor step. First of all how are u sure that URL has correct.

Can you please hard code the URL in this.value.image.href

for example

this.value.image.href = " the URL u r passing";

If this is working then there is a problem in accessing the URL value.

Cheers

Satya

Former Member
0 Kudos

Yes, in the edition of my above post i tried this which you suggest.

The exact url is passed and while in the designer screen i can view it in the PDF Preview tab.

But if i print or preview the pdf after running the abap program i cannot view the image.

Is this sensible ?

Thank you.

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can you please tell me what is the exact URL value you are passing from the ABAP program?

Cheers

Satya

Former Member
0 Kudos

Let's start from the hard coding situation.

I insert this :

this.value.image.href = "http://www.plaisio.gr/ProductImages/250x250/1010646.jpg";

as script in the ImageField.

i042339
Product and Topic Expert
Product and Topic Expert
0 Kudos

I doubt this is something to do with proxy setting on R3 system.

Cheers

Satya

Former Member
0 Kudos

Hi,

Instead of writing the script,

drag the static image from Library palette to the layout.

In the object palette of the image you cna directly specify the URL.

Hope this will solve your problem

Regards,

sasi

Former Member
0 Kudos

This would solve the issue if i wanted a static image. In my case i wish to populate the URL field dynamically.

Former Member
0 Kudos

Hi Alexandros,

Did you solve your problem with dynamic image? I just hardcoded the url in the image-field script as "this.value.image.href = <URL>". I can see the photo (in the url) in the pdfnpreview tab but I can't see it after the running the appr. ABAP program.

Best Regards,

Former Member
0 Kudos

Hi Alexandros,

Did you solve your problem with dynamic image? I just hardcoded the url in the image-field script as "this.value.image.href = <URL>". I can see the photo (in the url) in the pdfnpreview tab but I can't see it after the running the appr. ABAP program.

Best Regards,

Former Member
0 Kudos

Hi there,

i have the same situation as you. It might be a basis thing, but i cannot be sure. Alternatively i am going to create a web folder in the system and put the photos i need there.. i will inform you if i have any news and please you do so!

Regards,

Alexandros.