Skip to Content

DP_CREATE_URL from application server cropped image

hello Folks i'm having an issue with DP_CREATE_URL loading a jpg in a container. the image is cropped and i can't manage to understand how have the full image.

here is my piece of code

TYPES pict_line(256) TYPE x.
  DATA: lt_pict_tab  TYPE TABLE OF pict_line,
         wa_pict_line TYPE pict_line,
         len          TYPE i,
         lv_size TYPE i.

  DESCRIBE FIELD wa_pict_line LENGTH len IN BYTE MODE.
  OPEN DATASET i_url FOR INPUT IN BINARY MODE.
  IF sy-subrc = 0.
    DO.
      READ DATASET i_url INTO wa_pict_line MAXIMUM LENGTH len.
      IF sy-subrc = 0.
        lv_size =  XSTRLEN( wa_pict_line ) + lv_size.
        APPEND wa_pict_line TO lt_pict_tab.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
  ENDIF.
  CLOSE DATASET i_url.
  CALL FUNCTION 'DP_CREATE_URL'
    EXPORTING
      type                       = 'IMAGE'
      subtype                    = cndp_sap_subtype_unknown
      size                       = lv_size
*   DATE                       =
*   TIME                       =
*   DESCRIPTION                =
*   LIFETIME                   =
*   CACHEABLE                  =
*   SEND_DATA_AS_STRING        =
    TABLES
      data                       = lt_pict_tab
    CHANGING
      url                        = lv_url
 EXCEPTIONS
   dp_invalid_parameter       = 1
   dp_error_put_table         = 2
   dp_error_general           = 3
   OTHERS                     = 4.

then i just use

CALL METHOD lo_picture->load_picture_from_url_async
EXPORTING
url = lv_url.

what do i miss please?

Is it a size issue?

Thanx in advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 14, 2020 at 03:58 PM

    issue solved by changing tthe code to:

      OPEN DATASET i_url FOR INPUT IN BINARY MODE.
      IF sy-subrc = 0.
        mlen = 1024.
        alen = 9999.
        WHILE alen <> 0.
          READ DATASET i_url INTO buffer MAXIMUM LENGTH mlen ACTUAL LENGTH alen.
          IF sy-subrc = 0.
            CONCATENATE content buffer INTO content IN BYTE MODE.
          ENDIF.
        ENDWHILE.
        CLOSE DATASET i_url.
    
        CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer        = content
          IMPORTING
            output_length = blob_size
          TABLES
            binary_tab    = blob.
    
        CALL FUNCTION 'DP_CREATE_URL'
          EXPORTING
            type                 = 'IMAGE'
            subtype              = 'JPG'
            size                 = blob_size
          TABLES
            data                 = blob
          CHANGING
            url                  = lv_url
          EXCEPTIONS
            dp_invalid_parameter = 1
            dp_error_put_table   = 2
            dp_error_general     = 3
            OTHERS               = 4.
      ENDIF.
    

    Hope this helps someone!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.