Creating Excel attachment (code?)
Sergey Breslavets
sergey.breslavets at epstechnology.com
Fri Feb 6 11:03:41 EST 2004
Hi Robert,
check out SO_DOCUMENT_MANAGER, i think it does what you need. It has =
parameter "Activity" which tells it what to do.=20
here's fragment of my code where i used it to attach external file to =
employee appraisal in PA workflow - i used activity=3D"IMPO", which =
caused it to display "open file" dialog for user to select file for =
attachment. You would need to use different activity code for your task =
- look at the source code to find out.
regards,
Sergey
-------------------------------------------------------------------------=
--------------
*&---------------------------------------------------------------------*
*& Form CREATE_ATTACHMENT
*& Attaches external file to employee appraisal
*& Author Sergey Breslavets
*&---------------------------------------------------------------------*
FORM create_attachment USING p_plvar p_objid.
DATA documents TYPE STANDARD TABLE OF sood4.
DATA document2 TYPE sood4.
DATA attachment TYPE borident.
DATA gs_object TYPE borident.
DATA: p_ret LIKE sy-subrc.
DATA: p_unsubscribe(1).
DATA folder_id TYPE sofdk.
CLEAR p_unsubscribe.
gs_object-objkey(2) =3D p_plvar.
gs_object-objkey+2(8) =3D p_objid.
gs_object-objtype =3D $pa_bapi.
REFRESH documents.
CLEAR document2.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region =3D 'B'
IMPORTING
folder_id =3D folder_id
EXCEPTIONS
OTHERS =3D 1.
document2-foltp =3D folder_id-foltp.
document2-folyr =3D folder_id-folyr.
document2-folno =3D folder_id-folno.
APPEND document2 TO documents.
CALL FUNCTION 'SO_DOCUMENTS_MANAGER'
EXPORTING
activity =3D 'IMPO'
TABLES
documents =3D documents.
IF sy-subrc EQ 0.
CLEAR document2.
CLEAR attachment.
READ TABLE documents INDEX 1 INTO document2.
IF sy-subrc EQ 0.
IF document2-okcode =3D 'CREA' OR document2-okcode =3D 'CHNG'.
attachment-objtype =3D 'MESSAGE'.
attachment-objkey =3D document2(34).
CALL FUNCTION 'BINARY_RELATION_CREATE'
EXPORTING
obj_rolea =3D gs_object
obj_roleb =3D attachment
relationtype =3D 'ATTA'
EXCEPTIONS
OTHERS =3D 1.
IF sy-subrc =3D 0.
COMMIT WORK AND WAIT.
* ------ SUBSCRIBE / UNSUBSCRIBE service
* perform update_DLI using gs_object sy-uname
* changing p_ret "subscribe/unsubscribe
* p_unsubscribe.
* if p_ret eq 0 and p_unsubscribe =3D $_TRUE.
*---- If Unsubscribed - update subscription
* perform update_DLI
* using gs_object sy-uname
* changing p_ret
* p_unsubscribe. "update subscription
* endif.
* ---------------------------------------------------------------------
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " CREATE_ATTACHMENT
-------------------------------------------------------------------------=
------------
-----Original Message-----
From: Robert.vande.Berg at nuon.com [mailto:Robert.vande.Berg at nuon.com]
Sent: Friday, February 06, 2004 3:45 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Creating Excel attachment (code?)
Hello all,
I saw on the discussion group (previous messages) that the solution to
attach an Excel file to a workflow is to Create a method with an import
parameter (the file location on the PC) and an export parameter (the =
SOFM
key of your doc).
Swami needed this.
Can anyone tell me the code for this method? I have to create such a =
method
and the ABAP'rs here don't have a clue about OO and BOR objects / SOFM
objects).
Sorry if this question offends someone, but I need it...
Regards,
Robert
More information about the SAP-WUG
mailing list