Skip to Content
0
Former Member
Feb 20, 2011 at 02:15 PM

Create URL for image content and display in new window

758 Views

Hi,

I am attaching a new image and it is displayed in a table view.

I am having problems creating the URL for the image.

When i give the link of external site like http://www.google.com, it works fine. It does not work when i give as www.google.com.

It does not work for the image. Please help.

ls_properties-name = 'KW_RELATIVE_URL'.

ls_properties-value = lv_imgname.

APPEND ls_properties TO lt_properties.

ls_properties-name = 'LANGUAGE'.

ls_properties-value = sy-langu.

APPEND ls_properties TO lt_properties.

  • Assign file properties

ls_file_access_info-binary_flg = 'X'.

ls_file_access_info-file_name = lv_imgname.

ls_file_access_info-mimetype = 'image/pjpeg'.

ls_file_access_info-property = lv_string2.

APPEND ls_file_access_info TO lt_file_access_info.

  • Move content to file_content

lv_str = lv_img_content.

lv_strlen = XSTRLEN( lv_str ).

lv_offset = 1022.

lv_bytes_rd = 0.

lv_bytes_rm = lv_strlen.

ASSIGN lv_str TO <fs>.

WHILE lv_bytes_rd LT lv_strlen.

IF lv_bytes_rm LT lv_offset.

ls_content-line = <fs>+lv_bytes_rd(lv_bytes_rm).

ELSE.

ls_content-line = <fs>+lv_bytes_rd(lv_offset).

ENDIF.

APPEND ls_content TO lt_content.

lv_bytes_rd = lv_bytes_rd + lv_offset.

lv_bytes_rm = lv_strlen - lv_bytes_rd.

CLEAR ls_content.

ENDWHILE.

  • Create a Document using class CL_CRM_DOCUMENTS

CALL METHOD cl_crm_documents=>create_with_table

EXPORTING

business_object = ls_business_object

properties = lt_properties

file_access_info = lt_file_access_info

file_content_binary = lt_content

raw_mode = 'X'

IMPORTING

loio = ls_loio

phio = ls_phio

error = ls_error.

  • Using the logical and physical id's, get the file location as an URL

data:

lv_no type char1 value '1'.

CALL METHOD cl_crm_documents=>get_with_url

EXPORTING

loio = ls_loio

phio = ls_phio

url_type = '2'

IMPORTING

error = ls_error

url = lv_url1.

should i prefix the url with 'javascript:'?

Thanks in advance.

Regards

Shanthi