cancel
Showing results for 
Search instead for 
Did you mean: 

Add Attachment to VF03 GOS service

Former Member
0 Kudos

Dear all,

I want to add attachment to the GOS service (like the original invoice document which was created). I have only found the function "ARCHIVOBJECT_CREATE_SYNCHRON" to add the content to archive. But I don't have a local file to get the path of the file with it. I have the content of the Attachment already at runtime in the programm and don't want to write a local file and then attach it with this function.

Has anyone an Idea how to add the attachment without having a local file?

many thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member183148
Contributor
0 Kudos

Christof Spörk,

    All the outgoing document like scripts, smartforms and adobe forms can be archived as PDF to during run time by customization(refer archivelink documentation for this or else let me know if you need any info on this)


I had take "SGOSATTR" to SM30 to see what is the class that responsible for attaching and displaying the documents and found

  

TC -> SE24  class CL_GOS_SRV_ATTACHMENT_LIST contains  Modify these two methods accordingly

Now I copied them to CL_GOS_SRV_ATTACHMENT_CREATE to ZCL_GOS_SRV_ATTACHMENT_CREATE to modify "EXECUTE"

method with below code.

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\ChristofSpörk\TESTING_of_ ChristofSpörk_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.

This way the documents can be attached to store in DMS.

Please Close the thread if this reply is helpful to you. It helps others to know the right answer.


BOL

Kolusu