PM Notification Attachments via "Create Attachment" vs "Creat Ext Doc (URL)

Uwe -
Did you create the PM notification attachment using
“Create Attachment”
or “Create External Document (URL)”  ???
Mine were created as attachments, not as external documents - that may be why your code isn't working ...
I'm going to try to do an external document create and see if that works ...
Dave

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

Similar Messages

  • Create attachment from url

    I want in Siebel to be able to create an attachment from a BI Publisher report. This report is generated via an url.
    In Siebel, if I click on the 'New File' button and then paste the url in the 'select file' field in the popup screen, the attachment is created. However, I want to automate this.
    My first try was creating a button with the following script behind it
    switch(MethodName){
    case 'CreateReport':
    var RetValue;
    var fileBC;
    this.NewRecord(NewAfter);
    RetValue = this.InvokeMethod("CreateFile", "http://vwds123:9704/xmlpserver/Test 2/Guest/Guest.xdo?_xpf=&_xpt=1&_xdo=%2FTest%202%2FGuest%2FGuest.xdo&AccNameSpec=IRIS&AccountId=&_xt=New%20Template%202&_xf=pdf&_xmode=4", "OpptyFileName", "Y");
    this.WriteRecord();
    return (CancelOperation);
    break;
    This script returns an error as it seems that CreateFile can not save attachments through http.
    My question now is if there is some way to save attachments through http via scripting.
    Thanks in advance.

    Hi,
    You can attach a file by script, using the follow line:
    fileBC.InvokeMethod ("CreateFile", "C:\Demo\Image.bmp", "AccntFileName", "Y");Where the fileBC is the attachment Business Component that you want to import the file.
    The link below has useful informations:
    http://download.oracle.com/docs/cd/B40099_02/books/OIRef/OIRefInterfaceRef111.html#wp1126217
    Regards.

  • GOS: create attachment sent by PI while creating Service Request

    Hi Friends,
    I am developing a custom FM which creates Service Request Notification(QMEL).
    This FM will be called by PI with data using web services and gets back the results after execution of function module.
    PI receives the attachments also from the other systems which should be sending to ECC to create the attachments also.
    PI sends Filename, file type, file data text or binary which will be sent to FM to an internal table..
    I am trying to use the internal table data to create attachments in the FM. I am stuck here.
    Are there any thoughts how I should get data from PI to ECC to achieve the functionality??
    I appreciate if anyone gives me an idea how to proceed?
    Regards,
    Satya Denduluri.
    GOS: create attachment sent by PI while creating Service Request

    Hi,
    did you try business object SOFM ( transaction SWO1 ) ? It offers a lot of methods around attachments, documents.
    Regards
    Dirk

  • Creating Attachment using Function Module

    Hi experts,
    My problem here is, I need know the Function Module that is used to Create Attachement in Generic Object Services.
    Currently, i only found this function module: SO_OBJECT_UPLOAD. But i do not really know how to use it.
    Can anyone here advise?
    Thanks
    Lawrence

    This blog: [/people/sergey.breslavets/blog/2007/06/29/create-and-handle-attachments-from-a-bsp-application ] describes how this works for a BSP app. If you scroll down to Method: handleupload and look at item (2) and (3), the describe the basic ABAP parts in this. The functions used here are the same ones used by the Generic Object Services.

  • Create Attachment View Link Pages In JDeveloper

    I am trying to create Attachment View Link Pages in JDeveloper and for some reason the wizard is not opening. I get the following error
    java.lang.NullPointerException
         at oracle.apps.fnd.applcore.dt.attachments.wizard.viewLink.AttachmentsViewLinkWizard.getConnectString(AttachmentsViewLinkWizard.java:492)
         at oracle.apps.fnd.applcore.dt.attachments.wizard.viewLink.AttachmentsViewLinkWizard.createApplicationModule(AttachmentsViewLinkWizard.java:466)
         at oracle.apps.fnd.applcore.dt.attachments.wizard.viewLink.AttachmentsViewLinkWizard.<init>(AttachmentsViewLinkWizard.java:117)
         at oracle.apps.fnd.applcore.dt.attachments.wizard.viewLink.AttachmentsViewLinkAddin.invoke(AttachmentsViewLinkAddin.java:67)
         at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:372)
         at oracle.ide.wizard.WizardManager$1.run(WizardManager.java:420)
         at oracle.ide.util.IdeUtil$3.run(IdeUtil.java:1089)
         at oracle.javatools.util.SwingUtils.invokeAfterRepaint(SwingUtils.java:509)
         at oracle.ide.util.IdeUtil.invokeAfterRepaint(IdeUtil.java:1102)
         at oracle.ide.wizard.WizardManager$2.run(WizardManager.java:428)
         at oracle.ide.util.IdeUtil$3.run(IdeUtil.java:1089)
         at oracle.javatools.util.SwingUtils.invokeAfterRepaint(SwingUtils.java:509)
         at oracle.ide.util.IdeUtil.invokeAfterRepaint(IdeUtil.java:1102)
         at oracle.ide.wizard.WizardManager.invokeSecondaryWizard(WizardManager.java:424)
         at oracle.ide.gallery.ObjectGallery.invokeWizard(ObjectGallery.java:383)
         at oracle.ide.gallery.ObjectGallery.runDialog(ObjectGallery.java:204)
         at oracle.ide.gallery.ObjectGallery.runDialog(ObjectGallery.java:124)
         at oracle.ide.gallery.ObjectGalleryAddin._invokeGallery(ObjectGalleryAddin.java:405)
         at oracle.ide.gallery.ObjectGalleryAddin.handleEvent(ObjectGalleryAddin.java:208)
         at oracle.ide.controller.IdeAction.performAction(IdeAction.java:529)
         at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:884)
         at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:501)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
         at java.awt.Component.processMouseEvent(Component.java:6289)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
         at java.awt.Component.processEvent(Component.java:6054)
         at java.awt.Container.processEvent(Container.java:2041)
         at java.awt.Component.dispatchEventImpl(Component.java:4652)
         at java.awt.Container.dispatchEventImpl(Container.java:2099)
         at java.awt.Component.dispatchEvent(Component.java:4482)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
         at java.awt.Container.dispatchEventImpl(Container.java:2085)
         at java.awt.Window.dispatchEventImpl(Window.java:2478)
         at java.awt.Component.dispatchEvent(Component.java:4482)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
         at java.awt.EventQueue.access$000(EventQueue.java:85)
         at java.awt.EventQueue$1.run(EventQueue.java:603)
         at java.awt.EventQueue$1.run(EventQueue.java:601)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
         at java.awt.EventQueue$2.run(EventQueue.java:617)
         at java.awt.EventQueue$2.run(EventQueue.java:615)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Do i have to include any jar files in JDeveloper ? i aint have any idea on what wrong.

    Hi
    this is a public Oracle JDeveloper and ADF forum. If you have a problem with your Applications environment, please post the question to the related Applications forum here on OTN. We don't have access to appl core on this forum and can't get you out of your problem for this reason
    Frank

  • Regarding GOS create attachment

    Hi all,
    I have a issue in my program.
    I am trying to attach a .doc, .pdf document to a customs declaration document.
        CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = p_file
        TABLES
          data_tab = lt_doc_content.
      ENDCASE.
    I am using the above code to read the file... from the presentaion server.
    The file is attached, but the .doc or the .pdf file is corrupted....
    do I need to give any specfic file type in the function module like 'BIN', 'DAT', 'ASC'...
    Kindly help.......
    Thanks in advance.
    Jaffer Ali.S

    Here is my code...
    *& Report  ZGTS0001
    REPORT  ZGTS0001.
    Include for BO macros
      INCLUDE : <cntn01>.
      PARAMETERS:
       P_BOTYPE LIKE borident-OBJTYPE DEFAULT 'BUS6800',
       P_BO_ID  LIKE borident-OBJKEY DEFAULT '10000000022007',
       P_MSGTYP LIKE SOFM-DOCTP  DEFAULT 'TXT',
       P_DOCTY  LIKE borident-OBJTYPE DEFAULT 'MESSAGE',
       P_RELTYP  LIKE BRELTYP-RELTYPE DEFAULT 'ATTA',
       P_FNAME like rlgrap-filename Default 'v:\test.doc'.
      P_FNAME like rlgrap-filename Default
      '\At2a2\Vol4\Depts\Isprog\files\ports.txt'.
      types: BEGIN OF TY_MESSAGE_KEY,
            FOLTP TYPE SO_FOL_TP,
            FOLYR TYPE SO_FOL_YR,
            FOLNO TYPE SO_FOL_NO,
            DOCTP TYPE SO_DOC_TP,
            DOCYR TYPE SO_DOC_YR,
            DOCNO TYPE SO_DOC_NO,
            FORTP TYPE SO_FOR_TP,
            FORYR TYPE SO_FOR_YR,
            FORNO TYPE SO_FOR_NO,
           END OF TY_MESSAGE_KEY.
      DATA : LV_MESSAGE_KEY type TY_MESSAGE_KEY.
      DATA : LO_MESSAGE type SWC_OBJECT.
      DATA : LT_DOC_CONTENT type standard table of SOLI-LINE
                                 with header line.
      DATA: p_file TYPE string.
    First derive the Attachment's ( MESSAGE )document type.
      P_DOCTY = 'MESSAGE'.
      CASE P_RELTYP.
      In case of URls
        WHEN 'URL'.
          P_MSGTYP = 'URL'.
      In case of Notes / Private Notes
        WHEN 'NOTE' OR 'PNOT'.
          P_MSGTYP = 'RAW'.
        WHEN 'ATTA'.
        Take given parameter e.g. 'DOC', 'PDF' etc.
        P_MSGTYP = 'EXT'.
        WHEN OTHERS.
       ....exit
        EXIT.
      ENDCASE.
    Create an initial instance of BO 'MESSAGE' - to call the
    instance-independent method 'Create'.
      swc_create_object LO_MESSAGE 'MESSAGE' LV_MESSAGE_KEY.
    define container to pass the parameter values to the method call
    in next step.
      swc_container LT_MESSAGE_CONTAINER.
    Populate container with parameters for method
      swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTTITLE' 'JafDoc1'.
      swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTLANGU' 'E'.
      swc_set_element LT_MESSAGE_CONTAINER 'NO_DIALOG'     'X'.
      swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTNAME'   P_DOCTY.
      swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTTYPE'   P_MSGTYP.
    In case of URLs..it should be concatenated with &KEY& in the begining.
      CASE P_MSGTYP.
      WHEN 'URL'.
        LT_DOC_CONTENT = '&KEY&http://www.rmtiwari.com' .
        append LT_DOC_CONTENT.
    In case of Notes or Private Notes, get the data from files on appl
    server or from wherever(? - remember background).
      WHEN 'RAW'.
        LT_DOC_CONTENT = 'Hi How r u?' .
        append LT_DOC_CONTENT.
    In case of PC File attachments
      WHEN OTHERS.
       OPEN DATASET P_FNAME FOR INPUT IN BINARY MODE.
       IF SY-subrc EQ 0.
         DO.
           READ DATASET P_FNAME INTO LT_DOC_CONTENT.
           IF SY-subrc EQ 0.
             append LT_DOC_CONTENT.
             message i000(mtxt) with 'Inside'.
           ELSE.
             append LT_DOC_CONTENT.
             message i000(mtxt) with 'else'.
             EXIT.
           ENDIF.
         ENDDO.
         CLOSE DATASET P_FNAME.
       else.
         message i000(vtxt) with 'Operation failed...'.
       ENDIF.
        MOVE p_fname TO p_file.
        message i000(mtxt) with p_file.
        CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filetype = 'BIN'
          filename = p_file
        TABLES
          data_tab = lt_doc_content.
      ENDCASE.
    message i000(mtxt) with 'Outside function module gui_upload'.
    'DocumentContent' is a multi-line element ( itab ).
      swc_set_table LT_MESSAGE_CONTAINER 'DocumentContent' LT_DOC_CONTENT.
    Size is required in case of File attachments
      data : LV_DOC_SIZE type i.
      data : L_FILE_LINES type i.
      DESCRIBE TABLE LT_DOC_CONTENT LINES L_FILE_LINES.
      READ TABLE LT_DOC_CONTENT INDEX L_FILE_LINES.
      LV_DOC_SIZE = ( 255 * ( L_FILE_LINES - 1 ) ) +
                  STRLEN( LT_DOC_CONTENT ).
      swc_set_element LT_MESSAGE_CONTAINER 'DOCUMENTSIZE'   LV_DOC_SIZE .
    Refresh to get the reference of create 'MESSAGE' object for attachment
      swc_refresh_object LO_MESSAGE.
      swc_call_method LO_MESSAGE 'CREATE' LT_MESSAGE_CONTAINER.
    Get Key of new object
      swc_get_object_key LO_MESSAGE LV_MESSAGE_KEY.
    Now we have attachment as a business object instance. We can now
    attach it to our main business object instance.
    Create main BO object_a
      data: LO_IS_OBJECT_A type BORIDENT.
      LO_IS_OBJECT_A-OBJKEY = P_BO_ID.
      LO_IS_OBJECT_A-OBJTYPE = P_BOTYPE.
    LO_IS_OBJECT_A-CATID  = 'BO'.
    Create attachment BO object_b
      data: LO_IS_OBJECT_B type BORIDENT.
      LO_IS_OBJECT_B-OBJKEY = LV_MESSAGE_KEY.
      LO_IS_OBJECT_B-OBJTYPE = P_DOCTY.
    LO_IS_OBJECT_B-CATID  = 'BO'.
    *message i000(mtxt) with P_BO_ID P_BOTYPE LV_DOC_SIZE LV_MESSAGE_KEY.
    call function 'BINARY_RELATION_CREATE'
      EXPORTING
        obj_rolea    = LO_IS_OBJECT_A
        obj_roleb    = LO_IS_OBJECT_B
        relationtype = P_RELTYP
      EXCEPTIONS
        others       = 1.
    commit work.
    Please talk and look and reply....
    Thanks Rich....

  • Create attachement for GOS in background

    Hi all, i have to create attachments for GOS in the background. i found a blog that suggested me to use the classess 
    CLASS    CL_BINARY_RELATION definition load.
    CLASS    CL_OBL_OBJECT      definition load.
      Link : /people/rammanohar.tiwari/blog/2005/10/10/generic-object-services-gos--in-background
    Looks like it might work. But problem is iam using 4.6C version and i donot see these classes. Can you please suggest any work around for this.

    Hi Peter, Thanks for the link to the blog. i was able to create attachment for GOS in the background.
    Iam also adding link to this message that found for the same purpose
    http://friendlyabaper.blogspot.com/2008/07/oh-my-gos.html
    Have a nice time.

  • GOS 'Create Attachment' - Can we archive it to DMS?

    Greetings All!
    I know for sure that if we store using 'create attachment', these are stored in the database. If you store using "store business document" these can be stored in the content server. Is there anyway we can route create attachments to DMS instead of  DB?
    NOTE - Currently we have greyed out create attachments to stop users from using create attachments as our SOC3 and SOFTCONT1 tables are rapidly increasing.
    All your help is much appreciated.
    Regards
    Sri

    Hello Travis,
    If I understood Sri Latha posting correctly she wanted to store the documents in the DMS rather than in DB(SOC3 table) whenever a document is attached.  
    I have very limited knowledge SAP DMS as I am more into ABAP & OT. So it is because of you I took 2 days to understand & configure SAP DMS and 2 hours to code for possibility check for storing the documents in the DMS. For which I am happy .
    Before going a ahead I checked SOC3 table enteries to be "587.055".
    In had take "SGOSATTR" to SM30 to see what is the class that responsible for attaching and displaying the documents and found
    Now I copied them to ZCL_GOS_SRV_ATTACHMENT_CREATE & ZCL_GOS_SRV_ATTACHMENT_LIST respectively. To comment their "Execute" method code and placed the custom code.
    I had hard coded the location from where the document needs to picked up from.  
    I had put code such a way that document once stored get's display CV02n
    Now I want to see the attachment(yet to adjust code to display as attachment currently displaying in other window).
    In my previous posting I though referring the other answer would give a clue of modifying the respective class of the GOS menu's. Sorry, for confusing.
    Now when I checked for the SOC3 table entries they are still "587.055". Which means they are not storing any more in DB(as per my limited knowledge )
    Below is the raw code just checking the possibility :
    ZCL_GOS_SRV_ATTACHMENT_CREATE(EXECUTE method)
    DATA: ls_doc    type bapi_doc_draw2,
            ls_return type bapiret2.
    DATA: lf_doctype    Type bapi_doc_draw2-documenttype,
          lf_docnumber  Type bapi_doc_draw2-documentnumber,
          lf_docpart    Type bapi_doc_draw2-documenttype,
          lf_docversion Type bapi_doc_draw2-documenttype.
    DATA: lt_files      Type table of bapi_doc_files2 ,
          lt_drat       Type table of bapi_doc_drat  ,
          lt_drad       Type table of bapi_doc_drad  ,
          ls_files      Type bapi_doc_files2,
          ls_drat       Type bapi_doc_drat,
          ls_drad       Type bapi_doc_drad.
    ls_doc-documenttype    = 'YBO'.
    ls_doc-documentversion = '00'.
    ls_doc-documentpart    = '000'.
    ls_doc-statusextern    = 'IA'.
    ls_doc-laboratory      = '002'.
    REFRESH lt_files.
    CLEAR lt_files.
    ls_files-sourcedatacarrier = '%COMPUTERN'.
    ls_files-storagecategory = 'DMS_C1_ST'.
    ls_files-docfile = 'C:\Users\Administrator\Documents\MARK_TRAVIS\TESTING_of_ MARK_TRAVIS_request.doc'.
    ls_files-wsapplication = 'DOC'.
    APPEND ls_files to lt_files.
    CLEAR lt_drat.
    REFRESH lt_drat.
    ls_drat-language = 'EN'.
    ls_drat-description = 'TESTING_of_ MARK_TRAVIS_request'.
    APPEND ls_drat to lt_drat.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
        documentdata         = ls_doc
      IMPORTING
        return               = ls_return
      TABLES
        documentdescriptions = lt_drat
        documentfiles        = lt_files.
    IF ls_return-type CA 'EA'.
      ROLLBACK WORK.
      WRITE : ls_return-message.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = '9'.
    DATA: doknr TYPE doknr.
    GET PARAMETER ID 'CV1' FIELD doknr.
    CALL TRANSACTION 'CV02N' AND SKIP FIRST SCREEN.
    ENDIF.
    ZCL_GOS_SRV_ATTACHMENT_LIST(EXECUTE method)
    data:  lt_stdokar type STANDARD TABLE OF CV100_RANGESDOKAR ,
            ls_stdokar type CV100_RANGESDOKAR,
       lt_stdoknr type STANDARD TABLE OF CV100_RANGESDOKNR  ,
       lt_stdokvr type STANDARD TABLE OF CV100_RANGESdokvr  ,
       lt_stdoktl type STANDARD TABLE OF CV100_RANGESdoktl  ,
       lt_stdwnam type STANDARD TABLE OF CV100_RANGESdwnam  ,
       lt_stbegru type STANDARD TABLE OF CV100_RANGESbegru  ,
       lt_staennr type STANDARD TABLE OF CV100_RANGESaennr,
       lt_stlabor type STANDARD TABLE OF CV100_RANGESlabor  ,
       lt_stdktxt type STANDARD TABLE OF CV100_RANGESDKTXT  .
      DATA dttrg TYPE draw-dttrg.
      DATA dappl TYPE draw-dappl.
      DATA status TYPE tdwst-stabk.
      DATA stseit TYPE mcdok-stseit.
      DATA stbis TYPE mcdok-stbis.
      DATA slng TYPE rsfin-langu.
      DATA restrict TYPE anzhl_s.
      DATA gf_cs_active     TYPE sy-datar.
      DATA cklah TYPE klah.
      DATA g_folder_key TYPE bapi_doc_keys.
      DATA srcdrad TYPE STANDARD TABLE OF seldrad.
      DATA ls_srcdrad TYPE  seldrad.
      DATA searchtab_orig TYPE STANDARD TABLE OF fist .
      DATA ls_searchtab_orig TYPE fist .
      DATA lt_loedk_ranges  TYPE TABLE OF cv100_rangesloedk.
      DATA ls_loedk_ranges  TYPE  cv100_rangesloedk.
      DATA lt_cadkz_ranges  TYPE TABLE OF cv100_rangescadkz.
      DATA ls_cadkz_ranges  TYPE  cv100_rangescadkz .
      DATA lt_tdraw TYPE STANDARD TABLE OF draw .
      DATA ls_tdraw TYPE  draw.
      DATA lt_ccomw TYPE STANDARD TABLE OF comw.
      DATA ls_ccomw TYPE  comw .
      stseit = 00000000.
      slng = 'E'.
      restrict   =                           100.
      gf_cs_active     =              'X'.
      ls_stdokar-sign =  'I' .
      ls_stdokar-option = 'EQ'.
      ls_stdokar-low = 'YBO'.
      APPEND ls_stdokar to lt_stdokar .
      ls_loedk_ranges-sign = 'I'.
      ls_loedk_ranges-option = 'EQ'.
      ls_loedk_ranges-low = ' '.
      APPEND ls_loedk_ranges to lt_loedk_ranges.
      ls_loedk_ranges-sign = 'I'.
      ls_loedk_ranges-option = 'EQ'.
      ls_loedk_ranges-low = 'X'.
      APPEND ls_loedk_ranges to lt_loedk_ranges.
      ls_cadkz_ranges-sign = 'I'.
      ls_cadkz_ranges-option = 'EQ'.
      ls_cadkz_ranges-low = ' '.
      APPEND  ls_cadkz_ranges to lt_cadkz_ranges.
      ls_cadkz_ranges-sign = 'I'.
      ls_cadkz_ranges-option = 'EQ'.
      ls_cadkz_ranges-low = 'X'.
      APPEND  ls_cadkz_ranges to lt_cadkz_ranges.
      CALL FUNCTION 'DMS_DOCUMENT_RETRIEVAL_ALV'
        EXPORTING
          sdttrg                 = dttrg
          sappli                 = dappl
          sdoksa                 = status
          sdatum1                = stseit
          sdatum2                = stbis
          slanguage              = slng
          restrict               = restrict
          pf_cs_active           = gf_cs_active
          classno                = cklah-class                 
          classtype              = cklah-klart                 
          folder_key             = g_folder_key
        TABLES
          objectlinks            = srcdrad
          searchtext             = searchtab_orig
          stdokar                = lt_stdokar
          stdoknr                = lt_stdoknr
          stdokvr                = lt_stdokvr
          stdoktl                = lt_stdoktl
          stloedk                = lt_loedk_ranges
          stcadkz                = lt_cadkz_ranges
          stdwnam                = lt_stdwnam
    *     stbegru                = lt_stbegru
    **     staennr                = lt_staennr
    *     stlabor                = lt_stlabor
    *     stdktxt                = lt_stdktxt
    *     tdraw                  = lt_tdraw
          clsc_class_selection   = lt_ccomw
        EXCEPTIONS
          parameter_insufficient = 2.
    Hope this help's you understand this time. Please feel free to comment on any thing. 
    Thanks,
    Kolusu

  • Table where system create attachment in material master

    Dear guru ,
    In MM02 I can create attachment and import external files.
    In which table are stored the attachments list for every material code ?
    Thanks in advance.

    The images are stored in table TOA01. You can populate the Object type and Object ID fields to get a list of materials and the types of attachments.

  • Generic Object Services - Create Attachment

    Hi SDN experts
    In the trip details page of the travel expense manager, may i know what Function Module does the "Create Attachment" functionality in the Generic Object Services trigger? Appreciate if anyone is able to provide me with an answer. Thank you
    Regards
    LV

    You are in great trouble. Repeated posting of a single thread will really make you a Guest.
    You have replicated this post in SEVEN forums.
    Generic Object Services - Create Attachment in
    Generic Object Services - Create Attachment in
    Generic Object Services - Create Attachment in
    Generic Object Services - Create Attachment in
    Generic Object Services - Create Attachment in
    Generic Object Services - Create Attachment in
    Generic Object Services - Create Attachment in
    As you are new to the forum please Read the [Forum Rules|http://wiki.sdn.sap.com/wiki/x/FgQ] before posting more.
    Regards
    Karthik D

  • Generic Object Services ; create attachment function grey out in Tcode KA03

    Hi all,
    I would like to know how can I enable create attachment function in GOS toolbar in Tcode KA03.
    Currently it was grey out.
    However, was tried to use the same function in KS03 and it works.Please help. Thanks!

    I just found the solution...
    SAP note : 961572
    Symptom</u>
    In the transactions for displaying cost elements (KA03) and changing cost elements (KA02), the 'Services for Object' function does not work correctly, as most Generic Object Services are unavailable.
    Other terms
    KA03, KA02, SWO1, K_OBJECT_SERVICES_INITIALIZE, BUS1059, BUS1030
    Reason and Prerequisites
    The problem is caused by a program error.
    Solution
    Implement the attached program corrections
    Then go to Transaction SW01 (Business Object Builder), enter BUS1059 as the object type, click Change, and make the following changes:
    Navigate to Methods -> RevenueType.Display, press F2 to select it, and go to the 'ABAP' tab page: Select the 'Transaction' radio button, enter the name as KA03, and click 'Save'
    Navigate to Attributes -> Attribute properties, select the 'Mandatory' checkbox, and click 'Save'
    Then change the release status by navigating as follows:
    Edit -> Change Release Status -> Object Type -> To implemented
    Edit -> Change Release Status -> Object Type -> To released
    Then double-click BUS1059 (or select using F2) in SWO1 to reach the 'General' tab page, which should appear as follows:
    ObjectType      BUS1059         Revenue element
    Object Name      RevenueType
    Program          RBUS1059
    Objtype status   generated       Saved      released

  • Create Attachment through Generic Object Services (BC-SRV-GBT)

    Hello experts,
    I have one question about a storing of document in this functionality. As you know there are several ways of storing a document to some object.
    1. Using the menu: "Create - Create Attachment"
    2. Using the menu: "Create - Store  Business Document"
    In the first case the document will be saved in SAP Database (Please correct me if I mistake). In the second case an optical archive must be connected to the SAP System.  Can I use an optical archive in the first case?
    PS. When I use the second way I don't see the name of document in the Attachment List. If use  "Create - Create Attachment" - it is OK.
    Thanks advance for any help.
    Your faithfully,
    Alekseev Aleksandr
    Edited by: Aleksandr Alekseev on May 5, 2008 6:05 AM

    Hi Friend,
      You have posted your query in wrong forum.
      Pls post your query in BPM and Workflow Forum.

  • Creating attachment in Webdynpro for ABAP

    Hi Expertrs,
                      I am new to webdynpro for ABAP. I have a requirement like I need to create an attachment in webdynpro screen. I have searched the forums and I got the class CL_GOS_SRV_ATTACHMENT_CREATE and method EXECUTE_ITS. but when I call this method I am getting dump in the method.
    Can anybody please suggest me how to create attachment in webdynpro for ABAP?
    When ever attachment is created and clicks on save button workflow will be triggered and a workitem appears portal when ever the user click on the display attachment I need to display the created attachemnt.
    Please suggest me.
    Thank You.
    Ranganadh

    Hi,
    Please follow the steps below;
    Follow these steps;
    1.create a node 'FILEUPLOAD' with 2 attributes
    a) FILECONTENT type XSTRING
    b) FILENAME type STRING
    2. Create a fileuplaod uielement
    a) bind the data property with attribute 'FILECONTENT'
    b) bind the filename property with attribute 'FILENAME'
    3. Create a button 'UPLOAD'
    a) create the action method for this button
    Paste the following code in this method
    Data l_node type ref to if_wd_context_node.
    Data l_stru type wd_this->elements_cn_fileupload.
    l_node = wd_context->get_child_node( 'FILEUPLOAD' ).
    l_node->get_static_attributes( importing static_attributes = l_stru ).
    "save l_stru-fielcontent in database. Your file will be saved in the database in XSTRING format.
    Now when you want to display  this file;
    1. Create a Node 'FILEDOWNLOAD' with 1 attribute
    a) FILE type XSTRING
    2. Create a filedownload uielement
    a) bind the data property with the attribute 'FILE'
    Fetch the file from databased and set the File attribute of teh filedownload uielemnt to display the file.
    Hope this helps!
    Radhika.

  • Create attachment with BINARY_RELATION_CREATE to BUS2081

    Hello,
    I'm trying to create attachment with BINARY_RELATION_CREATE to incoming invoice. i succeed for BKPF with objtype = 'MESSAGE', but when i try to attach for BUS2081- there is no error but i can't see the document attached not in FB03 and not in MIRO. is there another objtype that goes with BUS2081.
    Thanks
    Moshe

    i've put break-point in FM 'BINARY_RELATION_CREATE' and saw that the object key in MIRO was only with BELNR and GJAHR (without BUKRS in the begining)

  • Object Services - Create Attachment ?????????

    Hi Experts,
                   I have some Quries regarding Object Services -
                   1) I want to attach 1 file ( Excel or word) to the Maintenance Order when I create attachement through Object Service and attach a document to the Order will it attach the document (i.e. Stored on SAP Server) or only create a hyperlink of the Document attached.
                   2) If it is creating only the link is there any other way to attach a PC file to Maintenance Order.
    I hv not implemented DMS over here.
                   3) Is there any customization required for the Object Services.
    With best regards,
    Narendra Dere

    1 - its stored on the server, not as a hyperlink.  For this reason you don't want to store immense amounts of data this way.
    2 - DMS is the only other way I know of to attach documents.  Many clients have set up a simple DMS config with PM being the only module using it.
    3 - No config needed for object services.
    see
    http://help.sap.com/printdocu/core/Print46c/EN/data/pdf/BCSRVOBS/BCSRVOBS.pdf
    Edited by: Arthur Balajthy on Dec 15, 2008 6:41 PM

