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

Similar Messages

  • 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

  • GOS - Create attachment - how to rmove those documents and link the to BDS

    Hi all
    When using GOS - create attachment, the documents gets saved to the database. How can i extract or move those documents over to BDS and store it in KPRO.
    Any ideas will be great.
    Pierre

    Hello! I need same. Specially, to use methods form CL_BDS_DOCUMENT_SET class with GOS documents.
    Some help?
    Thanks on advance.
    Emanuel

  • 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

  • Automatic GOS create attachment in ME51n

    Hi,
    I need to find a FM that adds an attachment to a requirement which is created from IDOC.
    IDOC itself contains a link to the document that should be attached. The document is located on a network drive. The link is visable in created requirement in item texts.
    As far as I could see it is imposible to use GOS in create tcode ME51n. However it is available in ME52n.
    The attachment creation should be automatic.
    Will appreciate ideas, clues and codes.
    Regards,
    MM

    Try to find an userexit after save in ME51N and get the url from IDoc and try to use
    data lo_attachment type ref to cl_gos_document_service.
      clear ls_url.
      create object lo_attachment.
      call method lo_attachment->create_url
           exporting  is_object = ls_object
           importing  ep_url = lp_url.
    In After save userexit you will also get the pur req docno also. this is needed for INSTID_A in the link table.
    a®s
    Edited by: a®s on Mar 4, 2008 12:28 PM

  • GOS create attachment automaticly

    Hi experts,
    I met a requirement that upload an PDF file to GOS attachment, the PDF file will be generate from abap memory, does any know how to do it?
    Best regards,
    Tracy

    Hi Tracy,
    Use FM SO_FOLDER_ROOT_ID_GET
    then FM SO_DOCUMENT_INSERT.
    we will find links on how to use them.
    Check this sdn wiki :
    Use of Generic object services to attach a URL to Business objects - Code Gallery - SCN Wiki
    Thanks,
    Anil

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

    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.

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

  • GOS - Create Attachment for Order in Background.

    Hi,
    My Requirement is to attach a document (.PDF, .DOC, .TIF or .JPG) to transaction JHA1X with respect to Order in background and it wll be stored in Open Text Server. 
    Document details wiil be passed throuh Portal, as XSTRING to ECC. Is there any BAPI ( Something that helps) available to upload this to transaction ?
    Note : Through transaction I am able to do this ( By BO and Doc Type ) using store business document.
    Thanks,
    Praveen N

    I would call the method CREATE_ATTACHMENT of class CL_GOS_DOCUMENT_SERVICE
    this will allow to select the file on PC and will attach it to the business object
    if you already have the binary contents of the file and don't want to change the way to get it, then you can look into this method how to do it

  • How to create GOS view attachment list in ECC6

    Hi,
    I created Z transaction. I have to create View attachment List to this transaction. How to create GOS view attachment list in ECC6. can anybody send sample code on this.
    Thanks in advance.
    Zakir.

    Hi all,
    I've following problem with class CL_GOS_ATTACHMENTS.
    Transaction IE01/02/03 (create/change/display equipment) starts and instantiate GOS manager, and related BAdI are called.
    Then, when I choose one of available service, CL_GOS_ATTACHMENTS is instantiated, and inside that class a new GOS manager is instantiated, inspite of already existing instance.
    As a result, related BAdI are called twice, but unfortunately second time some SY variables are not correctly filled, particularly SY-TCODE and SY-MODNO are both empty.
    I've develop a workaround so that when sy-tcode is filled I save it somwhere, and when it's empty I filled it from saved value, does anyone know any other solution??
    Many thanks
    Regards
    m@x

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

  • 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

  • How to send GOS document attached to PO for Printing

    Hi,
    My requirement is as below.
    My user is creating attachment to the Purchase Order using GOS. For purchase order we have created one Z smart from.
    So when ever the user print the from for PO, along with the PO form my client want to print all the attachment also.
    How we can print the attcahment(GOS) in the PO along with the form.
    My client also want to send this attachment via mail and fax when ever the form is sent via mail or fax.
    Kindly help.

    Continue.........
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    region = 'B'
    IMPORTING
    folder_id = lv_folder
    EXCEPTIONS
    communication_failure = 1
    owner_not_exist = 2
    system_failure = 3
    x_error = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    ENDIF.
    lv_object-objla = 'EN'.
    lv_object-objnam = 'MESSAGE'.
    lv_object-objdes = 'test'.
    concatenate '&KEY&' p_url into wa_content-line.
    APPEND wa_content TO it_content.
    CALL FUNCTION 'SO_DOCUMENT_INSERT'
    EXPORTING
    parent_id = lv_folder
    object_hd_change = lv_object
    document_type = 'URL'
    IMPORTING
    document_id = lv_doc
    TABLES
    objcont_text = it_content
    EXCEPTIONS
    active_user_not_exist = 1
    dl_name_exist = 2
    folder_not_exist = 3
    folder_no_authorization = 4
    object_type_not_exist = 5
    operation_no_authorization = 6
    owner_not_exist = 7
    parameter_error = 8
    substitute_not_active = 9
    substitute_not_defined = 10
    x_error = 11
    OTHERS = 12.
    IF sy-subrc EQ 0.
    MOVE: p_key TO lv_object_a-instid,
    p_bo TO lv_object_a-typeid,
    'BO' TO lv_object_a-catid.
    CONCATENATE lv_folder-objtp lv_folder-objyr lv_folder-objno
    lv_doc-objtp lv_doc-objyr lv_doc-objno
    INTO lv_object_b-instid.
    lv_object_b-typeid = 'MESSAGE'.
    lv_object_b-catid = 'BO'.
    TRY.
    CALL METHOD cl_binary_relation=>create_link
    EXPORTING
    is_object_a = lv_object_a
    is_object_b = lv_object_b
    ip_reltype = 'URL'.
    CATCH cx_obl_parameter_error .
    CATCH cx_obl_model_error .
    CATCH cx_obl_internal_error .
    ENDTRY.
    COMMIT WORK.
    ENDIF.

  • 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

Maybe you are looking for

  • How to create an extension not in default location in Eclipse?

    Hi everybody, I recently installed an Extension builder 3 on my Eclipse Kepler (on a Mac OS 10.6.8) I just created an extension for InDesign CC (9.2) in my eclipse workspace. This works fine, I can launch InDesign CC and see my extension. I just crea

  • Reader not saving Rights Enabled Form

    I have a form created in Acrobat Pro. Rights have been enabled for reader and it will not save. I'm go crazy. It works on the station nest to me but not on all. I have tried several version of Reader too. 7, 8, 9. Anyone have any thoughts. Please! Th

  • Writing a User exit for a Variable in Bex Query

    Hi Guys, I need some urgent help on this.  I appreciate your help. I have a variable ZVAR1 ( Store id) in a query.  This processing type is manual entry. There is another variable ZVAR2 (0Orgunit).  The value in ZVAR2 should be populated by convertin

  • How Async messages can be resend/restarted? Please help!

    Hi Experts,         I have read that Async messages are persistent that is XI stores Async messages in database. That means Async messages can be resend or restarted on the event of a failure. 1. Will the XI server resend/restart async messages autom

  • I get an Error 7 (Windows error 126) when installing itunes

    I get an Error 7 (Windows error 126) when installing itunes to my laptop.  Got this after last upgrade attempt.  Uninstalled and tried reinstalling, but get same message