Attach document with method  CREATE_WITH_FILE

Hello,
I want to attach a document of my harddisk to an activity. Therefor  I want to use method CREATE_WITH_FILE.  But what parameters do I need to give the method for attaching a document to an activity ?
Hope spmeone can help me !
Thanks and best regards
Gerd

Hi Gerd,
The parameters you need to fill for CREATE_WITH_FILE method of class CL_CRM_DOCUMENTS are,
FILE_NAME = 'path of your file'.
BUSINESS_OBJECT-INSTID = 'GUID of your activity'.
BUSINESS_OBJECT-TYPEID = 'BUS2000126'.
BUSINESS_OBJECT-CATID  = 'BO'.
Followed by this method call CL_CRM_DOCUMENTS~RENAME_OBJECT since CREATE_WITH_FILE will attach your file to activity but the name will be of LOIO. so use method RENAME_OBJECT to rename the file in Activity.
parameters for RENAME_OBJECT method,
Structure IS_IO = 'Pass values of structure LOIO from CREATE_WITH_FILE method'.
IV_NAME = 'Name you require'.
Regards,
Karthik.

Similar Messages

  • Problem attach document with the FileUpload UI.

    I am trying to attach a document to a CRM Notification from application Web Dynpro for ABAP, I have build a FM that includes the method
    cl_crm_documents=>create_with_file
    When I test the FM from SE37 transaction, I am able to attach a file from a local disk succesfully. But If I call this FM from Web Dynpro, trying to do the same operation, document cannot attach to notification and Method returns the following error: “Error loading file ” (Class of message CRM_DOCUMENTS and number 100).
    Thanks in advance.
    FUNCTION z_crm_anexar_docs_inc.
    ""Interfase local
    *"  IMPORTING
    *"     VALUE(GUID) TYPE  CRMT_OBJECT_GUID
    *"     VALUE(FILENAME) TYPE  SDOK_FILNM
    *"     VALUE(PATH) TYPE  SDOK_CHTRD OPTIONAL
    *"     VALUE(DESCRIPTION) TYPE  STRING
      DATA: ls_bor   TYPE sibflporb,
            lv_loio  TYPE skwf_io,
            lv_phio  TYPE skwf_io,
            lv_error TYPE skwf_error.
    MOVE: 'BUS2000116' TO ls_bor-typeid, "aqui le pasamos el tipo de objeto que estemos tratando
            'BO'         TO ls_bor-catid,
            guid         TO ls_bor-instid.
      DATA: wa_result_tab TYPE string.
      DATA: result_tab TYPE STANDARD TABLE OF string.
      DATA: lin TYPE i.
      DATA: long_nombre TYPE i.
      DATA: long_total TYPE i.
      DATA: desplazamiento TYPE i.
      DATA: filename_aux TYPE skwf_descr.
      SPLIT filename AT '' INTO TABLE result_tab.
      DESCRIBE TABLE result_tab LINES lin.
      READ TABLE result_tab INDEX lin INTO wa_result_tab.
      IF sy-subrc EQ 0.
        long_total = STRLEN( filename ).
        long_nombre = STRLEN( wa_result_tab ).
        desplazamiento = long_total - long_nombre.
        path = filename(desplazamiento).
        filename = wa_result_tab.
        filename_aux = wa_result_tab.
      ENDIF.
    aqui le pasamos el guid del documento sap crm que estemos tratando
      CALL METHOD cl_crm_documents=>create_with_file
        EXPORTING
        aqui le pasamos el nombre del fichero que queremos anexar
          file_name       = filename
        'c:' "aqui le pasamos la ruta del fichero que queremos anexar
          directory       = path
          business_object = ls_bor
        IMPORTING
          loio            = lv_loio
          phio            = lv_phio
          error           = lv_error.
    aqui llamamos a este método porque de lo contrario el sistema crea el anexo con el nombre que
    le da la gana y no con el que hemos indicado en el punto anterior. por eso renombramos el fichero
      CALL METHOD cl_crm_documents=>rename_object
        EXPORTING
          is_io   = lv_loio
          iv_name = filename_aux.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      IMPORTING
        RETURN        =
    ENDFUNCTION.
    Call from WDA.
      CALL FUNCTION 'Z_CRM_ANEXAR_DOCS_INC'
        EXPORTING
          guid              = guid_jarcode
        guid              = stru_importing-guid
          filename          = stru_importing-filename
        PATH              =
          description       = stru_importing-description.
    ENDMETHOD.
    Thanks in advance.

    Hi,
    you can use below steps,
    1. Create attribute file_content of type xstring and bind it to data attribute of FileUpload UI .
    2.Put the button Upload next to your FileUpload UI element and write action upload.
    3. in action, read the attribute file_content and pass it to below code
    Convert XString to String
      CALL METHOD cl_abap_conv_in_ce=>create
        EXPORTING
          input       = file_content
          encoding    = 'UTF-8'
          replacement = '?'
          ignore_cerr = abap_true
        RECEIVING
          conv        = loc_conv.
    *Read the file contents
      TRY.
          CALL METHOD loc_conv->read
            IMPORTING
              data = file_content_string
        CATCH cx_sy_conversion_codepage.
    *-- Should ignore errors in code conversions
        CATCH cx_sy_codepage_converter_init.
    *-- Should ignore errors in code conversions
        CATCH cx_parameter_invalid_type.
        CATCH cx_parameter_invalid_range.
      ENDTRY.
    4. After that u may want to put the contents into internal table so use
      SPLIT file_content string AT crlf INTO TABLE itstring_tab.
    5. At last, fill the internal table
    loop AT it_string_tab INTO wa_string.
        CHECK sy-tabix GT 1 .    "skip the first line
        SPLIT wa_string AT ',' INTO .....
    endloop.
    here in my code i have splitted the contents at comma as i had .csv file . so based on file type u can split it and fill internal table.
    hope this will help you.
    Regards,
    Chandra
    (Award points if Helpful)

  • Problems with attached documents in Mail and Docs To Go

    Hello everybody.
    I've found a problem with attached documents in Mail. In fact, if I click on attached documents with .doc (microsoft office word 97-2004) and files in .docx Office Open .xml, the iPad doesn't open them, also if I click in "Open with Docs To Go (which should support these files' format)".
    How can I do? There's an application or another way to open these files?
    Other Informations:
    Docs To Go version: 5.2.2

    Update the patch to the Sapgui.
    Regards,
    Ignacio.

  • How to take print of attached document in PO

    Hi,
    In ME21N or ME22N, by clicking on "Services for Object" button on the extreme left side of the screen. We can attach any document (This is just below the transaction bar)
    I want to know how we can take the print of attached document with the PO itself.
    If anybody is having idea about this please share.
    My main issue is here user is having 2/3 page word document with each PO that he has to send to vendor.
    Everytime he has to write all the things in PO. So i had suggested to attach the file itself but now issue is of print.
    If you are having any other option please tell.
    Regards,
    Umesh Agrawal

    Dear,
    Since for each purchase order you are creating, a 2, 3 page text has to be attached in attachments.
    It is not possible to print purchase order and attachments at the same time. This must be 2 step process, first to print purchase order and next to attachments.
    For your situation, try to make purchase order and in item text window, simply copy and paste your 2,3 pages word note to the last line item of purchase order.
    For ex. if you have 6 line items in PO, select the last line item and go to Texts in item details and copy paste you word contents.
    For seperation of line items and text to vendor you can include some special character indication like below:
    SPECIAL NOTES / DIRECTIONS / VENDOR INSTRUCTIONS
    This will reduce your routine work of printing PO and attachments seperately. If you do like above, you will get the print of the Purchase order together with text at a time. I tried this.
    Regards,
    Syed Hussain.

  • Issue at Portal when attaching document.

    Hi all,
    We have a Portal configured with SSO to SRM 6.0. The SSO works with SRM, but when we try to attach documents with SRM shopping card, a password prompt happens.
    The SSO was configured fine. Still the password prompt is happening.
    Any suggestions or hints would be really great.
    -Vivek

    Hi,
    Please check your authorisation . You don't have authorisation to attach a document.
    In SSO it should ask for  a password second time
    Check with ITS server
    G.Ganesh Kumar

  • Automatic Archiving without losing the attached document ?

    Hi Experts,
    I wanted to go ahead with retention period so that documents will get auto archived after retention period.
    But since my last post (and your expert opinion), I understood that there is nothing like Retention period in DMS.
    If we want to achieve the mention functionality ...we need to do some developments.
    Now lets say I deletes the required documents with the help of program or CV04N...my next job is to archive the deleted (marked for deletion) documents....AUTOMATICALLY.
    2nd thing is after archival I should be able to see my attached document with DIR when I retrieve the archived DIR. 
    waiting for suggestions..
    Kind Regards,
    Sunil

    Archiving is in itself a separate engagement which needs planning.You can move the data to an external offline system bearing in mind the statutory data retention rules. You can also store the archived data on tapes or optical devices depending on the frequency of access.
    The below links illustrate techniques to archive and store data onto these external systems
    http://www.thespot4sap.com/articles/SAP_Data_Archiving_ADK_ArchiveLink.asp
    http://help.sap.com/saphelp_nw70/helpdata/en/ad/b594429d7c0631e10000000a1550b0/content.htm
    Regards,
    Pradeepkumar Haragoldavar

  • When attaching documents using GOS send them with workflow

    Hello experts,
    I have a scenario. We have to attach documents to SAP application using GOS. These documents can be edited also.
    Now second part is that when we attach the document or edit the document, the document should be send with the work item "when we attach the document".
    The first part of the scenario is completed and working fine. The second part of the scenario is causing problem. I have checked the various options but none of them are proving helpful.
    There is an option in GOS toolbar to send the documents through workflow but that also asks for the related workflow.
    I was trying to create an event for GOS object which can trigger the workflow automatically when the attachment are created and edited but can not go further with it as not so strong in workflow.
    I request you to kindly help me either in creating this event which will trigger the workflow (whole process) or any other method to do the same.
    Thank you all in advance.

    Hello Andrés,
    Thank you for replying. The main problem is starting the workflow. For that I need to create an event and that is my biggest trouble. I have seen the object IFSAP already. There are no events in it and as such I have created my custom object as super type.
    So I need to create the event from scratch.
    Hope my requirement is clear.
    Thank you.
    Edited by: Apoorv Lohani on Feb 3, 2012 7:54 AM

  • Error while creating document with attachment.

    Hi,
    I am getting an error "An error occured while creating the original attribute for PDF"
    I tried with out file attachment, it works as you know it is simple....
    I tried with various types of attachments like .TXT and .WRD (changed both wsapplication and docfile parameters), however i get the same error. I tried both from presentation and application server (by providing   pf_ftp_dest                = 'SAPFTPA'    pf_http_dest               = 'SAPHTTPA' )
    Any idea on how to solve this?
    All i need is create a DMS document with a PDF attachment from application server. Are there any other ways to solve this issue?
    ws_docdata-documenttype = 'ARE'.
    ws_docdata-description = 'BAPI DMS'.
    ws_docdata-statusextern = 'CR'.
    ws_file-storagecategory = 'DMS_C1_ST'.
    ws_file-wsapplication   = 'PDF'.
    ws_file-description = 'Job output'.
    ws_file-docfile = 'C:\CAD Integ BAPIS_46.pdf'.
    append ws_file to it_files.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
         documentdata               = ws_docdata
    IMPORTING
         return                     = v_ret
    TABLES
         documentfiles              = it_files   .
    BREAK-POINT.
    IF v_ret-type CA 'EA'.
      ROLLBACK WORK.
      WRITE : v_Ret-message.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = '5'.
    ENDIF.
    Thanks
    Pavan

    Hi,
    I found that it is due to document type = 'ARE'. I changed hte document type to one of hte standard type 'TST'. It works for presentation server, but does not work for application server. Any ideas? Any help is appreciated with points.
    ws_docdata-documenttype = 'TST'.
    ws_docdata-description = 'BAPI DMS'.
    ws_docdata-statusextern = 'CT'.
    ws_docdata-documentnumber = 'ZNG-10000000017'.
    ws_file-storagecategory = 'DMS_C1_ST'.
    ws_file-wsapplication   = 'PDF'.
    ws_file-description = 'Job output'.
    ws_file-docfile = p_file.
    append ws_file to it_files.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
        documentdata               = ws_docdata
       pf_ftp_dest                = 'SAPFTPA'
       pf_http_dest               = 'SAPHTTPA'
    IMPORTING
       documentnumber             = v_docnum
       documentpart               = v_docpart
       documentversion            = v_docver
       return                     = v_ret
    TABLES
       documentfiles              = it_files   .
    IF v_ret-type CA 'EA'.
      ROLLBACK WORK.
      WRITE : v_Ret-message.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = '5'.
    ENDIF.
    Thanks
    Pavan

  • Report to link invoices with attached documents

    I am trying to spool a report from the oracle back end, for some senior staff at my organisation. The report would contain approved invoices along with their electronically attached documents. I have a similar query that works( see below) the problem is this query only accurately ties invoice ID's(PK1_Value) for invoices that were created using "AP_INVOICES" enitity_name, but majority of our users dont have the payables responsibility and hence can only create using the "AP_INVOICES_INTERFACE" enitity_name, and I cant tie the PK1_VALUE in the fnd_attached_documents table to the invoice ID, Please I need urgent help to locate (a) what PK1_VALUE is being used by AP_INVOICES_INTERFACE (b) How I can reference INVOICE_ID with that value.
    SELECT SUP.vendor_name SUPPLIER, INV.invoice_num INVOICE,
    INV.invoice_amount AMOUNT, INV.remit_to_supplier_name,
    INV.description, APVL.approval_history_id, APVL.approver_name, DOC.url
    FROM ap_suppliers SUP, ap_invoices_all INV, ap_inv_aprvl_hist_all APVL,
    fnd_documents DOC, fnd_attached_documents ATCH
    WHERE SUP.vendor_id = INV.vendor_id
    AND INV.invoice_id = APVL.invoice_id
    AND INV.invoice_id = ATCH.pk1_value
    AND DOC.document_id = ATCH.document_id
    AND INV.wfapproval_status = 'WFAPPROVED'
    AND ATCH.entity_name = 'AP_INVOICES'
    AND APVL.response = 'APPROVED'
    AND INV.cancelled_by IS NULL
    ORDER BY SUPPLIER, INVOICE, APVL.approval_history_id
    Thanks in anticipation.

    991923 wrote:
    @Billy
    This is an oracle related question, and its not an in-built developed model. I was actually refered to this forum from oracle support.Billy is correct. Whilst it may be an Oracle question, it is not an SQL or PL/SQL related question.
    Your question is referring specifically to functions and entities that are only available to people using one of Oracle Apps type things (I don't use them myself)... So probably one of the forums in the E-Business suite (https://forums.oracle.com/forums/category.jspa?categoryID=3) would be more suitable.
    Oracle Support would not (or certainly should not) be referring someone to ask their question in the forums if it is an urgent commercial issue as these forums are not for commercial support.
    In these forums, nothing is "urgent" and it is considered rude to presume otherwise, both to the volunteers who help here, and to the other people who would like their questions answered.
    The reason i mentioned the tables AP_INVOICES_ALL and AP_INVOICES_INTERFACE is to give as much information about my problem as possible.That's great, but those tables do not exist as part of the standard Oracle database installation, and this SQL and PL/SQL forum is for questions related to the SQL and PL/SQL languages, not for questions related to specific applications that people here are unlikely to have, and for which, when they are Oracle provided applications, they have their own specific forums.

  • Is there a format for a file that I can use for attaching a one page document with photos embedded that will open in everyone's email automatically?   I've tried PDF and Word, but worked only in Mail.  Lost formatting when just copied and pasted in email.

    Is there a format for a file that I can use for attaching a one page document with photos embedded that will open in everyone's email automatically?   I've tried PDF and Word, but PDF worked only in Mail.  Word worked in nothing.  I also tried copying and pasting the document but lost all formatting when just copied and pasted in email.  Is there a way to do this?

    Are you sure PDF won't work? It should as what you're trying to do is pretty much what it is designed for (PDF - Portable Document Format). On a Mac anywone who receives the file should be able to see it in all its page layout glory by using the app Preview or Adobe Reader. Same on a PC, the file should be viewable as a PDF file using Adobe Reader and probably some other viewer (don't use PCs so not sure what other apps).
    What application are you creating the file in and are you sure you're exporting it correctly in PDF format, fonts and images embedded?

  • I have a Word doc with lots of Excel/Pdf attached doc inside. Can I convert this word doc in PDF keeping the attached documents inside the PDF? or do I have to attach all af them again? thank in advance

    I have a Word doc with lots of Excel/Pdf attached doc inside. Can I convert this word doc in PDF keeping the attached documents inside the PDF? or do I have to attach all af them again? thank in advance

    Attach all of them again.
    Be well...

  • Not able to attach the scanned document with Interaction Record in SAP-CRM

    Hi Experts,
    I have a scanned document and I am trying to attach it with Activity in Interaction Record.
    I maintained the document ID refering to scanned document in table TOA01 with interaction record guid; however the attachment gets displayed in SAP-CRM GUI but i am not able to see the attachment in SAP-CRM GUI.
    Please help if someone has encountered a similar issue or propose a way to attach the document with acitivity in interaction record.
    Regards,
    Amit Gupta.

    Hello Amit,
    I am not able to understand your requirement correctly. Are you trying to attach the Document as a Attachment to the Interaction record (or) trying to attach it as a Archive Link Document??
    If you could give me more info.. I think I will be able to assist you with this as I have worked in this area...
    Cheers..
    Anand

  • Document Distribution with attached documents coming across in BIN format

    Hello all,
    I have 3 dist types defined in the system.  RML, RMA, and INT
    RMA sends to SAP Office and includes a link to the document defined in DMS and seems to work correctly.
    RML sends the document to SAP Office as an attachment but the attached documents always is in BIN format and cannot be opened by the application.
    INT sends to my external email but has the same problem as above, the attachment is always in a BIN format and cannot be opened.
    This works the same with several different applications in DMS, Word, Excel, Text Files, etc.
    Can anyone give me an idea what I may be missing in config that is keeping this from working correctly.  We are running SAP ECC 6.0
    Thanks,
    Bill

    Hi Bill,
    Please check the following customizing in your system:
    1) Please check you have maintained suitable length of syntax group for
    Windows NT. Please maintain it more than 20.
    Please proceed as follows to correct this entry:
    Run the tcode SPRO
    Implementation Guide for R/3 Customizing (IMG)
    Cross-Application Components
      Document Management System
       Document Distribution
        General Settings
         Platform-Independent File Names
          Maintain file names and file paths across all clients
           Syntax group definition
    2) Please check the 'File processing' value for distribution type 'INT'.
    Please set it as '2'.
    Further please check note 355048 and as mentioned your settings in transaction DC30 for the workstation applications.
    Best regards,
    Christoph

  • How to attach a document with the Requisition Workflow?

    I am testing the Oracle Requisition Demo workflow.Whenever i initiate the
    workflow process with Reminder Requisition Document Option.The browser pop up
    with the Error "The requested URL cannot be retrieved". Can anyone please guide me how do i attach a document with this process?
    Regards,
    Abrar

    This field in the demo is designed to execute a PL/SQL procedure not store and attached document.
    for example if you launch it from the demonstration Page instead of the launch process page the following will be populated into the document field. (PLSQL:WF_REQDEMO.REMINDER_REQ_DOCUMENT/WFDEMO:A1)
    You can store a CLOB or BLOB in a workflow document attribute. Here is a link to the doc.
    http://download-west.oracle.com/docs/cd/B13789_01/workflow.101/b10284/defcom11.htm#doc
    If you want to upload and pass documents through a workflow you can do it in a variety of ways. Personally I would use Oracle Files if I wanted it off the shelf. Or use Oracle Text and the database and pass the document throught the workflow as a URL. There is also the CMSDK.

  • Sending an email with attachment with method SENDTASKDESCRIPTION.

    Hi everyone sorry for my english_;
    in custom workflow I set a Send Mail's step.
    If i try to send an email without attachments with method SENDTASKDESCRIPTION, the function SWW_SRV_MAIL_SEND return sy-subrc eq 0 and the email wa sent.
    If I try to attach a text, change binding for the step
    ATTACHOBJECTS -> &ATTACHMENTS& the step have an error in method SENDTASKDESCRIPTION execute the function SWW_SRV_MAIL_SEND; this function return an exception that had not defined.
    Thank's a lot.

    Hello.
    Take into acount that the attacment tha you pass to method has to be type of business object SOFM. The attachment is correctly created in the workflow container? Review the creation of the object to attach.
    How do you created the attachment?
    Regards.

Maybe you are looking for