Hi Experts,
In my scenario, I have a User decision step and i want to attach the existing smart form as PDF attachment
to the work item of user decision step itself.
for achiving this i have used the Program Exit Tab of the User decision step; i have created one class which has implemented the standard
SAP interface IF_SWF_IFS_WORKITEM_EXIT. Within the method EVENT_RAISED, i have written the following logical steps.
below steps will work only after work item creation event, i.e. SWRCO_EVENT_AFTER_CREATION
IST_OTF_DATA[] = GD_JOB_OUTPUT-OTFDATA.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 10
IMPORTING
BIN_FILESIZE = GD_PDF_LENGTH
BIN_FILE = GD_PDF_XSTRING
TABLES
OTF = IST_OTF_DATA
LINES = IST_LINES
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
LS_FILE_HEADER-FILE_TYPE = 'B'.
CONCATENATE SY-DATUM SY-UZEIT 'MYFILE' INTO LS_FILE_HEADER-FILE_NAME. "File name
LS_FILE_HEADER-FILE_EXTENSION = 'PDF'.
LS_FILE_HEADER-LANGUAGE = 'EN'.
refresh: LST_SWR_MESSAG,LST_SWR_MSTRUC.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
EXPORTING
WORKITEM_ID = LV_ID "work item ID
ATT_HEADER = LS_FILE_HEADER
ATT_BIN = GD_PDF_XSTRING "Parameter FM CONVERT_OTF
DOCUMENT_OWNER = SY-UNAME
IMPORTING
RETURN_CODE = LS_RETURN_CODE
ATT_ID = LS_ATTCH_ID
TABLES
MESSAGE_LINES = LST_SWR_MESSAG
MESSAGE_STRUCT = LST_SWR_MSTRUC.
Issue is: after executing this FM, LS_RETURN_CODE value is 7; LST_SWR_MESSAG contains message as 'Unable to create attachment'
LST_SWR_MSTRUC contains 1 row as message ID SWR and message no 220.
Work item does not contain any attachment.
please do the needful.
Regards,
Jagesh