on 07-27-2009 1:11 PM
Hi Folks
In a previous post a asked about how to attach and send a dynamic PDF form.
In the following code I determine the Form Name, get the FORMOUTPUT and add it to an email attachment.
My problem now is that when I look in transaction SOST the attachment doesn't display any of the dynamic info supplied from the context.
Could someone please help to tell me how I need to include this.
<br>
Thanks
<br>
* First get name of the generated function module<br>
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'<br>
EXPORTING<br>
i_name ='ZSFPFLS_EX_WDA_CON'<br>
IMPORTING<br>
e_funcname = fm_name.<br>
<br>
* Set output parameters and open spool job<br>
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup<br>
fp_outputparams-getpdf = 'X'. " launch print preview<br>
fp_outputparams-PDFCHANGESRESTRICTED = 'N'. "Form can be filled out and signed and you can also create comments<br>
<br>
CALL FUNCTION 'FP_JOB_OPEN'<br>
CHANGING<br>
ie_outputparams = fp_outputparams<br>
EXCEPTIONS<br>
cancel = 1<br>
usage_error = 2<br>
system_error = 3<br>
internal_error = 4<br>
OTHERS = 5.<br>
<br>
* Set form language and country (->form locale)<br>
*fp_docparams-fillable = 'X'. "Only set this if the form must be interactive<br>
fp_docparams-dynamic = 'X'. "Only set this if the form must be interactive and dynamic<br>
<br>
* Now call the generated function module<br>
CALL FUNCTION fm_name<br>
EXPORTING<br>
/1bcdwb/docparams = fp_docparams<br>
/1bcdwb/docxml = fp_docxml<br>
IMPORTING<br>
/1bcdwb/formoutput = fp_formoutput<br>
EXCEPTIONS<br>
usage_error = 1<br>
system_error = 2<br>
internal_error = 3<br>
OTHERS = 4.<br>
<br>
* Close spool job<br>
CALL FUNCTION 'FP_JOB_CLOSE'<br>
EXCEPTIONS<br>
usage_error = 1<br>
system_error = 2<br>
internal_error = 3<br>
OTHERS = 4.<br>
<br>
* Now you have the PDF form in xstring format inside the field fp_formoutput-pdf<br>
<br>
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'<br>
EXPORTING<br>
buffer = fp_formoutput-pdf<br>
TABLES<br>
binary_tab = itab.<br>
<br>
TRY.<br>
* " create email objects<br>
l_o_send_request = cl_bcs=>create_persistent( ).<br>
<br>
<br>
* " sender<br>
l_o_sender = cl_cam_address_bcs=>create_internet_address( REPLY_ADDRESS ).<br>
l_o_send_request->set_sender( i_sender = l_o_sender ).<br>
<br>
<br>
* " recipient TO<br>
l_o_recipient = cl_cam_address_bcs=>create_internet_address( ADDRESS).<br>
l_o_send_request->add_recipient(<br>
i_recipient = l_o_recipient<br>
).<br>
<br>
* " create documents<br>
l_o_document = cl_document_bcs=>create_document(<br>
i_type = 'RAW' " RAW document format<br>
i_text = l_it_contents<br>
i_subject = SUBJECT<br>
).<br>
* l_o_send_request->set_document( l_o_document ).<br>
<br>
* " add attachment<br>
l_o_document->add_attachment( EXPORTING i_attachment_type = 'PDF'<br>
i_attachment_subject = SUBJECT<br>
i_att_content_hex = itab ).<br>
l_o_send_request->set_document( l_o_document ).<br>
<br>
* " send email<br>
l_v_ret = l_o_send_request->send( ).<br>
<br>
CATCH cx_bcs INTO bcs_exception.<br>
* exceptions, do something<br>
ENDTRY.<br>
<br>
* never forget this one<br>
COMMIT WORK.
<br>
Hi,
U have to create Importing parameteres in the SFP transaction for
the corresponding data that u pass from web dynpro.So this importing
parameters can be filled while u call the function module that is
automatically generated for the Form.
Importing parameters are created while designing Interface for the
form under Interface tab.
In turn ,those parameters are selected while designing Form for display
and binded with attributes .
Thanks,
Divya.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
YES u need to create importing paramters for each field that u hav
in ur form.While u assign this interface to the Form under Properties
tab,ur importing parameters will automatically appear in the
Import under the Context tab of ur form.
I have done this as per my requirement.
It worked for me.
Thanks,
Divya.S
Hi Divya
Surely there's an easier way around this. My form has about 50 fields which normaly get filled from the context.
I have tried to test this anyway in Tx SFP, but there is nowhere where I have the option of adding Import parameters.
The standard parameters:
/1BCDWB/DOCPARAMS
and
/1BCDWB/DOCXML
are the only ones that exist.
Don't I need to fill these 2 parameters when calling:<br>
CALL FUNCTION fm_name<br>
EXPORTING<br>
/1bcdwb/docparams = fp_docparams<br>
/1bcdwb/docxml = fp_docxml<br>
IMPORTING<br>
/1bcdwb/formoutput = fp_formoutput<br>
EXCEPTIONS<br>
usage_error = 1<br>
system_error = 2<br>
internal_error = 3<br>
OTHERS = 4.
<br><br>?
Hi,
For fp_docparams,
u ll fill all dese fields,
fp_docparams-langu = lc_sprsl.
fp_docparams = lc_country.
fp_docparams = 'X'.
U can maintain structure as one of the Importing parameter
containing 50 fields and fill them correspondingly for display.
U cannot pass data to the form without giving importing
parameter to the FM.
What are the fields tat u fill in fp_docxml.
Thanks,
Divya.S
/1BCDWB/DOCPARAMS and /1BCDWB/DOCXML are both generated by default when I create a form from within SE80 in a Web Dynpro View. The Interface gets generated automatically when linking the form to my context on the Web Dynpro View.
fp_docparams-... gets filled:
fp_docparams-langu = 'E'.
fp_docparams-country = 'ZA'.
fp_docxml is of type xstring and is now being filled by the PDFSource binary in my context. (Although this isn't yet producing results)
I still don't see where I can add more parameters to the Interface in Tx SFP. I am in Change Mode, but find no option to add Parameters.
If I do manage to add more parameters, how will I link these in my Form because I can't see the Parameters when in the Layout view of the form in Tx SFP..
Thanks again. Do you have any other suggestions?
Just a question..
Does my Interface need to be ABAP Dictionary Based for this to work?
Mine is XML-Schema based.
When creating a test Interface as ABAP Dictionary based, I see that I have the option to add more Parameters.
I will do some more tests and see if this is the solution.
Feel free to comment further.
Thanks again
Anton
Hi,
If ur interactive form is XML-Schema based,
u cannot add importing parameters explicility.
Instead in web dynpro ,while u place Interactive
form UI element,it ll generated the interface automatically
for the data source node binded in the data source property.
Hence all the data value is passed from the webdynpro to
the form.
Thanks,
Divya.S
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.