Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

class method for generating URL for Web Repository

Former Member
0 Likes
1,453

Hi,

I want to know METHOD not FUNCTION MODULES for generating URL for Web Repository. A picture is stored in Web Repository (SMW0). The URL is used in CL_GUI_PICTURE=>LOAD_PICTURE_FROM_URL. I've tried LOAD_PICTURE_FROM_URL, but no valid URL generated.

Regards,

ts

4 REPLIES 4
Read only

Former Member
0 Likes
991

Hi,

The Function Module WWW_GET_MIME_OBJECT is used to get the MIME object for the Picture

and DP_CREATE_URL is used to create an URL.

Check the below code...it may helps you....

Data: g_picture           type ref to cl_gui_picture,

      g_custom_container2 type ref to cl_gui_custom_container,

*-- URL

data: v_url(255)          type c.                " URL-field

data: pic_data            like w3mime occurs 0.

data: pic_size            type i.

  call method cl_gui_datamanager=>on_input.

  • display LOGO

  create object g_custom_container2         exporting container_name = 'LOGO'.   create object g_picture         exporting parent = g_custom_container2.

  • Load the picture data from the WebRFC database into the internal
  • table pic_data.

  perform load_pic_from_db

          tables pic_data

          using 'Z_LOGO'

          changing pic_size.

  call function 'DP_CREATE_URL'

       exporting

            type    = 'image'

            subtype = 'X-UNKNOWN'

       tables

            data    = pic_data

       changing

            url     = v_url.

  call method g_picture->load_picture_from_url

       exporting url = v_url.

&----


*&      Form  LOAD_PIC_FROM_DB

&----


form load_pic_from_db

     tables pic_data

     using pic_name

     changing pic_size.

  data query_table like w3query occurs 1 with header line.

  data html_table like w3html occurs 1.

  data return_code like  w3param-ret_code.

  data content_type like  w3param-cont_type.

  data content_length like  w3param-cont_len.

  clear query_table.

  query_table-name = '_OBJECT_ID'.

  query_table-value = pic_name.

  append query_table.

  call function 'WWW_GET_MIME_OBJECT'

       tables

            query_string        = query_table

            html                = html_table

            mime                = pic_data

       changing

            return_code         = return_code

            content_type        = content_type

            content_length      = content_length

       exceptions

            invalid_table       = 1

            parameter_not_found = 2

            others              = 3.

  if sy-subrc = 0.

    pic_size = content_length.

  endif.

endform.                               " LOAD_PIC_FROM_DB

Regards,

Satish D R

Read only

0 Likes
991

Thank you for your reply. As I mentioned, I am looking for Class Method replacing those function modules; but thank you all the same.

Regards,

ts

Read only

0 Likes
991

Hi,

Why do you need methods? Instead you can use FM's itself.

Regards,

Satish D R

Read only

0 Likes
991

Just to explore classes.