on 05-27-2011 11:44 AM
HI Experts,
I have scenario of adding attachment to the User decision step.
There is an activity (BUS2000126) And when i open the Activity in CRMD_ORDER there is a Questionnaires
tab under which i see the questions and Answer displayed (Radiobutton, checkbox values will be filled by user)
in the white page. And i need to attach this content in the PDF file to the User dicision step in my
workflow which i am triggering for this activity instance/guid.
I have created a step before the User decision step in my workflow to get the content of this file/data which is
available under Questionnaire tab. In the method i am reading the Activity data using CRM_ORDER_READ
and reading the ET_SURVEY into an Internal table.
I see that this internal table field SURVEYID is showing the value same as heading of the content which is
displaying under Questionnaire tab in the Activity.
There is also a field called VALUEXML and has a value :
3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D227574662D38223F3E0A3C737
5727665793E3C726174696E67666163746F723E3C71313E313C2F71313E3C69645F346439343063326332633262323062326531303
I checked the description of this field in the structure CRMT_SURVEY_WRK and found below
Field Component type data type short description
VALUEXML CRM_SVY_DB_SVS_XML RAWSTRING 0 0 CRM Surveys: Survey Values Binary Long Object
I am assuming that my document content is available in VALUEXML field and i did the following.
I called fm SCMS_BINARY_TO_XSTRING passing VALUEXML value into this FM assuming that my VALUEXML is in Binary format.
And then i am calling 'SAP_WAPI_ATTACHMENT_ADD'.
After doing all this i am able to see the value in the container &_ATTACH_OBJECTS&
And i am able see the link in the User decision step with the name i have provided to FM 'SAP_WAPI_ATTACHMENT_ADD'.
(Binding done for &_ATTACH_OBJECTS& between workflow and User decision step )
But, it is giving error while i am trying to open the attachment from both GUI and WEB UI.
In GUI getting the pop_up error: This file does not have a program associated with it for performing this action.
Create an association in the folder options control panel.
And when i click on the Questionnaire link then it opens a New Browser in Mozilla
with the Error:XML Parsing Error: not well-formed
And when i try to open the attachment via IE 6.0, it gives pop-up to open the file with Unknown type.
Please help and guide if i am missing something. I think, i am doing something wrong in the beginning
while reading the file content. Please comment if you are aware of this scenaio.
And i am not 100% sure that, from where i need to read the document content available under Questionnaire
tab of this activity. And this is the first time i am adding attachment in the workflow step.
Please let me know if you need more info.
Thanks,
Chetan.
Hi Chetan,
When you add the atatchment using FM 'SAP_WAPI_ATTACHMENT_ADD', you have to pass the PDF name as 'FORM.PDF'.
In the form name itself, you have to pass the .PDF extension.
Thanks,
Viji.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Viji,
I tried the option with the .PDF extn as well. But it didn't work.
I am getting a pop up message this time " Adobe reader could not open 'A9R35.tmp' because it is either not a supported file
type or because the file has been damaged."
I am directly passing the VALUEXML value which i got from the internal table ET_SURVEY. Please check the below code.
I am not 100% sure that whether the VALUEXML has the content of the attachment or not. And do i need to do any conversion here or am i missing some important code here. (I am not converting the valuexml value below because I don't know the VALUEXML is in which format ,Binary or XSTRING?)
Reading the ET_SURVEY from CRM_ORDER_READ into an internal table lt_survey.
And then checking the following code.
IF SY-SUBRC = 0.
read TABLE lt_survey into ls_survey index 1.
data: lv_header type SWR_ATT_HEADER .
lv_header-file_type = 'B'.
lv_header-file_name = 'QUESTIONNAIRES.PDF'.
lv_header-file_extension = 'PDF'.
lv_header-language = 'EN'.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
EXPORTING
workitem_id = wi_id
att_header = lv_header
att_txt = 'Questionnaires'
att_bin = ls_survey-VALUEXML
document_owner = sy-uname
language = sy-langu
do_commit = 'X'.
ENDIF.
If possible, provide me the piece of code which i have to write to add the Activity Questionnaires content as an PDF file in the User decision step.
Thanks for your cooperation and time.
Reg,
Chetan
Try with this attachment way:
1. first create business object with parameters. declare one parameter for returning sofm object. Usually is used ZSOFM parameter for returning SOFM object. Uncheck dialog option while creting method, because if you check dialog it is allows user interaction while workflow execution.
2. create activity step in workflow. then assign this business object. then do binding. in binding automatically assigned zsofm with attachobjects in workflow container. Here check Backgroung Processing.
3. then goto user decision step, then goto methods tab, here before workitem execution option, then enter attachobjects from container and give ATTACH method for SOFM object.
4. Execute Workflow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.