Create attachment in Contract

Dear SAP gurus,
I notice that there is an attachment button in tcode ME21N, where we can create attachment in the PO and link it to Document Management system. I have requirement from my client that they will need the same functionality in Contract. But in tcode ME31K i cannot find any button for the attachment. Is this functionality not exist in Contract? Or it exist but there is another way to create the attachment and link it to Document Management system.
Please help.
Best regards,
John

hi
you can attach documents to the items in the contract.
select the item.
select the more function --> document

Similar Messages

  • Ibase and configuration error while creating a Service Contract

    Hi,
    I am creating a Service Contract programatically and not manually through the T-code CRMD_ORDER.
    I am using the Function module CRMXIF_ORDER_SAVE for the same as the FM BAPI_BUSPROCESSND_CREATEMULTI and CRM_ORDER_MAINTAIN did not work for me because of the number of parameters that needs to be passed for creating the Service contract.
    The Service contract does get created but there are errors corresponding to the Point of delivery and configuration missing.
    The error corresponding to the point of delivery says "IS-U:allocate a point of delivery to the item" even though I am passing the values in the REF_OBJECTS field of the CRMXIF_BUSTRANS_ITEM structure.
    Structure for the same is :
    ls_objects_i-TYPE_REF_OBJ = 'B'.
      ls_objects_i-object_task = 'I'.
      ls_objects_i-PRODUCT_GUID = lv_product_guid.
      ls_objects_i-PRODUCT_ID = p_product_id.
      ls_objects_i-IBASE_COMP_GUID = ls_output-IBASE_GUID.
      ls_objects_i-IB_INSTANCE = 1582.
      ls_objects_i-IB_COMP_VALID = '20070926093651'.
      ls_objects_i-SERIAL_NUMBER = '0102 46CC9C278B92025BE10000000AD5920E'.
      append ls_objects_i to lt_objects_i.
      p_ls_item-REF_OBJECT-data = lt_objects_i.
      p_ls_item-REF_OBJECT-datax = 'X'.
    Similarly,the error for the configuration says "Configuration for the item missing" and here again I am passing the values in the CONFIGURATION structure.
    Structure for this is :
      p_ls_item-configuration-data-consist = 'T'.
      p_ls_item-configuration-data-kbname = 32.
      p_ls_item-configuration-data-kbvers = '0.0'.
      p_ls_item-configuration-data-kbprofile = 'E_H_B'.
      p_ls_item-configuration-data-complete = 'T'.
      p_ls_item-configuration-data-spras = 'E'.
      p_ls_item-configuration-data-cfginfo = 'VCOND=VARIANT_CONDITION_KEY'
      ls_cuins-OBJ_TYPE = 'SERV'.
      ls_cuins-class_type = 300.
      ls_cuins-obj_key = 'E_H_B'.
      ls_cuins-obj_txt = 'E_H_B'.
      ls_cuins-QUANTITY = '1.0'.
      ls_cuins-COMPLETE = 'T'.
      ls_cuins-CONSIST = 'T'.
      append ls_cuins to lt_cuins.
      ls_config_i-instance = lt_cuins.
      p_ls_item-configuration-data = ls_config_i.
      p_ls_item-configuration-datax = 'X'.
      clear ls_config_i.
      ls_cuval-charc = 'DISCOUNT_EUR'.
      ls_cuval-charc_txt = 'DISCOUNT_EUR'.
      ls_cuval-value = '0.0'.
    ls_cuval-value_txt
      append ls_cuval to lt_cuval.
      ls_instance-value = lt_cuval.
      insert ls_instance into table lt_instance.
    ls_config_i-instance = lt_instance.
    p_ls_item-configuration-data = ls_config_i.
    p_ls_item-configuration-datax = 'X'.
    clear ls_config_i.
    Kindly help if anyone has worked on this.......
    Regards,
    Puneet Jhari.

    Hi,
    I am creating a Service Contract programatically and not manually through the T-code CRMD_ORDER.
    I am using the Function module CRMXIF_ORDER_SAVE for the same as the FM BAPI_BUSPROCESSND_CREATEMULTI and CRM_ORDER_MAINTAIN did not work for me because of the number of parameters that needs to be passed for creating the Service contract.
    The Service contract does get created but there are errors corresponding to the Point of delivery and configuration missing.
    The error corresponding to the point of delivery says "IS-U:allocate a point of delivery to the item" even though I am passing the values in the REF_OBJECTS field of the CRMXIF_BUSTRANS_ITEM structure.
    Structure for the same is :
    ls_objects_i-TYPE_REF_OBJ = 'B'.
      ls_objects_i-object_task = 'I'.
      ls_objects_i-PRODUCT_GUID = lv_product_guid.
      ls_objects_i-PRODUCT_ID = p_product_id.
      ls_objects_i-IBASE_COMP_GUID = ls_output-IBASE_GUID.
      ls_objects_i-IB_INSTANCE = 1582.
      ls_objects_i-IB_COMP_VALID = '20070926093651'.
      ls_objects_i-SERIAL_NUMBER = '0102 46CC9C278B92025BE10000000AD5920E'.
      append ls_objects_i to lt_objects_i.
      p_ls_item-REF_OBJECT-data = lt_objects_i.
      p_ls_item-REF_OBJECT-datax = 'X'.
    Similarly,the error for the configuration says "Configuration for the item missing" and here again I am passing the values in the CONFIGURATION structure.
    Structure for this is :
      p_ls_item-configuration-data-consist = 'T'.
      p_ls_item-configuration-data-kbname = 32.
      p_ls_item-configuration-data-kbvers = '0.0'.
      p_ls_item-configuration-data-kbprofile = 'E_H_B'.
      p_ls_item-configuration-data-complete = 'T'.
      p_ls_item-configuration-data-spras = 'E'.
      p_ls_item-configuration-data-cfginfo = 'VCOND=VARIANT_CONDITION_KEY'
      ls_cuins-OBJ_TYPE = 'SERV'.
      ls_cuins-class_type = 300.
      ls_cuins-obj_key = 'E_H_B'.
      ls_cuins-obj_txt = 'E_H_B'.
      ls_cuins-QUANTITY = '1.0'.
      ls_cuins-COMPLETE = 'T'.
      ls_cuins-CONSIST = 'T'.
      append ls_cuins to lt_cuins.
      ls_config_i-instance = lt_cuins.
      p_ls_item-configuration-data = ls_config_i.
      p_ls_item-configuration-datax = 'X'.
      clear ls_config_i.
      ls_cuval-charc = 'DISCOUNT_EUR'.
      ls_cuval-charc_txt = 'DISCOUNT_EUR'.
      ls_cuval-value = '0.0'.
    ls_cuval-value_txt
      append ls_cuval to lt_cuval.
      ls_instance-value = lt_cuval.
      insert ls_instance into table lt_instance.
    ls_config_i-instance = lt_instance.
    p_ls_item-configuration-data = ls_config_i.
    p_ls_item-configuration-datax = 'X'.
    clear ls_config_i.
    Kindly help if anyone has worked on this.......
    Regards,
    Puneet Jhari.

  • OKS_CONTRACT_PUB - Creating a service Contract

    Hi,
    We are working on release 12, and I am trying to Create and Update Contracts through and API.
    At the moment the API I am using to create the contract is OKS_CONTRACT_PUB.Create_Contract, but it keeps giving me errors.
    Like You must enter a value for column lse_id .which is the error I am getting at the moment.
    If there are anybody that has succesfully used this API, or can give me any assistance, it will be greatly appreciated.
    Regards
    Carin Webb

    The best way to avoid errors is to make note of the mandatory columns that the API needs to create contract successfully like lse_id is a mandatory column.
    You can also check from the front end what fields need to be mandatorily entered while creating a contract.

  • Problems in creating a Value Contract

    Hi,
    I'm trying to create a value contract using VA41.
    The process succeeds for one sales organization, but for another sales organization, I am getting a line in the document incompletion log, saying G/L account data is missing. This is despite the fact that a G/L account IS assigned to this sales organization in VKOA. Even when doubleclicking the error message, and getting to the Analysis Account Determination, it is clearly seen that the system did find a G/L account!
    After getting deeper into this, I found that the problem is caused by the item category of the contract line item, which has Revenue Recognition category B (Service-related revenue recognition). If I change this value to blank or a different value in the item category definition (VOV7), then I am able to add the line and save the contract.
    The question is whether there is a place where this sales organization (or the company code above it) is defined not to be able to accept lines with Revenue Recognition B? Or maybe I am misunderstanding this whole thing, and the problem is of a different kind?
    Thanks in advance for your help,
    Amit

    Hi Sri,
    Thanks for the quick response.
    The item category group is not NORM but our company's own item category group - YNOR.
    This is not the issue, as this item category group is assigned to the material also in the sales organization that works...

  • Unable to create a service contract from IDoc BLAORD FM IDOC_INPUT_BLAORD

    I've been testing creating service contracts using BLAORD and it appears that SAP does not have any way of creating a service contract using IDOC_INPUT_BLAORD. Inside this function a BDC is built and either ME31K or ME32K is called. There is processing that checks the service line package numbers, but it doesn't appear to be creating them (Maybe I'm overlooking something). When the BDC is being built the services screen is ignored. There is a user exit that could be used to populate the BDC for these screens.
    I recently had to develop a custom BDC to create service contracts becuase, to the knowledge of our best ABAP-ers, there is no SAP standard functionality to create service contracts programmatically besides using a BDC. My custom BDC will fail when run in background because of a GUI control on the services screen. It runs fine in the foreground. The short dump is 'RAISE_EXCEPTION'. Short text: Exception condition "CNTL_ERROR" raised. Termination is occurring in CL_GUI_DOCKING_CONTAINER->CONSTRUCTOR. We're on ECC 6.0.
    I checked the SAP Notes system and I was unable to find anything related specifically to contracts for this issues. I did see that SAP has released OSS notes for other BDC processes so that they would be able to run in background.
    I am wondering if there is anyone who currently is able to create service contracts using IDOC_INPUT_BLAORD. My plan is to set up an RFC between SAP systems. The customer wants to be able to receive contracts on demand. Has anyone done this before for service contracts? What has your approach been? Is there anyway of having the function run in foreground when it receives a IDoc?
    Thanks for your input,
    Steve

    Hello Steve,
    Did you get a solution to Service Contract (Purchase) creation through BLAORD or through any other FM please?
    BAPI_CONTRAT_CREATE does not handle services.
    Have a similar requirement and trying to avoid BDC.
    Thanks & Regards
    Prashanth

  • 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.

  • Net price field should not be edited in PO, when created reff. to contract

    Dear friends,
    I have a requirement like this.....
    User referring the contract in creating the purchase order, details of the contracts are copied in to the purchase order. the price field is in edit mode....
    requirement is that user should not edit this field, the price carried from the contract should be not edit mode. this is to be hapen only when purchase order is created referrence of contract.
    here we are using only the standard document type is used for creating Purchase orders with and without the referrence of contract.   
    Thanks in advance...
    Shashidhar

    What I did for a client was implementing enhancement (user exit) MM06E005 to perform checking during PO creation.
    OSS note 310154 explains how to issue error messages from ME21N from the user exit.

  • 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)

  • 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.

  • 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

  • Replicate ME52N create attachment and attachment list in Web dynpro

    Dear Experts,
    Please can someone provide sample code and 'How to' steps to replicate ME52N create attachment and attachment list in Web dynpro?
    I've looked at FILEUPLOAD and FILEDOWNLOAD in Web dynpro and this seems suitable for only 1 file attachment.
    Many thanks, Jas.

    Hi ,
    If your are having a UI like ME52N and you want an attachment feature in each row, I have below suggestions:
    Suggestion 1: If you use ALV
    Add a column in list of type Xstring or which ever suits your document specificatio
    Add a Button on the ALV for attachment,
    On click of the button you can Popup a browse window and user can select the file.
    The content of the file can be stored as Xstring for that Line item.
    Suggestion 2: IF you use Table UI element
    Add an attreibute to context node of type Xstring
    In the Table set, you can set FIleUpload as the editor for this column.
    I hope it helps.
    Regards,
    Sumit

  • 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

Maybe you are looking for

  • Functionalities Change in 11.5.10.2

    Platform: Windows 2003 R2 32-bit EBS: 11.5.10.2 DB: 10.2.0.4 We have just applied all the patches as per our running EBS environment/requirement following metalink note 883202.1. Can anyone please refer me any note/white-paper to come to know what ar

  • How to call a action on page load in jsf

    Hi all, i am having a JSF page where i want to display the records from the datatable. I have a method in bean which call database and gets the list of records. If i call this method from a link (action on this link) present on this page i can displa

  • How to use mathematical calculations in abap

    Hi!                             In my program,                              I declared one variable as w_h(2) type n. i am doing calculation as, w_h = 100 /60. its giving the o/p as 2(1.66...). but in 1.6 i want that 1 alone as my o/p.normally math f

  • Error 29 using final cut pro X ?

    How to burn a DVD in Final Cut Pro X ? I keep getting error code -29 .

  • Hide parent group if child groups are hidden

    I have SSRS 2005 report. Report structure - To show a particular account transactions for every company. So user will select account then i have to show all transactions for that account for all companies. Parent group - Account Child group - Company