Send Smartform and Attachments from "Services for Object" in one Mail

Dear all,
We create a sales activity with transaction VC01n. We create a Smartform formluar and send the sales activity via E-Mail to the customer, this is working. Additionally we have some attachments in "Services for object".
How is it possible to send the formular and the attachments in one mail to the customer?
Thank you
Michael

Hi,
Unfortunaltly there is no standard solution to send forms and attachement in a mail.
you have to develop it .
If you need more help tell me .
regards

Similar Messages

  • Accessing attachments from 'services for object'

    I have been tasked with extracting data from external attachments from the 'services for object' button. I am working in an sap ecc 6.0  environment. I have not found any tips on how to do this from google searches.
    Here is an example. If you look at most of the major documents (purchase order, invoice, delivery, etc.) there will be a little dropdown icon in the upper left corner of the screen
    That icon is the 'Services for Object' button. Clicking on it will display a small popup window with several options including one for attached documents.
    If an attachment (could be word, excel, pdf, URL, etc.) exists it will show up and can be viewed by double clicking on it. Does anyone know how to access
    that attachment programatically?
    Thank you very much in advance.
    deepak

    Hi,
    Create a subroutine in your program and call the FM: SWU_OBJECT_PUBLISH as below:
    CALL FUNCTION 'SWU_OBJECT_PUBLISH'
        EXPORTING
          objtype           = gc_businessobj
          objkey            = gw_header-vbeln
        EXCEPTIONS
          objtype_not_found = 1
          OTHERS            = 2.
    This will automatically display your Services for Object ICON on your report. Here in the FM, gc_businessobj is a global business object = BUS2031(defined as a constant inside the pgm) and gw_header-vbeln can be any valid document no like a sale order, inquiry, quotation etc.
    Use this code snippet and this will work.
    Regards,
    JLN

  • Creating attachments from Services for Objects

    Hi,
    I am trying to create an attachment using the FM BDS_BUSINESSDOCUMENT_CREATEF. But it is giving me sy-subrc 4(ERROR_KPRO). Can anyone explain how to correct this and if u have any better code to attach files to BO's pls post it here.
    This is my code:
    DATA : files LIkE BAPIFILES OCCURS 1 WITH header line.
    files-doc_count = '1'.
    files-directory = 'C:\Documents and Settings\e529015\Desktop\'.
    files-filename = 'layout.jpeg'.
    APPEND files.
    data: lv_logsys type TBDLS-LOGSYS.
    CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
    IMPORTING
       OWN_LOGICAL_SYSTEM                   = lv_logsys
    EXCEPTIONS
       OWN_LOGICAL_SYSTEM_NOT_DEFINED       = 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 'BDS_BUSINESSDOCUMENT_CREATEF'
      EXPORTING
       LOGICAL_SYSTEM        = lv_logsys
        classname             = 'BUS2038'
        classtype             = 'BO'
       CLIENT                = SY-MANDT
       OBJECT_KEY            = '300023662'
      tables
        files                 = files
      SIGNATURE             =
    EXCEPTIONS
       NOTHING_FOUND         = 1
       PARAMETER_ERROR       = 2
       NOT_ALLOWED           = 3
       ERROR_KPRO            = 4
       INTERNAL_ERROR        = 5
       NOT_AUTHORIZED        = 6
       OTHERS                = 7
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Best Regards,
    Pavan Jhawar.

    Hi,
    Check this code...
    DATA: NUMBER_ATTACH TYPE i.
    Data Declaration for attachment ********
    data: go_myobject type ref to cl_gos_manager.
    data: lo_container type ref to cl_gui_custom_container,
          ls_object type borident.
    MODULE ATTACH_FILE input.
    if ok_code = 'CATC'.
      IF ZQTHD-JNAME is not initial.
    *******Number Ranges For ATTACHMENT ********
      if zqthd-objectkey is initial.
    CALL FUNCTION 'NUMBER_GET_NEXT'
      EXPORTING
        NR_RANGE_NR                   = '1'
        OBJECT                        = 'ZATTACH_NR'
      QUANTITY                      = '1'
      SUBOBJECT                     = ' '
      TOYEAR                        = '0000'
      IGNORE_BUFFER                 = ' '
    IMPORTING
       NUMBER                        = NUMBER_ATTACH
      QUANTITY                      =
      RETURNCODE                    =
    EXCEPTIONS
      INTERVAL_NOT_FOUND            = 1
      NUMBER_RANGE_NOT_INTERN       = 2
      OBJECT_NOT_FOUND              = 3
      QUANTITY_IS_0                 = 4
      QUANTITY_IS_NOT_1             = 5
      INTERVAL_OVERFLOW             = 6
      BUFFER_OVERFLOW               = 7
      OTHERS                        = 8
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
       endif.
      zqthd-objectkey = NUMBER_ATTACH.
      ls_object-objtype = 'ZQUOTATION'.
      ls_object-objkey  = zqthd-objectkey.
      call method go_myobject->start_service_direct
                    exporting
                          ip_service = 'PCATTA_CREA'
                          is_object = ls_object
                          io_container = lo_container.
    ENDIF.
    endif.

  • Need to find table for dispute case attachments in service for objects

    Hi All,
    I have a requirement where i need to find some tables which will hold details of dispute case attachments. After a dispute case is created using UDM_DISPUTE transaction, the concerned person may open that dispute case and can attach some documents/any attachments using services for objects icon at the top left corner of the screen. All i want to know is, in which table (tables related to service object) this attachment details will be stored. Even if the attachments details are stored in service objects related tables, there should be some link for this attachment and dispute case. Please let me know if any of you have some pointers and it would be highly appreciated.
    Thanks in advance,
    Srilakshmi.

    Hi a®s,
    Thanks for your reply. An entry is getting created in this table SRGBTBREL whenever an attachment/URL/notes is attached to a dispute case using services for object and the link between this table and dispute case table SCMG_T_CASE_ATTR is INSTID_A. This field holds the value of CASE GUID from SCMG_T_CASE_ATTR. Now my requirement is whenever an attachment is present in a dispute case i need to set a customized checkbox present in UDM_DISPUTE screen so that when an user opens the dispute case he/she can understand some attachment is present for this case by seeing the checkbox. I found the SCMG* badi's are not helpful to set the checkbox. Please let me know if you have any idea on how to implement it.
    Thanks in advance,
    Srilakshmi.

  • Retrieval of attachments with services for object in ME22n or ME23n

    Hello experts,
    I have a MM requirement where the user attaches some document in ME22n or ME23n via services for object functionality to a particular PO. Here the user wants to attach this document during sending of mail with ME9F to the vendor. First of all is it possible with the standard functionality of ME9F? or Requires some Zdevelopment. Anyone can guide me how to extract the attachment and send it with mail, does it require some configuration from functional side? I searched the forums but did not find the ways to extract.
    Thanks in advance
    Regards
    Raj (SAP ABAP)

    Hi Raj,
    Did you find a way to extract the attachment?

  • Forward PO as pdf attachment from Services for Object to external emails.

    Hi,  I am trying to forward PO to external email address from PO services for objects.  I could not send as pdf document to external email address.  SAP users are receving as SAP object in inbox.  I can achieve this trough Message Determination for vendors. However my requirement is to forward to muliple external parties and internal users who do not have SAP access.  Please advise any configuration or development need to be carried out to forward PO as pdf attachment.  Advance thanks for your valuable inputs.

    check answer given by Soumyaprakash in below thread:
    http://forums.sdn.sap.com/thread.jspa?threadID=2111142 and
    also have a look at below thread
    http://forums.sdn.sap.com/thread.jspa?threadID=1324971
    but i would like to know why you need to send PO to anybody but supplier?
    yogesh
    Edited by: Yogesh Lohiya on Feb 8, 2012 7:25 PM

  • Transfering Documents (mostly .jpg) from Services for Object to DMS

    Hi,
    We are presently in the process of finalizing document attachments via DMS system. We still have a high quantity of documents that were attached through the "Services for object" function (mostly .jpg ) and would like to transfer these to DMS without having to export them for every single object (mostly equipments). Is there any way to do this i.e. mass export of these attachments with their link (ex. at the top of the dialog box: AttachmentFor0000000...) so that they remain .jpg to be able to re-upload quickly in DMS system ?
    Thanks for your help !

    we have in the current system merger project a developer from SAP who is programming this feature for us, so I am pretty certain that there is nothing in standard that can do this job.

  • Attachments with services for object in ME42 along with RFQ via 'ME9A'  .

    Hello Guys,
    I have a MM requirement where the user attaches some document in ME42  via services for object functionality to a particular RFQ. Here the user wants to attach this document during sending of mail with ME9A to the vendor.
    As by SAP standards we are only able to send RFQ in PDF format to vendors.
    Thanks in advance
    Regards

    Hi,
    You can attach an attachment to RFQ IN ME9Avia E-mail. Communication strategy need to define in CS01. E-mail address need to maintain in vendor master record. Codition records need to maintain in NACE or IN mn04. Use sap note  191470. This is for PO, the same can be used for RFQ. Please refer below link for step by step assistance. Thanking you.
    RFQ send by mail through SAP server

  • Services for object buttons randomly disappearing from FB03

    Hello SAP Experts,
    We display an FI document via tcode FB03 (Display Document) and use the "services for object" buttons to attach documents via the "create attachment" button and also to view attached documents via the "attachment list" button.
    However, quite often when displaying the FI document after a document has been attached, the "services for objects" buttons are not displayed.  Just a blank toolbar appears.
    Later on the when the FI document is displayed again via tcode FB03 (Display Document), the "services for objects" buttons do appear and the attachments can then be displayed.
    As the attachments can be viewed sometimes, I would say that this issue is not related to security.
    Any idea's what maybe causing the "services for objects" buttons randomly disappearing???
    Regards,
    SAP Muppet

    Hello SAP Experts,
    Any ideas or comments here???
    Regards,
    SAP Muppet

  • Services for object - authorization/customization

    When you enter an employeenumber in eg. PA30, you get access to "Services for object" where you can add comments, files etc. to the employee object (PREL I guess).  The problem is that these services are not object to any kind of authorization control. So even if our users are limited both via P_ORGIN and structural authorizations, they can enter any employee number (if they know it) and read all information about the employee they don't have access to (and enter comments, attachments etc.)
    We don't want this option to be open, so we removed authorizations.  But I have 2 questions:
    1. Is there a standard way to hide services for objects. Customers never like to have access to a feature and be stopped by authorization.
    2. Is there a way to ensure authorization so that if you do not have access to the employee-number, you cannot enter or read anything from services for object.
    /kirsten

    Hi,
    This may help:
    http://help.sap.com/erp2005_ehp_05/helpdata/EN/4f/993844446d11d189700000e8322d00/frameset.htm
    SAP also has an Employee File Management solution in partnership with OpenText. A good white paper is this:
    http://www.insidesap.com.au/Files/White%20paper%20-%20An%20Introduction%20to%20SAP%20Employee%20File%20Management.pdf
    Source: help.sap.com
                  www.insidesap.com.au
    Donnie

  • Idoc info in 'Services for Objects' when a sales order is created

    Hi Guys
    Could one of you remind me how to turn on the Idoc info in the 'Services for Objects' > workflow option.
    I know how to turn on the services for objects using the user profile and entering parameter id:SD_SWU_ACTIVE , parameter value: X.
    I am not able to see the Idoc number/info that was used to create the sales order. I can see all the information in WE05 but the sales order does not show me any history of having used the Idoc.
    When i go to sales order and select the services for objects option followed by workflow the system should show the IDOC number/info used to create this order.
    Your help will be appreciated.
    Thanks
    Manish
    Edited by: Comes Naturally on Feb 23, 2009 3:46 PM

    Hi,
    1. Configure the IDoc with message type ORDERS and basic IDoc type as ORDERS05 (You have to follow common step-by-step approach)
    2. Configure Message Control to automatically generate IDoc whenever a Sales Order is created. (I mean output type)
    So whenever a Sales Order is created, output type will generate an IDoc.
    Hope this information is useful.
    Regards,
    AK

  • Difference in storage method for DMS and Services for Object

    Hi-
    Our R/3 version is: 4.7 Enterprise.
    In most (if not all) of the transactions users execute, there is a feature where they can attach a file using "Services for Object" from their PC to the associated record (i.e. material master, purchase orders, service notifications, etc.) 
    What I would like to know is where the document is stored.  From what I found on help.sap.com it says that it is a link from the user's PC.  But I would guess it is storing a copy of the file as a blob on the R/3 server somewhere.  Is this true?  Or is there a risk if the user's harddrive dies, that the file is no longer available for viewing? 
    I am trying to determine the difference between using the Services for Object feature vs. DMS and setting up an object link for the specific object type (i.e. material).
    Thanks!
    -Jenn

    I found the following about Services for Objects: 
    Business Workplace
    The documents that were appended to an object using Create attachment and Create note are stored in the Business Workplace. There, for example, you can make settings for where the documents should be stored (R/3 System or Web Server) and which document classes may be loaded in the SAP System (for example DOC, but not EXE).
    Sending is also carried out internally using the Business Workplace. Messages are created that contain a link to the object as an attachment. By double-clicking on the attachment, the users can call the default method of the object. This is normally the display method.

  • Upgrade 4.6C -- ERP2005 and "Services for object" in all modules

    Hello,
    We have used Services for object in several modules; mainly MM, QM, and SD. The types used are URL, notes, private notes, and attachments.
    For example a vendor master (tra XK02) can have attachments, private notes, and URL.
    From where can I find information what will happen and how to handle all this data when the upgrade from 4.6C to ERP2005 (Unicode compatible) will take place? We need to know how to store the data.
    I haven't located any tables or structures.
    Help is highly appreciated and points rewarded.
    BR,
    Pia

    Hello,
    Thanks for your reply. So, according to your knowledge the paths are adjusted during the upgrade?
    BR;
    Pia

  • GOS and Services for objects are same?

    Hi
    Pls clarify my points
    Services for objects and GOS(Generic object service) are both same or different?
    To my understanding it looks like different as follows
    -Service for objects is single icon to click for attachment, can be used only from front end execution.
    -GOS is a toolbar kind of icon, have collection of menu inside, can be used for background execution also.
    Both functions are different? Pls confirm.
    Regards
    ckumar

    Understood the problem
    both are same

  • Attachments to Notifications - using "Services for Object"

    Hi All,
    I have sucessfully created a VC application (7.0 sp13) to create a General Notification in R/3
    using the BAPI -  IQS4_CREATE_NOTIFICATION
    Our users in R/3 4.7 use the button in the Top Left Hand corner of the Screen "Services for Object"
    to attach MS Word documents to Notifcations. Using the Create Attachment option from the Services for Object toolbar that pops up when the button is clicked.
    Has anyone else tried this or have any advice on how this can be done in VC - if you can recommend a BAPI that I can try or will this be a custom ABAP BAPI.
    Thanks in advance for any advice you can offer.
    - Robert

    FUNCTION z_pm_attachment_and_url.
    *"*"Interface local:
    *"  IMPORTING
    *"     VALUE(I_QMNUM) TYPE  QMNUM OPTIONAL
    *"     VALUE(I_AUFNR) TYPE  AUFNR OPTIONAL
    *"     VALUE(I_URL) TYPE  SO_URL OPTIONAL
    *"     VALUE(I_FILE) TYPE  ZPMCT002 OPTIONAL
    *"     VALUE(I_FILENAME) TYPE  STRING OPTIONAL
    *"  TABLES
    *"      T_RETURN STRUCTURE  BAPIRET2
    * Objetos locais
      DATA:
        vl_url         TYPE so_url,
        vl_path        TYPE string,                             "#EC NEEDED
        vl_loopc       TYPE sy-loopc,
        vl_lines       TYPE sy-loopc,
        vl_filename    TYPE string,
        vl_filelength  TYPE i,
        it_url         TYPE STANDARD TABLE OF sood-objdes,
        it_obj_cont    TYPE STANDARD TABLE OF solix,
        wa_obj         TYPE borident,
        wa_obj_cont    TYPE soli,
        wa_obj_data    TYPE sood1,
        wa_folder_id   TYPE soodk,
        wa_document_id TYPE sofmk.
      DEFINE valida_retorno.
        loop at t_return into t_return.
          if t_return-type eq zgtpm_e.
            exit.
          endif.
        endloop.
        if t_return-type eq zgtpm_e.
          exit.
        endif.
      END-OF-DEFINITION.
    * === Valida parâmetros de entrada
      IF i_qmnum IS INITIAL AND i_aufnr IS INITIAL.
    *   Nenhum objeto informado: Informe Nota ou Ordem de Manutenção
        PERFORM mensagem_retorno_tab
        USING
          'ZPM_PORTAL' zgtpm_e '055' '' '' '' ''
        CHANGING
          t_return[].
        EXIT.
      ELSEIF NOT i_qmnum IS INITIAL AND NOT i_aufnr IS INITIAL.
    *   Informe apenas um objeto: Nota ou Ordem de Manutenção
        PERFORM mensagem_retorno_tab
        USING
          'ZPM_PORTAL' zgtpm_e '054' '' '' '' ''
        CHANGING
          t_return[].
        EXIT.
      ENDIF.
      IF  i_url IS INITIAL
      AND i_filename IS INITIAL.
    *   Informe Anexo e/ou URL
        PERFORM mensagem_retorno_tab
        USING
          'ZPM_PORTAL' zgtpm_e '060' '' '' '' ''
        CHANGING
          t_return[].
        EXIT.
      ENDIF.
    * === Define Categoria de objeto
      IF NOT i_qmnum IS INITIAL.
        wa_obj-objkey  = i_qmnum.
        wa_obj-objtype = 'BUS2038'. " Nota PM
      ENDIF.
      IF NOT i_aufnr IS INITIAL.
        wa_obj-objkey  = i_aufnr.
        wa_obj-objtype = 'BUS2007'. " Ordem de manutenção
      ENDIF.
    * === Anexo
      IF NOT i_filename IS INITIAL.
    *   Conteúdo do arquivo
        IF NOT i_file[] IS INITIAL.
          it_obj_cont[] = i_file[].
          DESCRIBE TABLE it_obj_cont LINES vl_lines.
          READ TABLE it_obj_cont INTO wa_obj_cont INDEX vl_lines.
          vl_filelength =
            ( 255 * ( vl_lines - 1 ) ) + STRLEN( wa_obj_cont ).
        ELSE.
          CALL FUNCTION 'GUI_UPLOAD'
               EXPORTING
                    filename                = i_filename
                    filetype                = 'BIN'
               IMPORTING
                    filelength              = vl_filelength
               TABLES
                    data_tab                = it_obj_cont
               EXCEPTIONS
                    file_open_error         = 1
                    file_read_error         = 2
                    no_batch                = 3
                    gui_refuse_filetransfer = 4
                    invalid_type            = 5
                    no_authority            = 6
                    unknown_error           = 7
                    bad_data_format         = 8
                    header_not_allowed      = 9
                    separator_not_allowed   = 10
                    header_too_long         = 11
                    unknown_dp_error        = 12
                    access_denied           = 13
                    dp_out_of_memory        = 14
                    disk_full               = 15
                    dp_timeout              = 16
                    OTHERS                  = 17.
          IF sy-subrc <> 0.
            PERFORM mensagem_retorno_tab
            USING
             sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            CHANGING
              t_return[].
            EXIT.
          ENDIF.
        ENDIF.
    *   Pasta de Destino
        PERFORM get_folder CHANGING wa_folder_id t_return[].
        valida_retorno.
    *   SAPoffice: definição do objeto, modificar atributos
        wa_obj_data-objla  = sy-langu.      " Idioma
        wa_obj_data-objsns = 'O'.           " Objeto confidencial
        wa_obj_data-objlen = vl_filelength. " Tamanho conteúdo documento
        wa_obj_data-ownnam = sy-uname.      " Nome proprietário
        CALL METHOD cl_report_viewer=>split_path_filename
        EXPORTING
          i_filename = i_filename
        IMPORTING
          e_path     = vl_path
          e_filename = vl_filename.
        SPLIT vl_filename AT '.' INTO
          wa_obj_data-objdes    " Descrição breve do conteúdo
          wa_obj_data-file_ext. " Extensão de file de uma aplicação PC
        CONDENSE wa_obj_data-file_ext NO-GAPS.
    *   Insere Objeto (Anexo)
        PERFORM object_insert
        USING
          'EXT' " Anexo
          wa_obj_data
          wa_folder_id
          it_obj_cont
        CHANGING
          wa_document_id
          t_return[].
        valida_retorno.
    *   Relacionamento Objeto PM x Anexo
        PERFORM relation_create
        USING
          'ATTA'
          wa_obj
          wa_document_id
        CHANGING
          t_return[].
        valida_retorno.
      ENDIF.
    * === URL
      IF NOT i_url IS INITIAL.
    *   Inicializa estruturas comuns a Anexo e URL
        CLEAR:
          it_obj_cont,
          wa_obj_cont,
          wa_obj_data,
          wa_folder_id,
          wa_document_id.
    *   Conteúdo da URL
        MOVE i_url TO vl_url.
        WHILE NOT vl_url IS INITIAL.
          CONCATENATE '&KEY&' vl_url(250) INTO wa_obj_cont.
          APPEND wa_obj_cont TO it_obj_cont.
          SHIFT vl_url LEFT BY 250 PLACES.
        ENDWHILE.
    *   Pasta de Destino
        PERFORM get_folder CHANGING wa_folder_id t_return[].
        valida_retorno.
    *   SAPoffice: definição do objeto, modificar atributos
        wa_obj_data-objla  = sy-langu. " Idioma
        wa_obj_data-objsns = 'O'.      " Objeto confidencial
        wa_obj_data-ownnam = sy-uname. " Nome proprietário
        SPLIT i_url AT '/' INTO TABLE it_url.
        DESCRIBE TABLE it_url LINES vl_loopc.
        READ TABLE it_url INDEX vl_loopc
        INTO wa_obj_data-objdes. " Descrição breve do conteúdo
    *   Insere Objeto (URL)
        PERFORM object_insert
        USING
          'URL'  " Link Inter/Intranet
          wa_obj_data
          wa_folder_id
          it_obj_cont
        CHANGING
          wa_document_id
          t_return[].
        valida_retorno.
    *   Relacionamento Objeto PM x URL
        PERFORM relation_create
        USING
          'URL'
          wa_obj
          wa_document_id
        CHANGING
          t_return[].
        valida_retorno.
      ENDIF.
    * === Libera objetos locais
      FREE:
        vl_url,
        vl_path,
        vl_loopc,
        vl_lines,
        vl_filename,
        vl_filelength,
        it_url,
        it_obj_cont,
        wa_obj,
        wa_obj_cont,
        wa_obj_data,
        wa_folder_id,
        wa_document_id.
    ENDFUNCTION.
    ***INCLUDE LZGPM0010F01 .
    *&      Form  mensagem_retorno_tab
      FORM mensagem_retorno_tab
      USING
        p_msgid TYPE symsgid
        p_msgty TYPE symsgty
        p_msgno TYPE symsgno
        p_msgv1 TYPE any
        p_msgv2 TYPE any
        p_msgv3 TYPE any
        p_msgv4 TYPE any
      CHANGING
        t_return TYPE ty_return.
        DATA:
          vl_msgty  TYPE symsgty,
          wa_return LIKE LINE OF t_return.
        IF p_msgty IS INITIAL.
          MOVE zgtpm_e TO vl_msgty.
        ELSE.
          MOVE p_msgty TO vl_msgty.
        ENDIF.
        IF p_msgno IS INITIAL.
          EXIT.
        ENDIF.
        MOVE p_msgid  TO wa_return-id.
        MOVE vl_msgty TO wa_return-type.
        MOVE p_msgno  TO wa_return-number.
        MOVE p_msgv1  TO wa_return-message_v1.
        MOVE p_msgv2  TO wa_return-message_v2.
        MOVE p_msgv3  TO wa_return-message_v3.
        MOVE p_msgv4  TO wa_return-message_v4.
        MESSAGE ID p_msgid TYPE vl_msgty NUMBER p_msgno
        WITH p_msgv1 p_msgv2 p_msgv3 p_msgv4
        INTO wa_return-message.
        APPEND wa_return TO t_return.
        FREE: vl_msgty, wa_return.
      ENDFORM.                    " mensagem_retorno_tab
    *&      Form  get_folder
      FORM get_folder
      CHANGING
        w_folder_id TYPE soodk
        t_return TYPE ty_return.
        CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
             EXPORTING
                  region    = 'B'  " ?
             IMPORTING
                  folder_id = w_folder_id
             EXCEPTIONS
                  OTHERS    = 1.
        IF sy-subrc <> 0.
          PERFORM mensagem_retorno_tab
          USING
           sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
          CHANGING
            t_return[].
        ENDIF.
      ENDFORM.                    " get_folder
    *&      Form  object_insert
      FORM object_insert USING
        p_objtp     TYPE so_obj_tp
        w_obj_data  TYPE sood1
        w_folder_id TYPE soodk
        t_obj_cont  TYPE zpmct002
      CHANGING
        w_document_id TYPE sofmk
        t_return      TYPE ty_return.
    *   Objetos locais
        DATA:
          it_objcont  TYPE STANDARD TABLE OF soli,
          it_obj_head TYPE STANDARD TABLE OF soli,
          wa_obj_id   TYPE soodk,
          wa_obj_cont LIKE LINE OF t_obj_cont.
    *   RAW to CHAR
        LOOP AT t_obj_cont INTO wa_obj_cont.
          APPEND wa_obj_cont TO it_objcont.
          CLEAR wa_obj_cont.
        ENDLOOP.
    *   Insere objeto
        CALL FUNCTION 'SO_OBJECT_INSERT'
             EXPORTING
                  folder_id                  = w_folder_id
                  object_type                = p_objtp
                  object_hd_change           = w_obj_data
                  owner                      = sy-uname
             IMPORTING
                  object_id                  = wa_obj_id
             TABLES
                  objhead                    = it_obj_head
                  objcont                    = it_objcont
             EXCEPTIONS
                  active_user_not_exist      = 1
                  communication_failure      = 2
                  component_not_available    = 3
                  dl_name_exist              = 4
                  folder_not_exist           = 5
                  folder_no_authorization    = 6
                  object_type_not_exist      = 7
                  operation_no_authorization = 8
                  owner_not_exist            = 9
                  parameter_error            = 10
                  substitute_not_active      = 11
                  substitute_not_defined     = 12
                  system_failure             = 13
                  x_error                    = 14
                  OTHERS                     = 15.
        IF sy-subrc = 0.
          w_document_id-foltp = w_folder_id-objtp.
          w_document_id-folyr = w_folder_id-objyr.
          w_document_id-folno = w_folder_id-objno.
          w_document_id-doctp = wa_obj_id-objtp.
          w_document_id-docyr = wa_obj_id-objyr.
          w_document_id-docno = wa_obj_id-objno.
        ELSE.
          PERFORM mensagem_retorno_tab
          USING
           sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
          CHANGING
            t_return[].
        ENDIF.
    *   Libera objetos locais
        FREE:it_objcont, it_obj_head, wa_obj_id, wa_obj_cont.
      ENDFORM.                    " object_insert
    *&      Form  relation_create
      FORM relation_create
      USING
        p_relationtype TYPE binreltyp
        w_obj          TYPE borident
        w_document_id  TYPE sofmk
      CHANGING
        t_return TYPE ty_return.
        DATA wa_doc TYPE borident.
        wa_doc-objtype = 'MESSAGE'.
        CASE p_relationtype.
          WHEN 'ATTA'.
            wa_doc-objkey  = w_document_id(34).
          WHEN 'URL'.
            wa_doc-objkey  = w_document_id.
          WHEN OTHERS.
        ENDCASE.
        CALL FUNCTION 'BINARY_RELATION_CREATE'
             EXPORTING
                  obj_rolea      = w_obj
                  obj_roleb      = wa_doc
                  relationtype   = p_relationtype
             EXCEPTIONS
                  no_model       = 1
                  internal_error = 2
                  unknown        = 3
                  OTHERS         = 4.
        IF sy-subrc = 0.
          COMMIT WORK AND WAIT.
          CASE p_relationtype.
            WHEN 'ATTA'.
    *         O anexo foi criado com êxito
              PERFORM mensagem_retorno_tab
              USING
                'SGOS_MSG' zgtpm_s '043' '' '' '' ''
              CHANGING
                t_return[].
            WHEN 'URL'.
    *         A URL foi criada com êxito
              PERFORM mensagem_retorno_tab
              USING
                'ZPM_PORTAL' zgtpm_s '059' '' '' '' ''
              CHANGING
                t_return[].
            WHEN OTHERS.
          ENDCASE.
        ELSE.
          PERFORM mensagem_retorno_tab
          USING
           sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
          CHANGING
            t_return[].
        ENDIF.
        FREE wa_doc.
      ENDFORM.                    " relation_create
    Edited by: Fabrício Alves Vieira on Apr 8, 2008 3:08 PM

Maybe you are looking for