on 02-13-2008 11:02 AM
Hi all,
I have following requirement. For a particular service order, i am reading the entire survey details and then my requirement is that i want to convert this details into a PDF document and then attach the document to the same service order.
Right now, i have created a SMARTFORM which prints the required details. I got the OTFDATA of the smartform and now my problem is to convert it into PDF and then attach it to the service order .
Kindly help.
Points will be rewarded.
Thanks in advance,
Karan
hello,
we had got a similar requirement in which we needed to upload a cv and attach it to documents tab in bp transaction. the uploading of cv was done through bsp application.
you need to store the contents in binary format.
so try converting the data to binary format and then save it in the business document.
you need to debug the code when you upload a document using the import option in documents tab in service order.
also debug the code for saving.
you may notice that sap does not use crm_order_maintin and crm_order_save for uploading documents.
some of the function modules we used were
SKWG_OLS_BO_LINKS_GET
CRM_KW_BOR_SET
SKWF_CTX_CREATE
SKWF_PKG_DYNAMIC_CREATE
SKWF_LOIO_WITH_PHIO_CREATE
SCMS_XSTRING_TO_BINARY
SKWF_PHIO_STORE_CONTENT
CRM_KW_OLS_IO_LINK_CREATE
COM_PCAT_IMS_CA_BDS_CP_EXIT
but i would suggest that you better use actions .
In action you call a fucntion module and in that fucntion module, you call a screen which displays your pdf document.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks alot for your reply. Now this is the thing i have already done.
1. Call the smartform and get the required OTFdata.
2. Convert this OTF data into PDF format using FM "CONVERT_OTF".
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = LV_LEN_IN
TABLES
OTF = LT_OTFDATA
LINES = LT_LINES
Now, i get the data in the format LT_LINES which has PDF format data.
I am able to attach the file with CREATE_WITH_FILE method of the class CL_CRM_DOCUMENTS but in that case, i need to first create the file on presenation server using GUI_DOWNLOAD after converting to PDF format and then using the same. This unnecessary creates the file on presentation server which i dont want to.
Now i want to use the method CREATE_WITH_TABLE of the class CL_CRM_DOCUMENTS which needs the data to be passed into binary format. If you could help me getting the correct parameters for the mentioned method, then it would be great.
Thanks,
Karan
business object
business_object-instid = guid.
business_object-typeid = 'BUS2000116'.
business_object-catid = 'BO'.
PROPERTIES
ls_loio_properties-name = 'DESCRIPTION'.
APPEND ls_loio_properties TO l_loio_properties.
ls_loio_properties-name = 'KW_RELATIVE_URL'.
ls_loio_properties-value = 'Test'.
APPEND ls_loio_properties TO l_loio_properties.
CLEAR ls_loio_properties.
ls_loio_properties-name = 'DESCRIPTION'.
APPEND ls_loio_properties TO l_phio_properties.
ls_loio_properties-name = 'KW_RELATIVE_URL'.
ls_loio_properties-value = 'any name'.
APPEND ls_loio_properties TO l_phio_properties.
ls_loio_properties-name = 'LANGUAGE'.
ls_loio_properties-value = 'EN'.
APPEND ls_loio_properties TO l_phio_properties.
FILE_ACCESS_INFO
FILE_SIZE = l_filesize.
mimetype = 'application/pdf'.
file_name = 'any name'.
binary_flg = 'X'.
FILE_CONTENT_BINARY
pass the binary content
RAW_MODE
X
package_id -> to create package id
CONSTANTS: c_objtype TYPE skwf_ioty VALUE 'P',
c_sign TYPE sdok_qusgn VALUE 'I',
c_op TYPE sdok_cxop VALUE 'NX'.
c_class TYPE sdok_class VALUE 'BDS_POC1'.
DATA: appl TYPE skwf_appl.
DATA: cspc TYPE sdok_ent VALUE 'CRM'.
CALL FUNCTION 'CRM_KW_BOR_SET'
EXPORTING
iv_business_object = business_object.
ls_selectors-type = c_objtype.
ls_selectors-attribute = 'LANGUAGE'.
ls_selectors-sign = c_sign.
ls_selectors-op = c_op.
APPEND ls_selectors TO lt_selectors.
ls_selectors-type = c_objtype.
ls_selectors-attribute = 'BDS_DOCUMENTTYPE'.
ls_selectors-sign = c_sign.
ls_selectors-op = c_op.
APPEND ls_selectors TO lt_selectors.
KW Framework: Context Treatment
CALL FUNCTION 'SKWF_CTX_CREATE'
EXPORTING
context_class = 'CRM_CTXCL'
x_reduce_to_one = reduce_to_one
description = 'Default Context'
x_transient = 'X'
IMPORTING
context_id = lv_context_id
TABLES
instance_selectors = lt_selectors.
KW Framework: Package Handling
CALL FUNCTION 'SKWF_PKG_DYNAMIC_CREATE'
EXPORTING
package_desc = 'PAKET'
x_transient = 'X'
appl = appl
cspc = cspc
context_id = lv_context_id
IMPORTING
new_package_id = l_pkgid
error = l_error.
Hi Karan,
I have very similar requirement and i need few inputs from you. I tried mailing you, but your em@il id has changed. Could you please let me know your m@il id, so that I can ask u my queries ?
Regards,
Manas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the class CL_CRM_DOCUMENTS and the corresponding methods to fulfill the funcionality
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.