on 03-31-2008 2:15 PM
Hai friends,
Following screnario is my first Online interactive PDF form.
1) User has to give the input like Employee Number,Employee Name,Employee Mail id in the Online PDF form.When user press submit button the detail which he has entered has to be sent to the entered Mail id.
2) According to that I can transfer the pdf file without the data which i has entered like Employee Number,Employee Name,Employee Mail id i,e with empty content.
3) But In my Pdf file should contain all the details i have entered.
4) I have created my interactive form with the following properties
Layout type: zcl layout
Interface type :XML Schema Based Interface.
I have attached my code here.
I don't know where the conflict occurs.
Could you please check it out my code.let me know the conflict.
DATA: FM_NAME TYPE RS38L_FNAM,
FP_DOCPARAMS TYPE SFPDOCPARAMS,
lt_att_content_hex type SOLIX_TAB ,
FP_OUTPUTPARAMS TYPE SFPOUTPUTPARAMS,
fp_result TYPE fpformoutput.
data:wa_empdet type zsat_emp.
data: input_node1 type ref to if_wd_context_node.
data:ip_xtr type xString.
input_node1 = wd_context->get_child_node( 'EMPDET' ).
input_node1->get_attribute( EXPORTING name = 'EMP_NO'
IMPORTING value = wa_empdet-EMP_NO ).
input_node1->get_attribute( EXPORTING name = 'EMP_NAME'
IMPORTING value = wa_empdet-EMP_NAME ).
input_node1->get_attribute( EXPORTING name = 'FEEDBACK'
IMPORTING value = wa_empdet-FEEDBACK ).
input_node1->get_attribute( EXPORTING name = 'EMAIL'
IMPORTING value = wa_empdet-EMAIL ).
Sets the output parameters and opens the spool job
*CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
IE_OUTPUTPARAMS = FP_OUTPUTPARAMS
EXCEPTIONS
CANCEL = 1
USAGE_ERROR = 2
SYSTEM_ERROR = 3
INTERNAL_ERROR = 4
OTHERS = 5.
*
*IF SY-SUBRC <> 0.
*
*ENDIF.
Language and country setting (here US as an example)
*
*fp_docparams-langu = 'E'.
*
*fp_docparams-country = 'US'.
*FP_DOCPARAMS-FILLABLE = 'X'.
DATA lo_nd_pdf TYPE REF TO if_wd_context_node.
DATA lo_el_pdf TYPE REF TO if_wd_context_element.
DATA ls_pdf TYPE wd_this->element_pdf.
DATA lv_pdfsource LIKE ls_pdf-pdfsource.
navigate from <CONTEXT> to <PDF> via lead selection
lo_nd_pdf = wd_context->get_child_node( name = wd_this->wdctx_pdf ).
get element via lead selection
lo_el_pdf = lo_nd_pdf->get_element( ).
get single attribute
lo_el_pdf->get_attribute(
EXPORTING
name = `PDFSOURCE`
IMPORTING
value = lv_pdfsource ).
call function 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZTEMPSAMPLE1'
IMPORTING
e_funcname = fm_name.
CALL FUNCTION fm_name
EXPORTING
/1BCDWB/DOCPARAMS = FP_DOCPARAMS
/1bcdwb/docxml = ip_xtr
IMPORTING
/1BCDWB/FORMOUTPUT = fp_result
EXCEPTIONS
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_ERROR = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Close the spool job
*CALL FUNCTION 'FP_JOB_CLOSE'
IMPORTING
E_RESULT =
EXCEPTIONS
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_ERROR = 3
OTHERS = 4.
*IF SY-SUBRC <> 0.
*
*ENDIF.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_pdfsource
APPEND_TO_TABLE = 'X'
IMPORTING
OUTPUT_LENGTH =
tables
binary_tab = lt_att_content_hex.
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
Message body and subject
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Hi,' TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Please fill the attached form and send it back .'
TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Thank You,' TO lt_message_body.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Interactive Form' ).
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Pdf Form'
I_ATTACHMENT_SIZE =
I_ATTACHMENT_LANGUAGE = SPACE
I_ATT_CONTENT_TEXT =
I_ATTACHMENT_HEADER =
i_att_content_hex = lt_att_content_hex ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
Add attachment
Pass the document to send request
lo_send_request->set_document( lo_document ).
Create sender
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
*
*DATA:
*lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL.
*lo_sender = cl_sapuser_bcs=>create( sy-uname ).
Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
Create recipient
DATA:
eaddr TYPE ADR6-SMTP_ADDR.
eaddr = wa_empdet-email.
Data:
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
lo_recipient = cl_cam_address_bcs=>create_internet_address( eaddr ).
*lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
message 'The form has been emailed to the recipient' type 'I'.
clear wa_empdet.
Regards,
Keerthi.
Hi,
If i understand well you success to send the form without value , that's right ?
Now you are not able to popualte the fields inside your forms with what user set ?
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.