You are on page 1of 8

Import of a logo

Transaction SE78

Double-click on the line BMAP

Enter a name for your logo, select the color BitMap Image and press the Import button.

Enter the file name, and press Enter.

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 ..

Press the Activate icon.

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 !

Creation of a simple calling program for the Smartform.

DATA : w_formname w_funcname

TYPE tdsfname , TYPE tdsfname , TYPE ssfctrlop , TYPE pri_params.

is_control_param is_params

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 , '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

internal_error send_error user_canceled OTHERS = 5.

=2 =3 =4

END-OF-SELECTION.

With this code you could print or preview the form.

Send the Smartform by email


* Need for the macro to build Mail_Appl_Obj. INCLUDE <cntn01>.

DATA : w_formname w_funcname w_borkey w_year w_number

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 .

is_control_param is_params is_recipient is_sender is_mailobj is_folder is_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 = 'frederic.girod@everywhere.com' 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.

= is_control_param = is_mailobj = is_recipient = is_sender =''

=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 :

And the mail :

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

You might also like