Send A Smartform Through Mail Using Oops
Send A Smartform Through Mail Using Oops
Transaction SE78
Enter a name for your logo, select the color BitMap Image and press the Import button.
Smartform creation
Transaction SmartForms Enter a name and press the button Create Select the Main Window, click on the right button, select Create --> Graphic Enter the graphic name, the object and the ID (GRAPHICS / BMAP), select the Color BitMap Image
Select the main window, click on the right button, select Create --> Text Enter a text ..
Now we could test our Smartform, press the Test button (F8). SAP launch the SE37 transaction (Function module) with the function generated by the Smartforms. Press again the test button (F8) Press now execute (F8) Choose a printer and press the button Print Preview
It works !
is_control_param is_params
* Get the function module name corresponding of the Smartform. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = w_formname IMPORTING fm_name = w_funcname EXCEPTIONS OTHERS = 3. CHECK sy-subrc EQ space.
* Set the parameters of the forms. MOVE : 'X' TO is_control_param-no_dialog , 'X' TO is_control_param-preview , '' TO is_control_param-getotf , sy-langu TO is_control_param-langu . CALL FUNCTION w_funcname EXPORTING ARCHIVE_INDEX = ARCHIVE_INDEX_TAB = ARCHIVE_PARAMETERS = control_parameters MAIL_APPL_OBJ = MAIL_RECIPIENT = MAIL_SENDER = output_options = USER_SETTINGS IMPORTING DOCUMENT_OUTPUT_INFO = JOB_OUTPUT_INFO = JOB_OUTPUT_OPTIONS = EXCEPTIONS formatting_error
* * * * * * * * * * *
= is_control_param
=''
=1
=2 =3 =4
END-OF-SELECTION.
TYPE tdsfname , TYPE tdsfname , TYPE swo_typeid , TYPE so_doc_yr , TYPE so_doc_no , TYPE ssfctrlop , TYPE pri_params , TYPE swotobjid , TYPE swotobjid , TYPE swotobjid , TYPE swc_object , TYPE sofmk .
START-OF-SELECTION. * My Smartforms. MOVE 'ZMY_SMARTFORMS' TO w_formname. * Get the function module name corresponding of the Smartform. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = w_formname IMPORTING fm_name = w_funcname EXCEPTIONS OTHERS = 3. CHECK sy-subrc EQ space.
* Set the parameters of the forms. MOVE : 'X' TO is_control_param-no_dialog , '' TO is_control_param-preview , '' TO is_control_param-getotf , sy-langu TO is_control_param-langu , 'MAIL' TO is_control_param-device.
* Create the Recipient. CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF' EXPORTING ip_mailaddr = '[email protected]' IMPORTING ep_recipient_id = is_recipient EXCEPTIONS invalid_recipient = 1 OTHERS = 2. * Create the Sender CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF' EXPORTING ip_sender = sy-uname IMPORTING ep_sender_id = is_sender EXCEPTIONS invalid_sender = 1 OTHERS = 2. * Create the Mail Obj. SELECT SINGLE inbyr inbno INTO (w_year, w_number) FROM soud WHERE sapnam EQ sy-uname. CHECK sy-subrc EQ space. MOVE : 'FOL' TO is_sofmk-doctp , w_number TO is_sofmk-docyr , w_year TO is_sofmk-docno . MOVE is_sofmk TO w_borkey. swc_create_object is_folder 'SOFMFOL' w_borkey. swc_object_to_persistent is_folder is_mailobj.
* * *
* * * * *
CALL FUNCTION w_funcname EXPORTING ARCHIVE_INDEX = ARCHIVE_INDEX_TAB = ARCHIVE_PARAMETERS = control_parameters mail_appl_obj mail_recipient mail_sender output_options = user_settings IMPORTING DOCUMENT_OUTPUT_INFO = JOB_OUTPUT_INFO = JOB_OUTPUT_OPTIONS = EXCEPTIONS formatting_error internal_error send_error user_canceled OTHERS = 5. IF sy-subrc EQ space. COMMIT WORK AND WAIT. ENDIF.
=1 =2 =3 =4
END-OF-SELECTION.
If you haven't entry in the SOUD table you could add-it dynamically with the function SO_USER_AUTOMATIC_INSERT.
If you use an entry of the NAST table (configuration with the NACE transaction ..), instead of creating manually the MAIL_APPL_OBJ, MAIL_RECIPIENT, MAIL_SENDER, you only have to use the function WFMC_PREPARE_SMART_FORM.
Result
In the SOST transaction :
The attachment :
Each time I show that to my users, they didn't want to use that for external mails.
(next step the content of the form inside the mail) Fred