Nothing Special   »   [go: up one dir, main page]

0% found this document useful (0 votes)
197 views5 pages

Upload PDF From WF To PA30

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 5

Uploading Attachment(s) from Workflow to PA30 Employee repository.

Business Requirement: Client needs to upload PDF(s) to Workflow at ‘user decision’ through ‘import’
button and after final approval of workflow that document needs to upload at PA30 repository of a
particular employee.

Pre-Requisite: Content Server should be configured through a Tcode – OAC0. Here it is ‘Z1’.

Function Modules:

A) SAP_WAPI_GET_ATTACHMENTS – For fetching Attachments attached to Workitem.


B) SO_DOCUMENT_READ_API1 – For fetching hexadecimal data of PDF through folderid/objid.
C) HR_KR_XSTRING_TO_STRING – For converting xstring data to string data.
D) ARCHIVOBJECT_CREATE_TABLE – For getting unique document ID of the document
uploaded.
E) ARCHIV_CONNECTION_INSERT – For uploading the document to repository using business
object ( BUS1065 ) and employee number.
F) ARCHIVOBJECT_DISPLAY – For display of document uploaded/attached to workitem by
passing the archive document ID we got from FM ‘ ARCHIVOBJECT_CREATE_TABLE’.

SOLUTION :

There is a Workflow ‘WS90000019’ - upto 4 levels of approvals/rejections. After final approval the
Worklfow will execute the final step i.e. ‘Unlock the entry of Infotype’ which will run at background.

PS: This step unlocks the locked record of employee (Workflow executed through a BADI HRPAD00INFTY)
as well as uploads the document(s) attached to USER DECISION of Workflow.

1) Final Step ‘Unlock the entry of Infotype’ of WF where I have used ‘Z’ class method.
2) Class : ‘ZCL_WF_INFOTYPE’ Method : ‘UPDATE_INFOTYPE’.

3) All Parameters of method ‘UPDATE_INFOTYPE’.

4) Passing the Work item Id to FM ‘SAP_WAPI_GET_ATTACHMENTS’ and fetch the attachments.


5) We will get the attachment list in a table ‘Attachment’. Within this table there is a field ‘OBJECT’
which contains the ‘DOCUMENT ID’ in format ‘ FOL43000000000004EXT44000000001555’.
6) Later, we will pass this doc id to FM ‘SO_DOCUMENT_READ_API1’ and retrieve its
‘contents_hex’ ( hexadecimal data ) which will be in RAW255.

7) With the updated Acrobat (PDF version), we need our data to be in char1024 rather than
char/RAW255. So, we need to use a class ‘ cl_rmps_general_functions’.
a. There are few methods which will use:
i. convert_255_to_1022: use this to convert RAW255(contents_hex) to
RAW1024.
ii. convert_1022_raw_to_xstring: use this to convert RAW1024 to xstring.

Now we will use the FM ‘ HR_KR_XSTRING_TO_STRING’.


iii. convert_string_to_1022_char: use this to convert string data to
character 1024.

8) After getting ‘Re_tab’ from the above FM, we will make it compatible to
it_tbl1024(‘archivobject’) of FM (‘ARCHIVOBJECT_CREATE_TABLE’) . 
   
 TABLES
 archivobject             = it_tbl1024 

Below are the constants used within the Function modules:

Here,
EXPORTING PARAMETERS
Archiv_id -> Content server ID on Tcode OCA0.
Document_type -> Type of document i.e. PDF
Length -> length of document attached.
Compid -> document name/id
IMPORTING PARAMETERS
Archiv_doc_id -> Unique Document Id
9) After getting the ‘archiv_doc_id’ we will attach this document to repository of the employee
through FM ‘ARCHIV_CONNECTION_INSERT’. Object Id -> pernr.

10) Also, We can use the FM ‘ARCHIVOBJECT_DISPLAY’ to display the document we have uploaded.

You might also like