on 12-26-2006 2:49 PM
Hi Gurus,
what are the standard layout sets available in Smartforms?.. How can I modify them.
I would like to find out the particular smartform in the domain of QM.
I am trying to generate a customer letter in smartforms with the sold-to-party details on top and the material he ordered in the body of the letter with other details like the quality process which we used and also I want to generate this form in .pdf and .doc formats for printing and faxing aswell.
Please help me in this issue.
Thanks in Advance.
Kind Regards,
Praveen
Hi Praveen,
for generating a standard type smartform u can find them in TNAPR table entries. but if u wanna have a customised SF then u have to create it.
for converting SF to PDF
first convert the smartform output which is in rtf format to otf format using covert_otf FM then use FM convert to PDF and then use Fm API_SEND to send it as a mail..
the following code can be applied...partly the logic is right and not all the code.
TABLES: zKTREE_t1,sflight.
DATA: cparam TYPE ssfctrlop,
outop TYPE ssfcompop,
fm_name TYPE rs38l_fnam,
my_tabix TYPE sy-tabix,
file_size TYPE i,
bin_filesize TYPE i.
DATA: tab_otf_data TYPE ssfcrescl,
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
itab LIKE TABLE OF zshail_t1 WITH HEADER LINE,
otab TYPE TABLE OF sflight WITH HEADER LINE,
tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE.
start-of-selection.
suppressing the dialog box****************************
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = space.
cparam-getotf = 'X'.
****************for the first smartform*******************************
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSHAIL_SMFORM2'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SELECT my_id my_income my_name FROM zshail_t1 INTO TABLE itab.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = cparam
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = outop
user_settings = space
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = tab_otf_data
JOB_OUTPUT_OPTIONS =
TABLES
it_tab = itab[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*********appending the otf data into the final table*********************
tab_otf_final[] = tab_otf_data-otfdata[].
**removing the initial and final markers from the OTF data*********
DELETE tab_otf_data-otfdata WHERE tdprintcom = '//'.
searching for the end-of-page in OTF table************
READ TABLE tab_otf_final WITH KEY tdprintcom = 'EP'.
my_tabix = sy-tabix + 1.
appending the modified OTF table to the final OTF table****
INSERT LINES OF tab_otf_data-otfdata INTO tab_otf_final INDEX my_tabix.
finally call the Fm SO_NEW_DOCUMENT_ATT_SEND_API1
to send as email for this u need to populate the reciepent fields properly
g_cont_par-device = 'MAIL'.
Get BOR-Objects for Recipient, Sender und Applikation
PERFORM mail_recipient_object CHANGING g_mail_rec_obj.
PERFORM mail_sender_object CHANGING g_mail_sen_obj.
PERFORM mail_appl_object CHANGING g_mail_app_obj.
Calling Smartform
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = g_cont_par
mail_appl_obj = g_mail_app_obj
mail_recipient = g_mail_rec_obj
mail_sender = g_mail_sen_obj
output_options = g_output
user_settings = ' '
IMPORTING
... rest of function ...
Here are the Forms:
&----
*& Form mail_recipient_object
&----
text
----
<--P_G_MAIL_REC_OBJ text
----
FORM mail_recipient_object CHANGING p_mail_rec_obj.
CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'
EXPORTING
IP_COUNTRY =
IP_FAXNO =
ip_mailaddr = g_mail "g_mail type
"SO_NAME.
ip_type_id = g_rectype " 'U'
IMPORTING
ep_recipient_id = p_mail_rec_obj
EP_ADDRESS =
ET_RECIPIENT =
EXCEPTIONS
invalid_recipient = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " mail_recipient_object
&----
*& Form mail_sender_object
&----
text
----
<--P_G_MAIL_SEN_OBJ text
----
FORM mail_sender_object CHANGING p_mail_sen_obj.
CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'
EXPORTING
ip_sender = sy-uname
IMPORTING
ep_sender_id = p_mail_sen_obj
EXCEPTIONS
invalid_sender = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " mail_sender_object
&----
*& Form mail_appl_object
&----
text
----
<--P_G_MAIL_APP_OBJ text
----
FORM mail_appl_object CHANGING p_mail_app_obj.
SELECT * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.
ENDSELECT.
IF sy-subrc NE 0.
CALL FUNCTION 'SO_USER_AUTOMATIC_INSERT'
EXPORTING
sapname = sy-uname
EXCEPTIONS
no_insert = 1
sap_name_exist = 2
x_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
CLEAR soud.
ELSE.
SELECT * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.
ENDSELECT.
ENDIF.
ENDIF.
CLEAR sofmfol_key.
sofmfol_key-type = 'FOL'.
sofmfol_key-year = soud-inbyr.
sofmfol_key-number = soud-inbno.
bor_key = sofmfol_key.
IF NOT bor_key IS INITIAL.
swc_create_object folder 'SOFMFOL' bor_key.
IF sy-subrc = 0.
swc_object_to_persistent folder p_mail_app_obj.
IF sy-subrc NE 0.
CLEAR p_mail_app_obj.
ENDIF.
ENDIF.
ELSE.
CLEAR p_mail_app_obj.
ENDIF.
ENDFORM. " mail_appl_object
Message was edited by:
Durgaprasad Kare
Message was edited by:
Durgaprasad Kare
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.