cancel
Showing results for 
Search instead for 
Did you mean: 

Visualizar una imagen en Webdynpro

0 Kudos

Necesito mostrar la imagen de un empleado sap, para ello a partir del numero de empleado y usando la función HR_ESS_WHO_PROG_GET_PICT_URI obtengo una URL.

Aquí mi código en el método WDDOINIT

  DATA: lo_http_response TYPE REF TO if_http_response,
        lo_nd_empleado TYPE REF TO if_wd_context_node,
        lo_el_empleado TYPE REF TO if_wd_context_element,
        ls_empleado TYPE wd_this->elements_empleado.

* navigate from <CONTEXT> to <EMPLEADO> via lead selection
  lo_nd_empleado = wd_context->get_child_node( name = wd_this->wdctx_empleado ).

* get element via lead selection
  lo_el_empleado = lo_nd_empleado->get_element( ).
lv_pernr = '00006466'.

  CALL FUNCTION 'HR_ESS_WHO_PROG_GET_PICT_URI'
    EXPORTING
      pernr            = lv_pernr
      date             = sy-datum
      tclas            = 'A'
    IMPORTING
      uri              = lv_uri
    EXCEPTIONS
      not_supported    = 1
      nothing_found    = 2
      no_authorization = 3
      internal_error   = 4
      OTHERS           = 5.
  IF sy-subrc is initial.
    lv_url = lv_uri.
  ENDIF.

* get element via lead selection
  lo_el_empleado = wd_context->get_element( ).

* get single attribute
  lo_el_empleado->set_attribute(
    EXPORTING
    name = 'IMAGEN'
    value = lv_url ).

Resultado:

Former Member
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend you to read this overview: https://community.sap.com/resources/questions-and-answers and to take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html.

With these tips you'll be able to prepare questions that draw responses from our members. The more details you provide, the more likely it is that members will be able to answer your question. Should you wish, you can revise your question by selecting Actions, then Edit. By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM

Best,

Your SAP Community moderator

Accepted Solutions (0)

Answers (1)

Answers (1)

mateuszadamus
Active Contributor
0 Kudos

Hello m4lk4v14n

There is no IMAGEN attribute. That's why there is a short dump. Check the name, if there are no typos, otherwise check what attributes are available.

Kind regards,
Mateusz
0 Kudos
Hi there,

THE dump solved it.
The problem is that now I do not load the image of the url that the function retrieves

mateuszadamus
Active Contributor
0 Kudos

How did you solve the dump?

Missing image - maybe the URL is not set now? What attribute are you setting? What are available?

Kind regards,
Mateusz
0 Kudos

Im using FM HR_ESS_WHO_PROG_GET_PICT_URI, and return url in parameter URI.

The URI parameter only contains a part of the url therefore the link doesn't work.

URI is a char of 4096 but only a part is shown, and the programa only maps that part ...

How can i get the full url¿?


mateuszadamus
Active Contributor
0 Kudos

How did you upload the image?

Also, check out this answer, maybe it will be the solution: https://answers.sap.com/questions/10312611/how-to-get-url-path-of-image-which-i-uploaded-in-o.html


Kind regards,
Mateusz
0 Kudos

Image is in the system, with FM HR_ESS_WHO_PROG_GET_PICT_URI, we pass employer and this FM return the url.

I need display this URL in web dynpro.