Displayin document in Smartform

Hi everyone.
I am using the following code to read an attachment .
At the end of this code i'm using GUI_DOWNLOAD to download the data read from attachment into my system as a word document say filename C:\ XYZ.doc .This is working fine giving the right output
But My requirement is to display that document in the main window of smartform output.
what should i do after reading to display the attachment in smartform ? Is it required to Use GUI_DOWNLOAD and then read again and display in smartform?
CALL METHOD CL_BINARY_RELATION=>READ_LINKS_OF_BINRELS
  EXPORTING
    IS_OBJECT           = wa_met
   IP_LOGSYS           =
    IT_RELATION_OPTIONS = I_RANGE
   IP_ROLE             =
   IP_PROPNAM          =
    IP_NO_BUFFER        = SPACE
  IMPORTING
    ET_LINKS            = lt_old_links1
    ET_ROLES            = lt_roletypes1.
READ TABLE  lt_roletypes1 into wa_role  INDEX 2.
V_DOC = WA_ROLE-INSTID.
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
  EXPORTING
    DOCUMENT_ID                      = V_DOC
  FILTER                           = 'X '
IMPORTING
   DOCUMENT_DATA                    =  v_data
TABLES
  OBJECT_HEADER                    =
   OBJECT_CONTENT                   =  I_CON
  OBJECT_PARA                      =
  OBJECT_PARB                      =
  ATTACHMENT_LIST                  =
  RECEIVER_LIST                    =
   CONTENTS_HEX                     = I_HEX
EXCEPTIONS
   DOCUMENT_ID_NOT_EXIST            = 1
   OPERATION_NO_AUTHORIZATION       = 2
   X_ERROR                          = 3
   OTHERS                           = 4
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 GUI_download.

Hi Gautam,
  My requirement is of similar type .. using call function Gui_downoad i downloaded the attachments to desktop. but the file is not opening properly. it opens in some other format..
can you help me in this regard..
thanks.
vinoth

