on 09-08-2014 1:50 PM
Hello all,
Please advice me how to use SOFM object for attachments.
I verified certain sdn threads wher they are attaching a adobe form but did not understand the procedure.
Please let me know the underlying logic of this SOFM object and steps to create an attachment.'
Thanks in advance.
Cheers
Prasad CH.
Hi Prasad
Maybe you need to elaborate more on what you require.
Do you have an attachment in the WF and need to send it in an email / Workitem?
Or
The approvers can create and attach a document/note in a decision and you need to send it back to initiator / next approver by workitem/email?
Or
You want to create an attachment in a background step- upload from application server?
Or
What?
Regards,
Modak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Modak.
You are exactly correct. You made me to find the way.. thanks
Actually there is an invoice release workflow and in that they are using.
1..They are sending attachments as email to outlook using SOFM bindings etc.
2.They are creating the attachements dynamically using this SOFM
3..The documents are updated automaticlly and sent to other approvals.
What al you have defined, all of them appear to be in the same workflow .
As you suggested, i verified the document in scn links , but seriously i did not understand the concept, i want to learn so that i can use it myself.
Please advice, and thanks a TON.........
Regards,
Prasad CH.
Hi Prasad
SOFM is a business object which represents a "Document" at runtime within the SAP System.This document can be a .PDF or >TXT or .DOC ... and so on.
SAP Has to save it and hence there are some base document tables associated with it. You can check the definition of the keys of SOFM.
In order to read, display, etc - SOFM has a few methods you can use.
You will NOT find anything on SCN which will discet SOFM for you. Best is to look in SWO1 and check every attribute and Method and see what it does.
If I were you, I would look at the workflow steps, check out what they are doing with the SOFM Business Object at each stage ... that is, how is the code written to change it...etc, when it is getting attached (Bound) to a step, why... and so on
To send via email, all you go to do is Bind this BO Instance from the workflow to the Mail step in "ATTACHMENTS" container element of the mail step.
Regards,
Modak
Hi,
Below is the sample code.
data: LV_DOC_DATA TYPE SODOCCHGI1,
LV_FOLDER_ID TYPE SOODK,
IT_SOLIX_TAB TYPE SOLIX_TAB,
WA_DOC_INFO TYPE SOFOLENTI1,
LV_OBJTYPE TYPE SWOTOBJID-OBJTYPE,
LV_OBJKEY TYPE SWOTOBJID-OBJKEY,
LV_SOFM TYPE SWOTRTIME-OBJECT,
LV_RETURN TYPE SWOTRETURN,
TB_OBJ TYPE TABLE OF OBJ_RECORD,
LV_OBJECT TYPE OBJ_RECORD.
**If there are no prior attachments then identify the folder id based on sy-user
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
OWNER = SY-UNAME
REGION = 'B'
IMPORTING
FOLDER_ID = LV_FOLDER_ID.
**Creating First attachment
LV_DOC_DATA-OBJ_NAME = 'Purchase Order details as PDF'.
LV_DOC_DATA-OBJ_DESCR = 'Attachment 1'.
LV_DOC_DATA-OBJ_LANGU = SY-LANGU.
LV_DOC_DATA-SENSITIVTY = 'P'.
**--Here V_BIN_FILESIZE is file size of PDF form stored in IT_SOLIX_TAB
LV_DOC_DATA-DOC_SIZE = V_BIN_FILESIZE.
**--IT_SOLIX_TAB = PDF of Smart form.
CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
EXPORTING
FOLDER_ID = LV_FOLDER_ID
DOCUMENT_DATA = LV_DOC_DATA
DOCUMENT_TYPE = 'PDF'
IMPORTING
DOCUMENT_INFO = WA_DOC_INFO
TABLES
CONTENTS_HEX = IT_SOLIX_TAB
EXCEPTIONS
FOLDER_NOT_EXIST = 1
DOCUMENT_TYPE_NOT_EXIST = 2
OPERATION_NO_AUTHORIZATION = 3
PARAMETER_ERROR = 4
X_ERROR = 5
ENQUEUE_ERROR = 6
OTHERS = 7.
* Populate object type and object key for create an instance
LV_OBJTYPE = 'SOFM'.
LV_OBJKEY = WA_DOC_INFO-DOC_ID.
**Creating SOFM object
CALL FUNCTION 'SWO_CREATE'
EXPORTING
OBJTYPE = LV_OBJTYPE
OBJKEY = LV_OBJKEY
IMPORTING
OBJECT = LV_SOFM
RETURN = LV_RETURN
EXCEPTIONS
NO_REMOTE_OBJECTS = 1
OTHERS = 2.
* Prepare for attaching the object to container
LV_OBJECT-HEADER = 'OBJH'.
LV_OBJECT-TYPE = 'SWO'.
LV_OBJECT-HANDLE = LV_SOFM.
APPEND LV_OBJECT TO TB_OBJ.
CALL METHOD LO_CONTAINER->SET
EXPORTING
NAME = '_ATTACH_OBJECTS' "To attach objects to WOrk item
VALUE = TB_OBJ[].
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In SAP SCN you just search for wiki or threads for usin SOFM, you will find some documents or idea threads there
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.