Maybe you are looking for

  • Can you import a DVD of your own into iTunes?

    I know you can choose from a very limited selection of films from the iTunes music store, but can you import one of your own films in the same way you import a CD and keep it on iTunes? And, of course, how would one go about doing this? When I insert

  • What to do with an old eMac?

    OK, odd question I know, but a worthwhile one in the interest of re-cycling and all that. I am about to come into ownership of a eMac: 700mhz, half a gig ram, 40gb HDD, etc. Pretty much standard. At work I have a network with 1 wireless mini, a wirel

  • PROBLEM FLASH : settings are not saved

    Hello, I have a problem with flash recently, i'm using a PPC G4 1,5 GO RAM version osX 10.4.10 2x1 GHZ ( firefox 2007 ), when i want to set preferences of Flash on the site of adobe it's always getting by defect preferences when i reload the page for

  • Information Steward 4.2.1 not installing Data Cleansing Advisor (DCA) database

    Our situation is as follows: We have a SAP BusinessObjects BI 4.1 Sp3 system on Windows Server 2012. We are installing the following components onto a separate, new Microsoft Windows Server 2012 platform (in this order): - Information Platform Servic

  • MBP retina screen flicker black?

    Hello, after doing so much research and feels like getting no answer I decided to post on this forum, I hope I will get any answer so I own a new MBP retina 15", it just came last week and I just start really using it yesterday. When I was working wi