Similar Messages

  • Redirect to location in document in Smartform PDF

    Hello Smartform Gurus,
    How do I provide a link in smartform which will redirect to a location on the document when it is converted to PDF? Is it possible to do this by any chance?
    Thanks
    Prasad

    Just do htp.init; first.
    Scott

  • Printing a PDF document using SMARTFORMS

    What is the easiest way to print a PDF document from an ABAP program?  I have the data in the following formats:
    Binary (XSTRING)
    String (from function module HR_KR_XSTRING_TO_STRING)
    OTF
    What format can I use in a smartform to print the PDF in the background?
    Thanks in advance.

    Sandipan,
    If I use the UTF format, what do I use for the device type?  PDF1?  Also, I have the OTF data in an internal table which has to fields (TDPRINTCOM and TDPRINTPAR).  I pass this table into the smartform function module but what do I do with the 2 fields when I loop through the internal table in the smartform?  Do I just output a text node with TDPRINTPAR and ignoreTDPRINTCOM?
    TDPRINTCOM   TDPRINTPAR
    ==========    ==========
    //             XHPLJ4       0700 00000000001
    IN            04E/ERPIS/CARRIERLABEL
    IN            05%PAGE1
    OP            DINA4   P 144  240 1683811906000010000100000
    IN            06MAIN
    IN            03TABLE_BEGIN
    MT            0141701657
    CP           41030000E
    FC           COURIER 120  00144 SF012SF012410300144E

  • Attaching document to smartform

    Hi Experts,
    I want to pick up the attachment from the service ticket and attach it to the smartform.This smartform is triggered through an action.
    I am enhancing the method CRM_SRVORDER_EXEC_SMART_FORM:
    I have read the attachment using cl_crm_documents=>get_info.
    Now I am trying to attach this to the smartform using cl_document_bcs class.
    When i write:
    In the method  
    document = cl_document_bcs=>create_document(
                      i_type    = 'TXT'
                      i_text    = text
                      i_length  = l_strlen
                      i_subject = l_main_title ).
      call method document->add_attachment
           exporting  i_attachment_type    = 'TXT'
                      i_attachment_subject = ls_output_options-tdtitle
                      i_attachment_size    = l_otflen
                      i_att_content_hex    = binary_content
                      i_att_content_text   = text.
    LOOP AT t_attach INTO ls_attach WHERE mark = 'X'.
    CALL METHOD zsm_attach_phio_docu EXPORTING phio = ls_attach-phio document = document.
    ENDLOOP.
    DATA: properties TYPE sdokproptys.
      DATA: content_ascii TYPE sdokcntascs.
      DATA: content_bin TYPE sdokcntbins.
      DATA: propertie TYPE sdokpropty.
      DATA l_otflen TYPE so_obj_len.
      DATA: lv_size_i TYPE i.
      DATA: lv_buffer TYPE xstring.
      DATA: lt_content TYPE solix_tab.
      CALL METHOD cl_crm_documents=>get_document
        EXPORTING
          io            = phio
        IMPORTING
          properties    = properties
          content_ascii = content_ascii
          content_bin   = content_bin.
      lv_size_i = 0.
      REFRESH: lt_content.
      IF NOT content_bin[] IS INITIAL.
        DESCRIBE TABLE content_bin.
        lv_size_i = sy-tfill * sy-tleng.
        CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
          EXPORTING
            input_length = lv_size_i
          IMPORTING
            buffer       = lv_buffer
          TABLES
            binary_tab   = content_bin.
        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 u2018SCMS_BINARY_TO_XSTRINGu2019
    *EXPORTING input_length = lv_size_i
    IMPORTING buffer = lv_buffer
    *TABLES binary_tab = content_bin.
        CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer     = lv_buffer
          TABLES
            binary_tab = lt_content.
      ELSE.
        DESCRIBE TABLE content_ascii. lv_size_i = sy-tfill.
    sy-tleng.
        CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
          IMPORTING
            buffer   = lv_buffer
          TABLES
            text_tab = content_ascii.
    EXCEPTIONS
      FAILED           = 1
      OTHERS           = 2
        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 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer                = lv_buffer
      APPEND_TO_TABLE       = ' '
    IMPORTING
      OUTPUT_LENGTH         =
          TABLES
            binary_tab            = lt_content.
      ENDIF.
      DATA: file_name TYPE sood-objdes.
      DATA: ext TYPE soodk-objtp.
      l_otflen = lv_size_i.
      READ TABLE properties INTO propertie
      WITH KEY name = 'FILE_NAME'.
      SPLIT propertie-value AT
      '.' INTO file_name ext.
      lv_size_i = STRLEN( propertie-value ) - 4.
      file_name = propertie-value+0(lv_size_i).
      lv_size_i = lv_size_i + 1.
      ext = propertie-value+lv_size_i.
      CALL METHOD document->add_attachment
       EXPORTING i_attachment_type = ext
      i_attachment_subject = file_name
      i_attachment_size = l_otflen
    i_attachment_header = header
       i_att_content_hex = lt_content.
    The email comes with 2 attachments:
    1)the attachment of the service ticket
    2)the attachment of the service process BUT the service process information is not present .Instead the text passed in cl_document_bcs=>create_document overwrites it.
    How do I proceed?
    Thanks and Regards
    Shilpi

    You can attach any document in material master.
    Go to MM02 -
    open the material master u2013 then click on Services for object -
    and then click on Create attachment.
    Now u can attach any document from ur desk top.
    I hope it will help, if not let me know.

  • Interactive document using Smartforms

    Hi,
    The customer wants an interactive page to be developed using Smartforms with editable text field and checkboxes. Can this be done in Smartforms? If yes then can you please tell how to do it?
    I thought Smartforms in for output only. Can it be used to take inputs and perform some events based on these inputs?
    Please reply asap as the customer is behind me and I need to say if it is possible or not..
    Thanks in advance,
    Rashmi

    Rashmi,
    You will have to use the new ADOBE forms, which are interactive and the user can enter data. But I think its available with WAS 6.40. The transaction code is SFP.
    I am not sure which version of SAP / BASIS your on. If you are SAP R/3 4.6C or 4.7, this might not work.
    Hope this helps.
    Regards,
    Ravi
    Note : Please reward points if this helps.

  • Pdf document into smartform

    Dear Freinds,
    I need to get a pdf from DMS and print that to a smartform report, can any one suggest what to do ...
    currently i am able to print the bitmap file . but i need to workout  with pdf file ..
    Thanks in advance
    Deepak

    Florian Kemmer ,
    We have some graphix as pdf format into our DMS. to achive this we have already done the following steps
    1. With the help of 'BAPI_DOCUMENT_CHECKOUTVIEWX'  , we have downloaded the file into my local machine .
    2.if files are in bitmap format then we are using
                          PERFORM import_bitmap_bds
                          IN PROGRAM saplstxbitmaps
           to upload that file into the smartrom .
    3. but in case if the file is in pdf format (as most of the graphix is in PDF bcoz of size constraint)
       i am unable to upload that to smartform.
    hope now u will understanding my problem..
    Deepak

  • Documents for SMARTFORMS-Urgent

    Hi,
    I need to Learns SMARTFORMS In and Out, Can anyone please send my the material or link so that i can read it, it is really very urgent.
    Kindly Reply Back ASAP.

    hi,
    check these links
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sapgenie.com/abap/smartforms_detail.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.sap-basis-abap.com/sapsf001.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/8a/8c8a49def411d3969600a0c930660b/frameset.htm
    SAP PRESS REFERENCE
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf
    Regards,
    Sailaja.

  • SMARTFORM GUI_DOWNLOAD PDF error opening Adobe document

    When attempting to open Adobe document from Smartform converted to pdf using CONVERT_OTF and GUI_DOWNLOAD I get error.  The abap completed each step with no errors and oddly the final pdf file created to PC was either 10 or 15 Mb even.  The 15Mb version when downloaded to network is 17.867 Mb downloaded in background so it is obvious something is wrong.
    It should be
    Note 1107236 regarding size is not applicable as we are at SAP BASIS SP19 and this is not applicable.
    Step 1.      
            CALL FUNCTION 'CONVERT_OTF'
              EXPORTING
                FORMAT                = 'PDF'
              IMPORTING
                BIN_FILESIZE          = PDF_SIZE
                BIN_FILE              = PDF_DATA
              TABLES
                OTF                   = LT_OTFDATA[]
                LINES                 = L_DUMMY
              EXCEPTIONS
                ERR_MAX_LINEWIDTH     = 1
                ERR_FORMAT            = 2
                ERR_CONV_NOT_POSSIBLE = 3
                OTHERS                = 4.
    Step2. 
    Binary download table
            LV_VAR = PDF_SIZE DIV 1024.
            LV_VAR = LV_VAR + 1.
            DO LV_VAR TIMES.
              LV_VAR_FIRST = LV_VAR_FIRST + 1024.
              IF LV_VAR_FIRST LE PDF_SIZE.
                LV_VAR_FIRST = LV_VAR_FIRST - 1024.
                MOVE PDF_DATA+LV_VAR_FIRST(1024) TO LINE_BIN-DATA.
              ELSE.
                LV_VAR_FIRST = LV_VAR_FIRST - 1024.
                LV_VAR_LAST  = PDF_SIZE - LV_VAR_FIRST.
                MOVE PDF_DATA+LV_VAR_FIRST(LV_VAR_LAST) TO LINE_BIN-DATA.
              ENDIF.
              LV_VAR_FIRST = LV_VAR_FIRST + 1024.
              APPEND LINE_BIN TO DATA_TAB_BIN.
            ENDDO.
    Step 3.
                 CALL FUNCTION 'GUI_DOWNLOAD'
              EXPORTING
                FILENAME                = FNAME
                FILETYPE                = 'BIN'       " BIN
                CODEPAGE                = ZCODEPAGE   " issue 12869 02/10/2009 - 4110 is RU
              IMPORTING
                FILELENGTH              = LENGTH
              TABLES
                DATA_TAB                = DATA_TAB_BIN
              EXCEPTIONS
                FILE_WRITE_ERROR        = 1
                NO_BATCH                = 2
                GUI_REFUSE_FILETRANSFER = 3
                INVALID_TYPE            = 4
                NO_AUTHORITY            = 5
                UNKNOWN_ERROR           = 6
                HEADER_NOT_ALLOWED      = 7
                SEPARATOR_NOT_ALLOWED   = 8
                FILESIZE_NOT_ALLOWED    = 9
                HEADER_TOO_LONG         = 10
                DP_ERROR_CREATE         = 11
                DP_ERROR_SEND           = 12
                DP_ERROR_WRITE          = 13
                UNKNOWN_DP_ERROR        = 14
                ACCESS_DENIED           = 15
                DP_OUT_OF_MEMORY        = 16
                DISK_FULL               = 17
                DP_TIMEOUT              = 18
                FILE_NOT_FOUND          = 19
                DATAPROVIDER_EXCEPTION  = 20
                CONTROL_FLUSH_ERROR     = 21
                OTHERS                  = 22.

    bin_filesize            = PDF_SIZE must be added as parm to function GUI_DOWNLOAD.

  • Smartform error while printing multiple documents

    Hi Friends,
    When I am  trying to print individual documents the Smartform output is correct but when I select multiple documents its showing an error that says ' Table GRAPH does not fit into the window'. When I change the GRAPH node it says some other node does not fit. And it goes on.
    Is there any easy way to correct this error ?
    Please help.
    Regards,
    Dikshitha G

    Hi Dikshitha,
    First you need to check whether you have used TABLE under a secondary window or Main window? When you use table GRAPH under MAIN window then automatically next page will be printed and Window width adjusts automatically. Only make sure Hight and Width of Window should not be less than the Table. Click on Output tab of Main window and not down hight and width similarly check for TABLES.
    Regards,
    Gaurav.

  • Print number pages and formpages in a spool of multiple smartforms

    Dear all,
      I have created a program that create a spool using 4 smartforms. For each smartform the program can be create one o more pages. at the moment in my spool I have this situation:
      document #1:   smartforms#1  pag 1/1,
                             smartforms#2  pag 1/2, pag 2/2
                             smartforms#3  pag 1/1,
                             smartforms#4  pag 1/5, 2/5, 3/5, 4/5, 5/5.
      document #2:   smartforms#1  pag 1/1,
                             smartforms#2  pag 1/3, pag 2/3, pag 3/3
                             smartforms#3  pag 1/2, 2/2
                             smartforms#4  pag 1/4, 2/4, 3/4, 4/4.
    How I can modify my program in order to have this result:
      document #1:   smartforms#1  pag 1/9,
                             smartforms#2  pag 2/9, pag 3/9
                             smartforms#3  pag 4/9,
                             smartforms#4  pag 5/9, 6/9, 7/9, 8/9, 9/9
      document #2:   smartforms#1  pag 1/10,
                             smartforms#2  pag 2/10, 3/10, 4/10,
                             smartforms#3  pag 5/10, 6/10,
                             smartforms#4  pag 7/10, 8/10, 9/10, 10/10.
    Thanks in advance for any solutions.
    Mauro

    hi
    may be this hepls u, i have senn this in another thread..
    smartfom1.
    ssfcompop-TDNEWID = 'X'.
      ssfcompop-TDFINAL = ' '.
      ssfcompop-TDIMMED = ' '.
    smartfom2,3,4
    ssfcompop-TDNEWID = ' '.
      ssfcompop-TDFINAL = ' '.
      ssfcompop-TDIMMED = ' '.
    smartfom5,
    ssfcompop-TDNEWID = ' '.
      ssfcompop-TDFINAL = 'X'.
      ssfcompop-TDIMMED = 'X'.

  • Attachment access through smartforms

    Hi,
    I have a requirement in smartforms, like I need to open attachments of a word documents from smartform output which is a PDF.
    I would like to provide hyperlinks in smartform output, if which is clicked then saved word documents should be called and opened from DMS.
    No worry of word documents which are saved in DMS, just it need to be triggered and opened when the hyper link is clicked which is in smartform output(pdf).
    If any idea is there to solve this....please reply/suggest.
    Thanks in advance.

    user3636719 wrote:
    Hello Guru’s,
    I am working for a client where if you have access to server with few commands it will give you password for system.
    My question is how you can track who did what if too many people have access through system.
    select * from v$versionBANNER                                                          
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production                          
    CORE     10.2.0.5.0     Production                                        
    TNS for HPUX: Version 10.2.0.5.0 - Production                   
    NLSRTL Version 10.2.0.5.0 - Production         
    Change their OS passwords so they can no longer log onto DB Server system.
    Only DBA needs to log directly onto DB Server system; not even System Admins.

  • Auto triggering of smartform

    Hi,
    I have created a smartform alongwith its driver program. I have attached it to the output type WA03.
    Whenever I create a delivery which automatically confirms a TO and creates a material document, the smartform should have got automatically triggered. However it doesn't happen.
    Instead if I go to the transaction MB02 and do Process Output and do repeat processing the smartform gets triggered and displays perfectly.
    The problem is whenever the material document is created and at first processing of WA03 the smartform should have got displayed.
    The first processing status is green but the smartform is not displayed and is even not there in the spool.
    Please help.
    Regards,
    Amit Behera.

    hello amit,
    first i thougth that the message control it self is not getting triggered but as u said processing status is green and there is no spool created...
    put the break point in the print program.. when the message controle calls u r print program it will stop there then analyse wht is happening.. and check the NAST table entries also..

  • Change purchasing output control (from sapscript to smartform) Qusetion!

    I want to print a  Purchasing Documents by smartform.So i look for system standard program "SAPFM06P"->FORM ENTRY_NEU.
    In this form i found 2 function:'ME_READ_PO_FOR_PRINTING' and 'ME_PRINT_PO'. who can tell me the useful of function?(is it standard print function  to sapscript?)
    thanks

    Hi
    These are the Std function modules that are used in print programs
    'ME_READ_PO_FOR_PRINTING'
    will fetch the data from different PO related tables that is required for the script/smartform printing
    and 'ME_PRINT_PO' the fun module will print the PO printing.
    go to the respective fun modules source code and can find the more logic and documentation for them
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Print the Long text in Smartform

    Hi all,
    I designed a Work order document using Smartform for the T-Code 'IW32'.
    I am able to print the Operation short text, but there is one more provision for the user to enter long text also.
    I am not getting where this text gets stored in the database.
    Any one can give me some solution to over come this problem.
    Regards,
    Ravi Shankar

    hi Ravi,
    check this link
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/faq
    here in FAQ , you will know abiut how longtext is created and where it is stored
    it might be helpful to you.
    thanks
    Sachin

  • Create smartform in runtime

    Hi,
    I've build a program that my customer can use to add data to a smartform ( not really a smartform, but it collects the data and in the end it must show a smartform ).
    When all data has been collected I want to create a SMARTFORM from this data. So every time somebody creates a new document a smartform must be made.
    The program to call the smartform dynamicly and shows it to the customer is also ready.
    is there a FM, or someting else to create a smartform?
    thanx

    >
    Kim Wehrens wrote:
    > I've designed the smartform. (empty one with only one window).
    >
    > Now i want to update it with a couple of changes like interface (correct import and export parameters) and a couple of others things.
    >
    > I've created a lot of dynamic programs and even a couple of dynamic FM and Classes, but never a smartform.
    >
    > Still i think it's all just coding and there must be a way to change the coding in runtime.
    >
    > Who will help me please?
    Kim,
    First you should have a smartform...which you have now. Then, you have to declare internal tables in the Form Interface of the smartform.... Only then data from the program can be sent to the smartform.
    Now, for example itab contains data you want to print in smartform.  then in form interface, declare an table same that of the itab in program.
    Now, when you call the smartform generated function module, it will also contain the table declared in the tables tab in form interface like this:
    call function .....
    tables
    itab1 = itab " here you have to give the itab of the program which contains the data you want to print in smartform
    Now, in the smartform...you have to create text elements or tables based on the requirement to print itab1 fields. Here in the text elements you have to give the itab1 details.
    Hope you got some idea now.
    Vishwa.

Maybe you are looking for