This website is not affiliated with, sponsored by, or approved by SAP AG.

Display dynamically a picture not loaded

Development SAPscript/ Smartforms

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Display dynamically a picture not loaded

Postby picsou » Fri May 27, 2011 1:16 am

Hello,

I not find a solution in the forum.

My problem : I need to display a picture in the smartforms.

At present, I have a abap who display pictures from a server (c:\pictures\x\y\z\mypicture0001.jpg).
it's a program type : SAP_PICTURE_DEMO


But now, I must add a smartforms for the printout. Then my question is : how I can read directly the picture in this server ? Because, I can't upload each picture by SE78 (too much pictures). And I can't ask the user to load a new picture by SE78 at every time.

The user must put the picture in the directory "c:\pictures\x\y\z" and the smartforms must be able to read it (like the abap actually).

How do this ? Someone has a tips ?

thanks in advance.
picsou
 
Posts: 183
Joined: Wed Aug 20, 2003 3:51 am
Location: France / Alsace

Re: Display dynamically a picture not loaded

Postby Gothmog » Fri May 27, 2011 1:35 am

I'm not sure it's possible in a smartform.
Maybe try Adobe forms, if available ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Display dynamically a picture not loaded

Postby vivek98987 » Wed Dec 28, 2011 4:13 am

HI,
may be this piece of code helps u.. (use it in your smartform)

Code: Select all
DATA: docking TYPE REF TO cl_gui_docking_container,
      picture_control_1 TYPE REF TO cl_gui_picture,
      url(256) TYPE c .
DATA: query_table LIKE w3query OCCURS 1 WITH HEADER LINE,
      html_table LIKE w3html OCCURS 1,
      return_code LIKE  w3param-ret_code,
      content_type LIKE  w3param-cont_type,
      content_length LIKE  w3param-cont_len,
      pic_data LIKE w3mime OCCURS 0,
      pic_size TYPE i.
* END OF DO NOT CHANGE*************************************
DATA : sum(4) , num1(4) , num2(4).

parameters: path(20).
AT SELECTION-SCREEN OUTPUT.
  PERFORM show_pic.
START-OF-SELECTION.
*&-------------------------------------------------------------------
*& Form show_pic
*&-------------------------------------------------------------------
FORM show_pic.
  DATA: repid LIKE sy-repid.
  repid = sy-repid.
  CREATE OBJECT picture_control_1 EXPORTING parent = docking.
  CHECK sy-subrc = 0.
  CALL METHOD picture_control_1->set_3d_border
    EXPORTING
      border = 5.
  CALL METHOD picture_control_1->set_display_mode
    EXPORTING
      display_mode = cl_gui_picture=>display_mode_stretch.
  CALL METHOD picture_control_1->set_position
    EXPORTING
      height = 50
      left   = 500
      top    = 20
      width  = 400.
*CHANGE POSITION AND SIZE ABOVE***************************
  IF url IS INITIAL.
    REFRESH query_table.
    query_table-name  = '_OBJECT_ID'.
*CHANGE IMAGE NAME BELOW UPLOADED IN SWO0******************
    query_table-value = 'BIKER'.
    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
        object_not_found    = 1
        parameter_not_found = 2
        OTHERS              = 3.
    IF sy-subrc <> 0.
*      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    CALL FUNCTION 'DP_CREATE_URL'
      EXPORTING
        type     = 'image'
        subtype  = cndp_sap_tab_unknown
        size     = pic_size
        lifetime = cndp_lifetime_transaction
      TABLES
        data     = pic_data
      CHANGING
        url      = url
      EXCEPTIONS
        OTHERS   = 1.
  ENDIF.
  CALL METHOD picture_control_1->load_picture_from_url
    EXPORTING
*      url = 'file://C:\a.jpg'.
       url = path.        """"
  endform.
vivek98987
 
Posts: 1
Joined: Wed Dec 28, 2011 4:08 am


Return to SAPscript/Smartforms

Who is online

Users browsing this forum: No registered users and 4 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.