Smartforms error
Hi experts
i did a print prg for sending the pdf attachment by smartforms.
but it's getting dumpped,this is my code
plz help me,its urgent.
i checked even SDN Forums also.i made some changes,
even though i don't get the output.
it shows not matching the I_OBJBIN in "SO_NEW_DOCUMENT_ATT_SEND_API1" function module.
REPORT ZCS_SF6.
Internal Table declarations
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE, i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE, i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
w_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
w_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
w_buffer TYPE string,
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZCS_FORM6'
importing
fm_name = v_form_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.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = W_CTRLOP
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = W_RETURN
JOB_OUTPUT_OPTIONS =
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.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
LINES-TDLINE
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 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.
Convert PDF from 132 to 255.
LOOP AT i_tline.
Replacing space by ~
TRANSLATE i_tline USING '~'.
CONCATENATE w_buffer i_tline INTO w_buffer.
ENDLOOP.
Replacing ~ by space
TRANSLATE w_buffer USING '~'.
DO.
i_record = w_buffer.
Appending 255 characters as a record
APPEND i_record.
SHIFT w_buffer LEFT BY 255 PLACES.
IF w_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
Refresh: i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear w_objhead.
Object with PDF.
i_objbin[] = i_record[].
*******DESCRIBE TABLE i_objbin LINES v_lines_bin.
Object with main text of the mail.
i_objtxt = 'Find attached the output of the smart form.'.
APPEND i_objtxt.
*i_objtxt = 'Regards,'.
*APPEND i_objtxt.
*i_objtxt = 'Chandu'.
*APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
read table i_objtxt index v_lines_txt.
Document information.
w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10.
w_doc_chng-obj_descr = 'Smart form output'.
w_doc_chng-sensitivty = 'F'.
w_doc_chng-doc_size = v_lines_txt * 255.
Pack to main body as RAW.
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Packing as PDF.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
i_objpack-obj_descr = 'sf output'
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = '[email protected]'.
*i_reclist-express = 'X'. "Send express
i_reclist-rec_type = 'U'.
APPEND i_reclist.
Sending mail.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = w_objhead
contents_hex = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
points wl be rewarded,if it is useful
thanks in advance.
HI,
Here is the complete program for you.. I have done the same requirment..
P R O G R A M D E C L A R A T I O N *
PROGRAM ID : ZF_QUERY_BANK
AUTHOR : Mahesh Raganmoni
OWNER(Process Team) :
CREATE DATE : 03/04/2004
R/3 RELEASE VERSION : 4.72
BASED-ON PROGRAM : none
ADS : BP14.B&CF.301
DESCRIPTION : This program calles the Bank Query Smartform
and sends this smartforms as an email to the
bank
MODIFICATION LOG CONTROL (Most recent on top):
DATE AUTHOR CTS REQ DESCRIPTION
*09/13/2004 Mahesh Raganmoni DR1K901766 Original Version *
T A B L E S *
TABLES : BUT021, "BP: Address usages
BUT020, "BP: Addresses
T001, "Company Codes
DFKKZP, "Payment lot: Data for payment
BUT000, "BP: General data I
ADR3, "Fax Numbers (Business Address Services)
BNKA, "Bank master record
T012. "House Banks
Internal Tables *
*Address Details of Business Partner
DATA :IT_ADDRESS LIKE STANDARD TABLE OF BUS020_EXT WITH HEADER LINE.
*Return Table
DATA : IT_RETURN LIKE STANDARD TABLE OF BAPIRET2.
PDF Data to hold the data to be sent as an attachment
DATA : IT_PDF_NUC_DATA TYPE STANDARD TABLE OF SOLI.
Converted data from OTF
DATA : IT_PDF_TABLE TYPE RCL_BAG_TLINE.
Data Declaration for Sendig Email
DATA: IT_OBJPACK LIKE SOPCKLSTI1 OCCURS 1 WITH HEADER LINE,
IT_OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE,
IT_OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
IT_OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
IT_OBJHEX LIKE SOLIX OCCURS 10 WITH HEADER LINE,
IT_RECLIST LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE,
IT_LISTOBJECT LIKE ABAPLIST OCCURS 1 WITH HEADER LINE.
Structures *
DATA :WA_BUS000 TYPE BUS000_EXT, "Business Partner Details
WA_ADDRESS TYPE BAPIADDR3, "Collector Address
WA_OUTPUT_OPTIONS TYPE SSFCOMPOP,
WA_CONTROL_PARAMETERS TYPE SSFCTRLOP,
WA_OUTPUT_DATA TYPE SSFCRESCL,
WA_HEADER TYPE ZFCOLL_HEADER, "Smartform Header Info
WA_DFKKZP TYPE DFKKZP,
WA_DOCDATA LIKE SODOCCHGI1.
Variables *
DATA : W_FORMNAME TYPE TDSFNAME, "Smartform Name
W_NAME_ORG TYPE CHAR35, "Business Partner Name
W_ADDRNUMBER LIKE BUT021-ADDRNUMBER, "Address Number of BP
W_ADDRESS1 TYPE CHAR35, "Address Line 1
W_ADDRESS2 TYPE CHAR35, "Address Line 2
W_ADDRESS3 TYPE CHAR35, "Address Line 3
W_GE_NAME TYPE CHAR35, "GE Contact Name
W_GE_PHONE TYPE CHAR35, "GE Contact Phone
W_GE_PHONE1 TYPE CHAR35, "GE Contact Phone
W_GE_PHONE_EX TYPE CHAR10, "GE Contact Phone
W_GE_EMAIL TYPE CHAR35, "GE Contact Email
W_CLIENT_NAME TYPE CHAR30, "Client Name
W_GE_FAX TYPE CHAR35, "GE Fax No
W_GE_FAX1 TYPE CHAR35, "GE Fax No
W_CLIENT_FAX TYPE CHAR35, "Client's Fax No
W_PDF_LEN TYPE I, "Length of PDF file
W_ERR_MESG(120) TYPE C, "Error Message
W_ORG1R LIKE DFKKCR-ORG1R, "Company Code
W_REFERENCE LIKE DFKKCR-REFERENCE, "Payment Reference
W_FNAME TYPE RS38L_FNAM, "Smartform Function Module
" Name
W_SFNAME TYPE TDSFNAME, " Smart Form Name
W_BANKN TYPE CHAR18, "Bank Account Number
W_BETRZ TYPE CHAR15, " Credit AMount
W_WAERS TYPE CHAR5, " Credit Currency
W_VALUT TYPE DFKKZP-VALUT. " Value Date
VARIABLES FOR EMAIL
DATA: W_TAB_LINES TYPE I,
W_DOC_SIZE TYPE I,
W_ATT_TYPE LIKE SOODK-OBJTP,
W_DATFM TYPE XUDATFM.
VARIABLES FOR DATE
DATA: W_DAY(2) TYPE C,
W_MONTH(2) TYPE C,
W_YEAR(4) TYPE C,
W_DATE(10) TYPE C.
Constants *
DATA : C_SELECTED TYPE C VALUE 'X', "Constant for Checked
C_COMMA(2) TYPE C VALUE ', ',"Constant for Comma
C_HYPHEN TYPE C VALUE '-'. "Constant for Hypen
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: P_KEYZ1 TYPE RFKZ0-KEYZ1 OBLIGATORY, "Payment Lot
P_POSZA TYPE DFKKZP-POSZA OBLIGATORY. "Item Number
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: P_REMIT TYPE C AS CHECKBOX DEFAULT 'X', " Remitter Form
P_GENRL TYPE C AS CHECKBOX USER-COMMAND RG1, " General Form
P_TEXT TYPE AD_SMTPADR MODIF ID SC1. " Free Text
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS:P_MAIL TYPE C AS CHECKBOX USER-COMMAND RG2, "Send Email
P_MAILID TYPE AD_SMTPADR MODIF ID SC2.
SELECTION-SCREEN END OF BLOCK b3.
Initialization *
WA_OUTPUT_OPTIONS-XDFCMODE = 'X'.
WA_OUTPUT_OPTIONS-XDF = SPACE.
WA_OUTPUT_OPTIONS-XSFCMODE = 'X'.
WA_OUTPUT_OPTIONS-XDF = SPACE.
At Selection Screen Output *
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'SC1'.
IF P_GENRL = C_SELECTED.
SCREEN-INPUT = 1.
ELSE.
CLEAR P_TEXT.
SCREEN-INPUT = 0.
ENDIF.
ENDIF.
IF SCREEN-GROUP1 = 'SC2'.
IF P_MAIL = C_SELECTED.
SCREEN-INPUT = 1.
ELSE.
CLEAR P_MAILID.
SCREEN-INPUT = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
AT SELECTION-SCREEN.
IF P_REMIT NE C_SELECTED AND P_GENRL NE C_SELECTED.
MESSAGE E004 WITH TEXT-004.
ENDIF.
Start of selection *
START-OF-SELECTION.
IF P_GENRL EQ C_SELECTED.
IF P_TEXT IS INITIAL.
MESSAGE I004 WITH TEXT-023.
STOP.
ENDIF.
ENDIF.
IF P_MAIL EQ C_SELECTED.
IF P_MAILID IS INITIAL.
MESSAGE I004 WITH TEXT-005.
STOP.
ENDIF.
ENDIF.
**Getting Payment Lot and Payment Lot number
PERFORM GET_PAYMENT_DETAILS.
IF NOT WA_DFKKZP IS INITIAL.
Getting the Bank Details
PERFORM GET_BANK_DETAILS.
**Getting the Ge Contact Details
PERFORM GET_GE_CONTACT_DETAILS .
Populating the Structure fields to pass to smartform
PERFORM FILL_EXPORT_STRUCTURES.
CLEAR W_FNAME.
Getting the Function Module name for the Smartform
IF P_REMIT EQ C_SELECTED AND P_GENRL NE C_SELECTED.
W_SFNAME = 'ZF_REMITTER_FORM'.
PERFORM GET_FORMNAME .
ELSEIF P_REMIT NE C_SELECTED AND P_GENRL EQ C_SELECTED.
W_SFNAME = 'ZF_GENERAL_FORM'.
PERFORM GET_FORMNAME .
ELSEIF P_REMIT EQ C_SELECTED AND P_GENRL EQ C_SELECTED.
W_SFNAME = 'ZF_QUERY_BANK_FORM'.
PERFORM GET_FORMNAME .
ENDIF.
IF NOT W_FNAME IS INITIAL.
PERFORM CALL_FORM.
IF P_MAIL EQ 'X'.
IF NOT P_MAILID IS INITIAL.
PERFORM SET_PARAMETERS.
PERFORM DEVICE_TYPE.
PERFORM CALL_FORM.
PERFORM CONVERT_TO_PDF.
PERFORM CONVERT_PDF_TO_BINARY.
PERFORM SEND_MAIL_NO_DISPLAY.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*& Form GET_FORMNAME
Fetch the Function module name for the Smartform
FORM GET_FORMNAME .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = W_SFNAME
IMPORTING
FM_NAME = W_FNAME
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.
ENDFORM. " GET_FORMNAME
*& Form CALL_FORM
To Call the Smartform
FORM CALL_FORM .
SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
CALL FUNCTION W_FNAME
EXPORTING
CONTROL_PARAMETERS = WA_CONTROL_PARAMETERS
OUTPUT_OPTIONS = WA_OUTPUT_OPTIONS
USER_SETTINGS = 'X'
S_HEADER = WA_HEADER
V_ACNO = W_BANKN
V_AMOUNT = W_BETRZ
V_CURR = W_WAERS
V_DATE = W_VALUT
V_TEXT = P_TEXT
IMPORTING
JOB_OUTPUT_INFO = WA_OUTPUT_DATA
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.
ENDFORM. " CALL_FORM
*& Form FILL_EXPORT_STRUCTURES
Populate the structure to send to the smartform as input
FORM FILL_EXPORT_STRUCTURES .
WA_HEADER-BANKA = BNKA-BANKA.
WA_HEADER-ADDR_1 = BNKA-STRAS.
WA_HEADER-ADDR_2 = BNKA-ORT01.
WA_HEADER-ADDR_3 = BNKA-PROVZ.
WA_HEADER-ZZSRCBPNM = T012-NAME1.
SHIFT WA_HEADER-ZZSRCBPNM LEFT DELETING LEADING SPACE.
WA_HEADER-FAX_NUMBER = W_CLIENT_FAX.
WA_HEADER-BUTXT = T001-BUTXT.
WA_HEADER-NAME1 = W_GE_NAME.
WA_HEADER-TEL_NUMBER = W_GE_PHONE.
WA_HEADER-TEL_EXTENS = W_GE_PHONE_EX.
WA_HEADER-SMTP_ADDR = W_GE_EMAIL.
WA_HEADER-GE_FAX_NUMBER = W_GE_FAX.
ENDFORM. " FILL_EXPORT_STRUCTURES
*& FORM CONVERT_TO_PDF
Convert the final doucment (OTF FORMAT) into pdf format
FORM CONVERT_TO_PDF .
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = W_PDF_LEN
TABLES
OTF = WA_OUTPUT_DATA-OTFDATA
LINES = IT_PDF_TABLE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
ENDFORM. " CONVERT_TO_PDF
*& FORM SET_PARAMETERS
Set control parameters to get the output format (OTF) from smart form*
FORM SET_PARAMETERS .
WA_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
WA_CONTROL_PARAMETERS-GETOTF = 'X'.
WA_CONTROL_PARAMETERS-LANGU = SY-LANGU.
ENDFORM. " SET_PARAMETERS
*& FORM DEVICE_TYPE
Get the Device type
FORM DEVICE_TYPE .
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
I_LANGUAGE = WA_CONTROL_PARAMETERS-LANGU
IMPORTING
E_DEVTYPE = WA_OUTPUT_OPTIONS-TDPRINTER
EXCEPTIONS
NO_LANGUAGE = 1
LANGUAGE_NOT_INSTALLED = 2
NO_DEVTYPE_FOUND = 3
SYSTEM_ERROR = 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.
ENDFORM. " DEVICE_TYPE
*& FORM CONVERT_PDF_TO_BINARY
To convert PDF file to Binary format
FORM CONVERT_PDF_TO_BINARY .
CALL FUNCTION 'QCE1_CONVERT'
TABLES
T_SOURCE_TAB = IT_PDF_TABLE
T_TARGET_TAB = IT_PDF_NUC_DATA
EXCEPTIONS
CONVERT_NOT_POSSIBLE = 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. " CONVERT_PDF_TO_BINARY
*& FORM SEND_MAIL_NO_DISPLAY
To send a email
FORM SEND_MAIL_NO_DISPLAY .
DATA: L_SLINE(255) TYPE C,
L_INDEX TYPE SY-TABIX.
IT_OBJBIN[] = IT_PDF_NUC_DATA[].
Title and Description of the mail
WA_DOCDATA-OBJ_DESCR = TEXT-012.
Mail Body content
PERFORM MAIL_BODY.
DESCRIBE TABLE IT_OBJTXT LINES W_TAB_LINES.
READ TABLE IT_OBJTXT INDEX W_TAB_LINES INTO L_SLINE.
L_INDEX = W_TAB_LINES + 1.
WA_DOCDATA-DOC_SIZE = ( W_TAB_LINES ) * 255 + STRLEN( L_SLINE ).
WA_DOCDATA-OBJ_EXPDAT = '29991231'.
WA_DOCDATA-SENSITIVTY = 'O'.
WA_DOCDATA-OBJ_PRIO = '5'.
WA_DOCDATA-EXPIRY_DAT = '29991231'.
WA_DOCDATA-PROC_TYPE = 'R'.
CLEAR IT_OBJPACK-TRANSF_BIN .
IT_OBJPACK-HEAD_START = 0.
IT_OBJPACK-HEAD_NUM = 0.
IT_OBJPACK-BODY_START = 1.
IT_OBJPACK-BODY_NUM = W_TAB_LINES.
IT_OBJPACK-DOC_TYPE = 'RAW'.
IT_OBJPACK-OBJ_DESCR = TEXT-013.
APPEND IT_OBJPACK.
Create message attachment
W_ATT_TYPE = 'PDF'.
DESCRIBE TABLE IT_OBJBIN LINES W_TAB_LINES.
READ TABLE IT_OBJBIN INDEX W_TAB_LINES.
L_INDEX = W_TAB_LINES + 1.
IT_OBJPACK-DOC_SIZE = ( W_TAB_LINES ) * 255 .
IT_OBJPACK-TRANSF_BIN = 'X'.
IT_OBJPACK-HEAD_START = 0.
IT_OBJPACK-HEAD_NUM = 0.
IT_OBJPACK-BODY_START = 1.
IT_OBJPACK-BODY_NUM = W_TAB_LINES.
IT_OBJPACK-DOC_TYPE = W_ATT_TYPE.
IT_OBJPACK-OBJ_DESCR = TEXT-013.
APPEND IT_OBJPACK.
Create receiver list
IT_RECLIST-RECEIVER = P_MAILID. "<-- CHANGE ADDRESS
IT_RECLIST-REC_TYPE = 'U'.
IT_RECLIST-EXPRESS = 'X'.
APPEND IT_RECLIST.
Send Email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X' "USED FROM REL.6.10
TABLES
PACKING_LIST = IT_OBJPACK
CONTENTS_BIN = IT_OBJBIN
CONTENTS_TXT = IT_OBJTXT
RECEIVERS = IT_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH WA_DOCDATA-OBJ_NAME.
ELSE.
SUBMIT RSCONN01 WITH MODE = 'INT' AND RETURN.
SET SCREEN 0.
ENDIF.
ENDFORM. " SEND_MAIL_NO_DISPLAY
*& Form GET_PAYMENT_DETAILS
Get the Payment Lot and Payment Number
FORM GET_PAYMENT_DETAILS .
Get the Payment Lot and Payment Number
SELECT SINGLE BETRZ
BVRKO
BUKRS
WAERS
VALUT
BANKS
BANKL
BANKN
FROM DFKKZP
INTO (WA_DFKKZP-BETRZ,WA_DFKKZP-BVRKO,
WA_DFKKZP-BUKRS,WA_DFKKZP-WAERS,WA_DFKKZP-VALUT,
WA_DFKKZP-BANKS,WA_DFKKZP-BANKL,WA_DFKKZP-BANKN)
WHERE KEYZ1 = P_KEYZ1
AND POSZA = P_POSZA.
IF SY-SUBRC NE 0.
MESSAGE I004 WITH TEXT-100.
EXIT.
ELSE.
W_ORG1R = WA_DFKKZP-BUKRS.
W_BETRZ = WA_DFKKZP-BETRZ.
W_BANKN = WA_DFKKZP-BANKN.
W_WAERS = WA_DFKKZP-WAERS.
W_VALUT = WA_DFKKZP-VALUT.
ENDIF.
ENDFORM. " GET_PAYMENT_DETAILS
*& Form GET_BANK_DETAILS
To Retrive the Bank Details
FORM GET_BANK_DETAILS .
*Get the Bank Address Details
SELECT SINGLE BANKA
STRAS
ORT01
PROVZ
FROM BNKA
INTO (BNKA-BANKA,BNKA-STRAS,BNKA-ORT01,BNKA-PROVZ)
WHERE BANKS = WA_DFKKZP-BANKS
AND BANKL = WA_DFKKZP-BANKL.
IF SY-SUBRC NE 0.
MESSAGE I004 WITH TEXT-101.
EXIT.
ENDIF.
GET The Bank Contact Name.
SELECT SINGLE NAME1
FROM T012
INTO T012-NAME1
WHERE BANKS = WA_DFKKZP-BANKS
AND BANKL = WA_DFKKZP-BANKL.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF NOT W_ORG1R IS INITIAL.
Get the GE Legal Entity Name
SELECT SINGLE BUTXT FROM T001
INTO T001-BUTXT
WHERE BUKRS = W_ORG1R.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDFORM. " GET_BANK_DETAILS
*& Form GET_COLLECTOR_DETAILS
To get the Collector Address Details
FORM GET_GE_CONTACT_DETAILS .
*Getting the Collector details
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
USERNAME = SY-UNAME
IMPORTING
ADDRESS = WA_ADDRESS
TABLES
RETURN = IT_RETURN.
IF NOT WA_ADDRESS IS INITIAL.
CONCATENATE WA_ADDRESS-FIRSTNAME0(18) WA_ADDRESS-LASTNAME0(17)
INTO W_GE_NAME SEPARATED BY SPACE.
W_GE_PHONE = WA_ADDRESS-TEL1_NUMBR.
W_GE_PHONE_EX = WA_ADDRESS-TEL1_EXT.
W_GE_EMAIL = WA_ADDRESS-E_MAIL.
IF NOT WA_ADDRESS-FAX_EXTENS IS INITIAL.
CONCATENATE WA_ADDRESS-FAX_NUMBER C_HYPHEN WA_ADDRESS-FAX_EXTENS
INTO W_GE_FAX.
ELSE.
W_GE_FAX = WA_ADDRESS-FAX_NUMBER.
ENDIF.
ENDIF.
ENDFORM. " GET_GE_CONTACT_DETAILS
*& Form MAIL_BODY
To Build the email body
FORM MAIL_BODY .
PERFORM GET_USER_DATE_FORMAT.
W_YEAR = W_VALUT+0(4).
W_MONTH = W_VALUT+4(2).
W_DAY = W_VALUT+6(2).
PERFORM GET_DATE.
IF P_REMIT EQ 'X' .
CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-021 WA_HEADER-BUTXT ',' TEXT-022
INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
CONCATENATE TEXT-024 W_DATE
TEXT-025 W_BETRZ W_WAERS TEXT-026
INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = TEXT-027.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = WA_HEADER-NAME1.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-028 WA_HEADER-BUTXT INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = TEXT-029.
APPEND IT_OBJTXT.
CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-032 WA_HEADER-SMTP_ADDR INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-033 WA_HEADER-BUTXT INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
ELSEIF P_GENRL EQ 'X'.
CLEAR IT_OBJTXT.
REFRESH IT_OBJTXT.
CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-021 WA_HEADER-BUTXT '.'
INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-034 P_TEXT '.'
INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = TEXT-027.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = WA_HEADER-NAME1.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-028 WA_HEADER-BUTXT INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = TEXT-029.
APPEND IT_OBJTXT.
CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-032 WA_HEADER-SMTP_ADDR INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
ELSEIF ( P_REMIT EQ 'X' AND P_GENRL EQ 'X' ).
CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-021 WA_HEADER-BUTXT ',' TEXT-022
INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
CONCATENATE TEXT-024 W_DATE TEXT-025 W_BETRZ W_WAERS TEXT-026
INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = TEXT-027.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = WA_HEADER-NAME1.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-028 WA_HEADER-BUTXT INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
IT_OBJTXT-LINE = TEXT-029.
APPEND IT_OBJTXT.
CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-032 WA_HEADER-SMTP_ADDR INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
APPEND IT_OBJTXT.
CONCATENATE TEXT-033 WA_HEADER-BUTXT INTO
IT_OBJTXT-LINE SEPARATED BY SPACE.
APPEND IT_OBJTXT.
ENDIF.
ENDFORM. " MAIL_BODY
*& Form get_user_date_format
to get the User Date Format from USR01 table
FORM GET_USER_DATE_FORMAT.
CLEAR W_DATFM.
SELECT SINGLE DATFM INTO W_DATFM
FROM USR01
WHERE BNAME = SY-UNAME.
ENDFORM. " get_user_date_format
*& Form GET_DATE
Get the date in the user format
FORM GET_DATE .
CLEAR W_DATE.
CASE W_DATFM.
WHEN '1'.
CONCATENATE W_DAY '.' W_MONTH '.' W_YEAR INTO W_DATE.
WHEN '2'.
CONCATENATE W_MONTH '/' W_DAY '/' W_YEAR INTO W_DATE.
WHEN '3'.
CONCATENATE W_MONTH '-' W_DAY '-' W_YEAR INTO W_DATE.
WHEN '4'.
CONCATENATE W_YEAR '.' W_MONTH '.' W_DAY INTO W_DATE.
WHEN '5'.
CONCATENATE W_YEAR '/' W_MONTH '/' W_DAY INTO W_DATE.
WHEN '6'.
CONCATENATE W_YEAR '-' W_MONTH '-' W_DAY INTO W_DATE.
ENDCASE.
ENDFORM. " GET_DATE
Thanks
Mahesh
Similar Messages
-
Printing dunning notices using SMARTFORMS,error during parameter transfer
Hi Friends,
I face a error message "Include text ZGA_DUN_HDR does not exist (object TEXT, ID ST)" when i run the dunning run.
I had searched every node for text ZGA_DUN_HDR in the smartform,I didnt find the text in it.
However when I execute the smart form for print preview an error message "Printing dunning notices using SMARTFORMS,error during parameter transfer".This error i believe is due to wrong parameter passing in the fm 'GET_SF_DUNN_DATA'.It raises an error no_parameters_found.All parameters are passed correctly.
Can you guys help me out.
Edited by: RAJIV KAUSHAL on Nov 14, 2008 6:03 PMyou can create this text ZGA_DUN_HDR in SO10 tcode and try ...
-
I would like to know how to solve the following error in smartforms:
Error number: 173
Message : "Table does not fit into window."
Exception : FORMATTING_ERROR
Message ID : SSFCOMPOSER
I am trying to fit a main window and another window in a
template
Thanks in advanceAs I discovered, this error occurred when there is a conflict between the window created for a template and the template itself. The main node for the template is the window in which one can define a height. In the template, which is the node below the window node, one is also required to enter a value for height that has to be the same value. This can be done in the Template table (tab Template), youll find the height defined that is in conflict with the height defined in the table of the window.
-
Print long internal table in smartform, error SSFCOMPOSER250
Hi experts,
In VL03N i'm getting this error SSFCOMPOSER250 (Table row is larger than 176 cm) when printing a long internal table containing item's serial numbers. The item has 1000 serial numbers, and they are passed to the smartform in an internal table. I tried to separate in different rows, each one with 200 serial numbers but when printing the 3rd block the message appears again.
Is it possible to print this table in the smartofrm ??
thanks in advance,
MaríaI used SERIAL_LS_PRINT to get the serial numbers and then PROCESS_SERIALS_FOR_PRINT and got this:
( 768790876 - 768791875 )
But I need to print all the serial numbers, not an interval.. -
Smartform error while printing page wise.
Hi gurus!
while printing from smartforms , if i select particular page in page selection option.
its giving error - No output request open. End not possible.
i have used SSF_OPEN and SFF_CLOSE functional module.
No output request open. End not possible.
Message no. SSFCOMPOSER154
Diagnosis
You tried to close an output request using function module SSFCOMP_CLOSE, but no output request is active.
System response
The system issues an error message.
Procedure
Check the sequence in which you call the function modules SSFCOMP_OPEN and SSFCOMP_CLOSE.
Message was edited by:
rahul deshmukhhi Andrea !
i have used SSF_OPEN and SSF_close functions.Its displays all pages but Its giving error for page selection printing.
Message was edited by:
rahul deshmukh -
Smartform error while issue printpreview in billing
Hello SAP Consultant...
Problem: "Graphic cannot be displayed" while choose output type and print preview in billing VF03.
What I did: I developed one invoice smartform in development and transport to production, working properly.By mistake i deleted development smartform.so i download XML format from PRD system and upload to DEV system.But this downloaded XML form cannot run in DEV system.
Please give way to solve my problem....as quick as possibleI hope from SE78 you have not deleted the graphic.
If it is not deleted then it should show you in your smartform, if you have deleted then b'coz of that you might be getting this error as it may be unavailable.
Secondly, there is nothing related with Smartstyles concept with displaying graphic.
Try to give the correct Graphic name in smartform.
Hopefully, your issue will be resolved. Else, download the graphic from your prd and upload here....
Chk the name of the graphic which you have given in PRD is same as that in PRD SE78.
Compare it with DEV.
Chk the name of the graphic which you have in quality with DEV .
Hope your issue resolves.
Thanks,
M -
Error in the Smartforms 'ERROR CANNOT BE CLASSIFIED'
Hi,
While Executing the output type of ME23N (Custom Output type), I am Getting the Below Error,
From Debugging i came to know that the error is from the Smartform,
From the SFTRACE, I got the Following Log.
00trace begin level 05
00trace version 046C01
00time stamp 20140424094323
00locale date 24.04.2014
00locale time 15:13:23
00system information
00 sap version 731
00 operating system AIX
00 database system DB6
00 database name JEQ
00 user name 90498
05overflow of non main window
05! E SSFCOMPOSER 150
05trace output closed due to error
From the above Log the I came to Know that the error is Not from the Main Window, So I have Checked all the Dimension of the the Windows, Every thing is fine(With in the Page Limit).
The error is Generating from this Code in the Smartform's FM.
Please Suggest a solution.
Thanks
Kranthi.Dear all,
Thanks for the Response, The Issue Is Solved.
There is No Overlapping of Wndows, In my Smart Form there are 2 Pages & both Contains Main Window. They Have Designed in Such a way that "TERMS & CONDITIONS" Should Come in Second Page, Kept the Control Command in the Footer of the Table.
If the Table Entries of the Main Window are Less(i.e., fits in the first page) then it is working fine.
So if the the Records are more and exceeds to the second page then the control commands also fires to the next page (Second page), Hence the error is rised. -
hi experts,
i have developed a driver program for the smartforms ,in the driver program i am displaying with the help of final internal table and with the help of structure i m declaring an internal table in the smartforms,the structure is containg the fields which i used in the driver program for output but when i execute this its giving error...plz helpme to short out this problem what are the points i must consider while declaring structure ....
the error:::
ShrtText
Type conflict when calling a function module (field length).
What happened?
Error in ABAP application program.
The current ABAP program "ZRAW_PRODUCTION_REPORT_SFM" had to be terminated
because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
A function module was called incorrectly.
Error analysis
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_DYN_CALL_ILLEGAL_TYPE',
was neither
caught nor passed along using a RAISING clause, in the procedure "FORM_DISP"
"(FORM)"
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
The call to the function module "/1BCDWB/SF00000211" is incorrect:
In the function module interface, you can specify only
fields of a specific type and length under "ITAB_FINAL_SFM".
Although the currently specified field
"ITAB_FINAL" is the correct type, its length is incorrect.
the final table in the driver program is given below::
,from this table i m showing output.......
TYPES:BEGIN OF S_FINAL ,
MATNR TYPE MARD-MATNR, "for material number
WERKS TYPE MARD-WERKS, "for plant id
LGORT TYPE MARD-LGORT, "Storage location
LABST TYPE MARD-LABST, "opening stock
INSME TYPE MARD-INSME, "Stock in quality inspection
SPEME TYPE MARD-SPEME, "Blocked stock
EINME TYPE MARD-EINME, "Totl Stck of All Restricted Batches
RETME TYPE MARD-RETME, "Blocked Stock Returns
LIFNR TYPE MSEG-LIFNR, "vendors number
MAKTX TYPE MAKT-MAKTX, "for material description
NAME1 TYPE T001W-NAME1, "plant name
NAME2 TYPE LFA1-NAME1, "vendors name
LABST_TM TYPE MARD-LABST, "target monthly
LABST_CL TYPE MARD-LABST, "closing stock
LABST_RT TYPE MARD-LABST, "receive today
LABST_RTLD TYPE MARD-LABST, "receive till date
LABST_RTY TYPE MARD-LABST , "receive till year
LABST_IT TYPE MARD-LABST, "issued today
LABST_ITLD TYPE MARD-LABST, "issued till date
LABST_ITY TYPE MARD-LABST, "issued till year
BWART TYPE MSEG-BWART, "movement type
MBLNR TYPE MSEG-MBLNR, "material doc number
EISBE_CL TYPE MARC-EISBE , "closing balance
EISBE TYPE MARC-EISBE, "safety stock
LGOBE TYPE T001L-LGOBE, "Description of storage location
P_DATE TYPE SY-DATUM, "for previous date
GPTXT TYPE T750E-GPTXT, "for remarks
END OF S_FINAL.
DATA:ITAB_FINAL TYPE STANDARD TABLE OF S_FINAL WITH HEADER LINE.
the fields which are bolds i m not showing in the output using for some calculation thatsit.
with the refrence of this final table how will i declare my structure so that it wont give the above error if possible kindly send me the syntax of declaring structure along with my fields....hi
its better dat u create a structure in abap dictionary in se11...den declare ur internal table of dat type in program and declare ur structure and internal table in smartform of dat type (dictionary structure).im sure dis problem wont arise...
plz reward points if it helps -
SmartForm error: Express document "update was terminated" received from aut
Hi friends
we requirement to send PO smartform through Print out as well as through mail.
after creating PO i am getting popup box saying that :
" Express document "update was terminated" received from author "XXXX".
Please help me.
my code as follows:
IF sy-subrc = 0.
CLEAR g_outop.
SELECT SINGLE ldest dimme FROM nach INTO (g_outop-tddest,
g_outop-tdimmed) WHERE knumh EQ knumh.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'YNZ_PO'
IMPORTING
fm_name = sf_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION sf_name
EXPORTING
output_options = g_outop
user_settings = 'X'
wa_ynz_po_head = wa_ynz_po_head
control_parameters = w_ctrlop
IMPORTING
job_output_info = w_return
TABLES
t_ynz_po_item = t_ynz_po_item
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
for mail
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'YNZ_PO'
IMPORTING
fm_name = sf_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CLEAR g_outop. " Commented by sharma
g_outop-tddest = nast-ldest.
g_outop-tdimmed = nast-dimme.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION sf_name
EXPORTING
output_options = w_compop
user_settings = 'X'
wa_ynz_po_head = wa_ynz_po_head
control_parameters = w_ctrlop
IMPORTING
job_output_info = w_return
TABLES
t_ynz_po_item = t_ynz_po_item
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 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.
Convert PDF from 132 to 255.
LOOP AT i_tline.
Replacing space by ~
TRANSLATE i_tline USING ' ~'.
CONCATENATE w_buffer i_tline INTO w_buffer.
ENDLOOP.
Replacing ~ by space
TRANSLATE w_buffer USING '~ '.
DO.
i_record = w_buffer.
Appending 255 characters as a record
APPEND i_record.
SHIFT w_buffer LEFT BY 255 PLACES.
IF w_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
REFRESH: i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR w_objhead.
Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.
Object with main text of the mail.
i_objtxt = 'Find attached the output of the smart form.'.
APPEND i_objtxt.
i_objtxt = 'Regards,'.
APPEND i_objtxt.
i_objtxt = 'Narasimha'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
Document information.
w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10.
w_doc_chng-obj_descr = 'Smart form output'.
w_doc_chng-sensitivty = 'F'. "Functional object
w_doc_chng-doc_size = v_lines_txt * 255.
Pack to main body as RAW.
Obj. to be transported not in binary form
CLEAR i_objpack-transf_bin.
Start line of object header in transport packet
i_objpack-head_start = 1.
Number of lines of an object header in object packet
i_objpack-head_num = 0.
Start line of object contents in an object packet
i_objpack-body_start = 1.
Number of lines of the object contents in an object packet
i_objpack-body_num = v_lines_txt.
Code for document class
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Packing as PDF.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Smartform_output' '.pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = '[email protected]'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'. "Internet address
APPEND i_reclist.
Sending mail.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_objpack
object_header = w_objhead
contents_bin = i_objbin
contents_hex = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE:/ 'Error When Sending the File', sy-subrc.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.Hi ashok
thanks for your reply.
i got the error at commit in the below Func module.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_objpack
object_header = w_objhead
contents_bin = i_objbin.
if i remove commit = 'X'. no error but mail is not sending.
please advice. -
Smartform Error: Items not printed on next page
Hi everyone,
I am currently working on a Smartform for printing an Invoice. The problem is as follows:
I have a First page and a Next Page. There is a Summary in the footer.
If the items fit on the First page, then there is no problem. If there is space then the Summary is printed on the same page, if there is little space, then the Summary goes on to the Next page (Page Protection is applied).
The problem arise when the items do no fit on the First Page. In this case, I get a weird error saying "Unexpected Error" and some Message 003. I can't understand what the problem is!
I have various attachment pages as well and they are printed properly.
Please help me crack this error at your own leisure!
Thanks.
Edited by: kishan P on Oct 13, 2010 9:44 AMHi Ameya
there might be syntax error. Try to get what exaclty is an error using following code.
CALL FUNCTION <smartform>
EXCEPTIONS
IF SY-SUBRC 0.
CALL FUNCTION 'SSF_READ_ERRORS'
IMPORTING
ERRORTAB = IT_ERRORLIST.
ENDIF.
In IT_ERRORLIST you will get error message.
Regards
Sachin G Patil -
Hi,
I have just moved my smart form from Sandbox to development. I downloaded the form from sandbox to my local machine and then uploaded the form from local machine to development environment.
The smartform was working fine in sandbox (in web), but in development when I preview it in the web (its an SRM Purchase Order), it gives a popup saying "output cannot be created".
When I debug, the error seems to be in function module SSFCOMP_PROCESS_DOCUMENT. It returns sy-subrc 1 and the error is FORMATTING_ERROR.
Please help!!!!
Regards,
JayeshHi,
This could be possibly because some of your table / window contents are exceeding the length or the windows are not fitting.
Try doing a syntax check for your form in the development via smartforms transaction.
Hope this helps.
regards,
Satya -
Smartform Error "No defined value'
Hi ,
I am getting an error message in smartform 'Amount field has no defined value'.
I have declared the amount field in global data & it has default value as '0' & i am computing its value in one of the nodes.
When i try to print this field value at the end in text editor ,it gives the above error message.
Kindly help.
Thanks.Hi,
If you are using it in the program lines, have you check if its in the list of variables in the upper part of the node (FROM/IN and TO/OUT).
Regards,
Leonard Chomi. -
Smartform-Error generating the test frame
i am passing a internal table to a smartform and defined the associated type for that internal table under TYPES tab of the Global Definition.
While testing the smartform it gives a runtime error i.e. Error generating the test frame.
kindly advice where i am going wrong
Thanks
RaviHi Ravindra ,
Test such smartforms with a program and not through SE37 . Not supported see error message -
<b>The test framework for /1BCDWB/SF00000031 has been regenerated but errors have occurred
Message no. FL821
Diagnosis
One reason can be the complex typing of the function module parameters.
In certain circumstances you cannot access the test cases in the test data directory.
Procedure
The test environment of the function builder cannot map (or map correctly) complex types, so that you cannot read or write this data to the test database.</b>
Cheers -
Smartform error of workarea..:no. cannot be converted
hii all ,
i have a smartform in which i have a rate field...and i have to club all the values cming in with respect t tat....i am getting an error like this..""wa_dia may not be converted into a number"" ...what should i do????
plss help me...Check data type of rate field. Also check the values which are being passed in wa_dia and make sure that it is number and not alphabets.
Regards
Mehwish -
Smartform errors encountered in Citrix
We are running into an issue when we want to start Smartforms editor Microsoft Word in SAP clients while working via Citrix. The error message from MS Word: " the macro cannot be found or has been dsiabled because of your Macro security settings"
any idea why this happens?
thanksHi,
As far as I know, when you open the smartform editor, it accesses to your fron end word document to edit the text or to create the text in the smartform.
Hence actually the editor doesn't come from your SAP OS but it comes from your front end OS, here in citrix you are accessing SAP from citrix server hence your front end SAP is running on citrix and not on your desktop OS directly, so smartform will try to search for word on Citrix server.
So I think in your case on the OS of citrix, either MS word has not been installed or you have no rights to access it check it with your admin team who provides support to SAP from citrix.
Maybe you are looking for
-
i just bought an ipad and while attempting to use my apple id in itunes i am asked for an itunes gift code which i have no knowledge of how i can get that code............... please someone help me out
-
How do I remove credit card?
How do I remove a credit card from my iTunes
-
Can anyone please tell me - ( I have spent many hours on the apple website looking for contact details of a real person; but no good )- what to do with my IPod Nano screen that does not work. It is not cracked but is very bright, unreadable and seems
-
DBMS_LDAP package documentation and samples
Where can I find the DBMS_LDAP package documentation and samples to use it to connect to OID from pl/sql blocks. TIA, Nishant
-
Suddenly (with iTunes 7) the ability for me to surprise my daughter with a $$ gift to her iTunes account is gone. Now it appears that you can only do it by email or snail mail or set up an "allowance"... what's the deal with that?