Sap data in pdf format
i need function module such that to convert sap format to pdf format....
if source code available attach it plz
Hi,
Try FM " CONVERT_ABAPSPOOLJOB_2_PDF "
Sample Report:
REPORT Z_TEXT_SPOOL_CONVERT.
TABLES: TSP01.
PARAMETERS: P_SPID LIKE TSP01-RQIDENT.
DATA: BEGIN OF ITAB OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF ITAB.
DATA: C_DIA TYPE C VALUE 'X',
C_DEVICE LIKE TSP03-PADEST,
C_BYTE_CNT TYPE I.
DATA: P_FILE TYPE STRING VALUE '
DWDFHOME02\C5103908$\My Documents'.
DATA: NUM(5) TYPE C.
DATA: pdfspoolid like tsp01-rqident,
jobname like tbtcjob-jobname,
jobcount like tbtcjob-jobcount.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = P_SPID
NO_DIALOG = ''
DST_DEVICE = C_DEVICE
PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = C_BYTE_CNT
PDF_SPOOLID = PDFSPOOLID
LIST_PAGECOUNT =
BTC_JOBNAME = JOBNAME
BTC_JOBCOUNT = JOBCOUNT
TABLES
PDF = ITAB
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC = 0.
WRITE:/ 'PDF GENERATED'.
NUM = P_SPID.
CONCATENATE P_FILE '\' NUM '.PDF' INTO P_FILE.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = P_FILE
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ITAB
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
WRITE:/ 'NOT'.
ENDIF.
Hope this helps you.
Regards,
Ruthra
Similar Messages
-
How to display the data in PDF format : problem is splitting into 2 lines
Hi ,
I developed one report which downloads the data into PDF format and saved in C drive but my problem is
in my program : Line size of the report is 255 in PDF it is splitting into 2 lines. it has to show in a single line. how to do it. how to reduce the width of the output? i am sending my code below. anybody can suggest me how to do it. if possible please send me the code.
my code:
report zmaheedhar.
maheedhar-start
TABLES : vbak.
parameters : p_vbeln type vbak-vbeln.
data : begin of itab occurs 0,
vbeln type vbak-vbeln,
ERDAT type vbak-erdat,
ERZET type vbak-erzet,
ERNAM type vbak-ernam,
ANGDT type vbak-angdt,
BNDDT type vbak-bnddt,
AUDAT type vbak-audat,
VBTYP type vbak-vbtyp,
TRVOG type vbak-trvog,
AUART type vbak-auart,
AUGRU type vbak-augru,
GWLDT type vbak-gwldt,
SUBMI type vbak-submi,
LIFSK type vbak-lifsk,
FAKSK type vbak-faksk,
NETWR type vbak-netwr,
WAERK type vbak-waerk,
VKORG type vbak-vkorg,
end of itab.
maheedhar-end
DATA: pripar TYPE pri_params,
arcpar TYPE arc_params,
lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
rows TYPE pri_params-linsz.
DATA: val(1), val1(1).
*---> Local Printer Name defined in SAP, Change NHREMOTE to your local printer
DATA: dest TYPE pri_params-pdest VALUE 'ZNUL'.
DATA: name TYPE pri_params-plist VALUE 'Testing'.
DATA: i_pdf TYPE STANDARD TABLE OF tline.
DATA: spono TYPE tsp01-rqident.
maheedhar-start
top-of-page.
write: 'Sales Document' , 'C Date', 'Entry time', 'Created By','Quotation date',
'Date','Document Date','SD document category','Transaction group','Sales Document Type',
'Order reason'.
start-OF-SELECTION.
select vbeln ERDAT ERZET ERNAM ANGDT BNDDT AUDAT
VBTYP TRVOG AUART AUGRU GWLDT SUBMI LIFSK
FAKSK NETWR WAERK VKORG from vbak
into table itab
where vbeln = p_vbeln.
maheedhar-end
--- Retreive local printer details
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = dest
no_dialog = 'X'
immediately = ' '
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
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.
*-- Set Spool printer details w.r.t local printer
pripar-prdsn = 'DSN'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = arcpar
in_parameters = pripar
no_dialog = 'X'
list_name = name
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
---> Triggers the spool creation in the sense all the write statements from hereon will be written to spool instead of screen
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS pripar
ARCHIVE PARAMETERS arcpar
NO DIALOG.
ELSE.
WRITE:/ 'Unable to create spool'.
ENDIF.
*--- Output statements
*WRITE:/ 'First Line', 'mahee','lklk','kikik','lokiuj','fffff','kijuyh','fgfgfgfg','gtgtgtgtgtgtgtgtggggggggggggggggggggggggggggggg'.
*WRITE:/ 'Second Line'.
LOOP at itab.
write: itab-vbeln,
itab-ERDAT,
itab-ERZET,
itab-ERNAM,
itab-ANGDT,
itab-BNDDT,
itab-AUDAT,
itab-VBTYP.
ENDLOOP.
"---> Close spool
NEW-PAGE PRINT OFF.
spono = sy-spono.
Convert ABAP Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spono
no_dialog = 'X'
TABLES
pdf = i_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
Download PDF contents to presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\test.pdf'
filetype = 'BIN'
TABLES
data_tab = i_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
thanks,
maheedharhi tripat,
actual problem is what u said it is decreased the wiidht of the output.
now the output is:
Sales Document C Date Entry time Created By Quotation date Date Document Date
SD document category Transaction group Sales Document Type Order reason
62741 07/29/1996 11:54:38 DARLENE 00/00/0000 00/00/0000 07/29/1996 C
actual output is:
output should come in a single line. it is splitting into 2 lines.
thanks,
maheedhar -
How to convert the alv list data into pdf format
Hi Expersts,
Is it possible to convert the alv list output data into PDF format? if yes, then please help me with this issue.
thanks in advance,
Regards,
Samadhii samad,
you can go through these link.i hope it ll solve your purpose
How to convert list output to PDF
Display ALV list output in PDF format
regards,
Shweta -
How to convert internal table data to PDF format
HI,
I have an internal table data having one field with 255 chars. length.I want to send that intenal table data as attachemnt with external mail. i am thinking of converting that data into PDF format and use the FM to send the mail. How to convert internal table data to PDF format.
KishoreIn which format is your data in the internal table currently. Is it returned by a smartform/script or its just data fetched from some database table into an internal table. Since its obvious that the data should appear in the PDF with some Layout, you should be using smartform to format the data properly. See the Link
Smartform to PDF to EMAIL
This shows convertion of smartform to pdf and send it through email
Regards,
Abhishek -
Hello Gurus,
How to get all the ECC repots in PDF format? I have tried doing the distiller as default printer, but didn't work out.
I am using SAP ECC 6.
Thanks and Regards,
RahulHello,
Auto convert SAP spool output to PDF file
As of Release 4.6D, PDF format (Adobe Acrobat data format) can be created via the SAP spooler by using the device type "PDF1".
As a workaround, a report (RSTXPDFT4) is made available for the missing "direct PDF printing", which can read spool requests, convert to PDF and perform a frontend download.
Read OSS Note 317851 - Printing PDF files in 4.6C/4.6B/4.5B
Note the restrictions specified in Note 323736 with the print output with PDF.
Caution when modifying device type ZPDF1, see Note 437696.
Version < 4.6D
If you are in version less than 4.6D, you can configure an output type to convert the spool automatically into a PDF format into your local harddisk but not do a "direct PDF printing".
When you print to this PDF output type, it will prompt you to enter the file name of your PDF file to be stored into your local harddisk.
First you have to add a printer using
Windows -> Start -> Settings -> Printers -> Generic / Text Only -> Port : Print to File
Next create a new device type e.g. ZPDF -> Select device type ZPDF1
Options for HostSpoolAccMethod -> Host spool access method : F : Printing on Frontend Computer
Host Printer : __DEFAULT or Generic / Text Only
Save your entries.
When you print to the device type ZPDF, choose Generic / Text Only for the Frontend Computer if it is not the default type.
A user prompt Print to File will appear to let you specify the Output File Name.
Regards
ismail KARAYAKA -
Convert internal table data to pdf format and send mail to Users
Hi all ,
I want to convert the data available in internal table to pdf format and then send it to mail .
Please tell me wht are the fn modules available to convert the data from internal table to pdf and then send it mail .
regards
santosh .Hi Santosh
Sending mail with attachment report in Background
Content Author: Fernando Faian
I have read the hint about "Sending mail with attachment report".
It's great, but how can I make this function work in background??
I had that needed last year too. See attachment a function group with two functions. The second one has that functionality to send email or fax (SAP office) with attachment objects in background job using SO_ATTACHMENT_INSERT function.
Pay attention because its working with output list from spool converted to pdf.
=================================================================================
z_send_email_fax_global
FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
WORK TABLE AREAS
TABLES: tsp01.
INTERNAL TABLES
DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
TYPES: BEGIN OF y_files,
file(60) TYPE c,
END OF y_files.
DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
g_document LIKE sood4,
g_header_data LIKE sood2,
g_folmem_data LIKE sofm2,
g_header_data LIKE sood2,
g_receive_data LIKE soos6,
g_ref_document LIKE sood4,
g_new_parent LIKE soodk,
l_folder_id LIKE sofdk,
v_email(50).
DATA: hd_dat like sood1.
VARIABLES
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: outbox_flag LIKE sonv-flag VALUE 'X',
store_flag LIKE sonv-flag,
delete_flag LIKE sonv-flag,
owner LIKE soud-usrnam,
on LIKE sonv-flag VALUE 'X',
sent_to_all LIKE sonv-flag,
g_authority LIKE sofa-usracc,
w_objdes LIKE sood4-objdes.
DATA: c_file LIKE rlgrap-filename,
n_spool(6) TYPE n.
DATA: cancel.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
CONSTANTS
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
=================================================================================
z_send_email_fax2
FUNCTION z_faian_mail_fax2.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
*" TABLES
*" LT_BODY_EMAIL STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
Fist part: Verify if the spool really exists
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc NE 0.
RAISE err_no_abap_spooljob. "doesn't exist
ELSE.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = lt_body_email
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
CLEAR lt_rec_tab.
lt_rec_tab-sel = 'X'.
lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
lt_rec_tab-recnam = 'U-'.
lt_rec_tab-deliver = 'X'.
lt_rec_tab-not_deli = 'X'.
lt_rec_tab-read = 'X'.
lt_rec_tab-mailstatus = 'E'.
lt_rec_tab-adr_name = fax_mail_number.
lt_rec_tab-sortfield = fax_mail_number.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-sortclass = '5'.
APPEND lt_rec_tab.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-recesc = object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
lt_files-file = c_file.
APPEND lt_files.
begin of insertion by faianf01
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
end of insertion by faianf01
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
check_send_authority = 'X'
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDIF.
ENDFUNCTION.
=================================================================================
z_send_email_fax
FUNCTION ZCBFS_SEND_MAIL.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" TABLES
*" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
DATA: vg_achou(1) TYPE n.
Fist part: Verify if the spool really exists
vg_achou = 1.
DO 60 TIMES.
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc IS INITIAL.
CLEAR vg_achou.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
IF vg_achou = 1.
RAISE err_no_abap_spooljob. "doesn't exist
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
LOOP AT LIST_FAX_MAIL_NUMBER.
lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
lt_rec_tab-recesc = 'U'.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
ENDLOOP.
lt_files-file = c_file.
APPEND lt_files.
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDFUNCTION.
Regards,
Sree -
How to display webdynpro view data in PDF format.
Dear All,
Greetings!!!
scenario :
i am having five tabstrips in a table , first four for the different kinds of data
and fifth one is for to display all tabstrips data in a PDF format.
Kindly let me know how to acheive this .
is it possible with out ADLC..? any demo or article is available for similar requirement?
Thanks in Advance.
Best Regards,
Kranthikumar Palle.It's better to use the Adobe form to display your WD data. But you can choose Smartform as a PDF doc to display the WD data.
Check out the thread [Display a Smartform as PDF document in WD ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785] for more details. -
Displaying a form in an iView & displaying data in .pdf format in an iView
Hi,
1)We want to show some details in an iView pertaining to the person who has logged into the portal. We are calling a function module (when a user clicks on a workset in the portal) and passing some parameters to it. The function module pulls the data from the tables and generates a sap script which displays the data in a SAP Script Form.
Now our problem is how do we display the form in the iView?
2) We want to show some details in an iView pertaining to the person who has logged into the portal. We are calling a function module (when a user clicks on a workset in the portal) and passing some parameters to it. The function module pulls the data from the tables and converts the data into a pdf file.
How do we display the data in the .pdf format in the iView.Hi,
displaying a PDF in an iView I receive the following errormessage:
Access denied:.....
security zone:.....
The portalapp.xml is like
<property name="SecurityZone" value="epp/NO_SAFETY"/>
<property name="ResourceBundleName" value="epp_lang"/>
<property name="AuthRequirement" value="none"/>
Any ideas?
Thanks
Walter -
How to display the data in PDF format
hi all,
i will give input in my selection screen and i will execute my report then it has to display data in PDF file in some directory (like c or d directory). i refered existingthreads . most of then saying using spool req we can download pdf file i.e. not my requirement. my requirement is when i click on execute button it has to display the data in pdf file with headings.
Anybody can send me the sample code please.
thanks,
maheedharHi Easwar,
i am sending my code. in this one records is splitting into 2 records.
report zmaheedhar.
maheedhar-start
TABLES : vbak.
parameters : p_vbeln type vbak-vbeln.
data : begin of itab occurs 0,
vbeln type vbak-vbeln,
ERDAT type vbak-erdat,
ERZET type vbak-erzet,
ERNAM type vbak-ernam,
ANGDT type vbak-angdt,
BNDDT type vbak-bnddt,
AUDAT type vbak-audat,
VBTYP type vbak-vbtyp,
TRVOG type vbak-trvog,
AUART type vbak-auart,
AUGRU type vbak-augru,
GWLDT type vbak-gwldt,
SUBMI type vbak-submi,
LIFSK type vbak-lifsk,
FAKSK type vbak-faksk,
NETWR type vbak-netwr,
WAERK type vbak-waerk,
VKORG type vbak-vkorg,
end of itab.
maheedhar-end
DATA: pripar TYPE pri_params,
arcpar TYPE arc_params,
lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
rows TYPE pri_params-linsz.
DATA: val(1), val1(1).
*---> Local Printer Name defined in SAP, Change NHREMOTE to your local printer
DATA: dest TYPE pri_params-pdest VALUE 'ZNUL'.
DATA: name TYPE pri_params-plist VALUE 'Testing'.
DATA: i_pdf TYPE STANDARD TABLE OF tline.
DATA: spono TYPE tsp01-rqident.
maheedhar-start
top-of-page.
write: 'Sales Document' , 'C Date', 'Entry time', 'Created By','Quotation date',
'Date','Document Date','SD document category','Transaction group','Sales Document Type',
'Order reason'.
start-OF-SELECTION.
select vbeln ERDAT ERZET ERNAM ANGDT BNDDT AUDAT
VBTYP TRVOG AUART AUGRU GWLDT SUBMI LIFSK
FAKSK NETWR WAERK VKORG from vbak
into table itab
where vbeln = p_vbeln.
maheedhar-end
--- Retreive local printer details
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = dest
no_dialog = 'X'
immediately = ' '
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
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.
*-- Set Spool printer details w.r.t local printer
pripar-prdsn = 'DSN'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = arcpar
in_parameters = pripar
no_dialog = 'X'
list_name = name
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
---> Triggers the spool creation in the sense all the write statements from hereon will be written to spool instead of screen
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS pripar
ARCHIVE PARAMETERS arcpar
NO DIALOG.
ELSE.
WRITE:/ 'Unable to create spool'.
ENDIF.
*--- Output statements
*WRITE:/ 'First Line', 'mahee','lklk','kikik','lokiuj','fffff','kijuyh','fgfgfgfg','gtgtgtgtgtgtgtgtggggggggggggggggggggggggggggggg'.
*WRITE:/ 'Second Line'.
LOOP at itab.
write: itab-vbeln,
itab-ERDAT,
itab-ERZET,
itab-ERNAM,
itab-ANGDT,
itab-BNDDT,
itab-AUDAT,
itab-VBTYP.
ENDLOOP.
"---> Close spool
NEW-PAGE PRINT OFF.
spono = sy-spono.
Convert ABAP Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spono
no_dialog = 'X'
TABLES
pdf = i_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
Download PDF contents to presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\test.pdf'
filetype = 'BIN'
TABLES
data_tab = i_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
thanks,
maheedhar -
Hi all,
I want to extract the data from the invoice smartform and i should display it in pdf format.I have invoice number with me as input parameter.
Can any one solve my problem...it is urgent plz.........
Thanks ,
Rakesh.hi
good
please check this code
By using FM we can convert smartform to PDF like CONVERT_PDF
and GUI_DOWNLOAD.
*& Report ZSRI_RE_02
REPORT ZSRI_RE_02.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME.
PARAMETER: P_DATE LIKE SY-DATUM.
PARAMETER: P_REA TYPE CHAR255.
SELECTION-SCREEN:END OF BLOCK B1.
*DATA:WS_UCOMM LIKE SY-UCOMM.
DATA FORM_NAME TYPE rs38L_fnam.
DATA: WA_CTRLOP TYPE SSFCTRLOP,
WA_OUTOPT TYPE SSFCOMPOP.
DATA: T_OTFDATA TYPE SSFCRESCL,
T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
DATA: w_filesize TYPE i.
DATA: w_bin_filesize TYPE i.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSRI_FORM_01'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = 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.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION FORM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = WA_CTRLOP
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = WA_OUTOPT
USER_SETTINGS = 'X'
MYDATE = P_DATE
REASON = P_REA
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = T_OTFDATA.
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.
t_otf[] = t_otfdata-otfdata[].
*Convert into PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = w_bin_filesize
BIN_FILE =
TABLES
OTF = T_OTF
LINES = T_PDF_TAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 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.
To download into PC
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
CODEPAGE = ' '
FILENAME = 'D:\SRI2.PDF'
FILETYPE = 'BIN'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = W_FILESIZE
TABLES
DATA_TAB = T_PDF_TAB.
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
reward point if helpful.
thanks
mrutyun^ -
Printing binary data in PDF format
HI all,
Any idea on how to print Binary content in a PDF format
I have read a PDF format from application server in a Binary format, I need to print the binary content on a printer in PDF format
Any help on this is appreciated <REMOVED BY MODERATOR>
Thanks
Aakash
Edited by: Alvaro Tejada Galindo on Jun 9, 2008 3:15 PMHi papick,
this may be easier than expected for a million dollar erp system:
You need a PDF printer.
When I played around with adobe interactive forms our basis guys created a new printer in SPAD with
Device Attributes
Device Type PDF1
Device Class Stabdard Printer
location PDF-Frontend printer = Standard printer for workstation
Access Method
Host Spool Access Method FF
Host printer PDF
Then need some expremimenting with Functions
RSPO_OUTPUT_DEVICEDATA Spool Output Control of an Internal Table with Formatted Data
or something alike (see function group SPOD)
Then you should be able to create an entry in spooler (SP01) with spool request type adobe pdf document.
Sorry, I don't have this problem, thus I did not check out the details yet.
But I'm convinced it should work that way because the ADS server creates a complete PDF binary and it can be printed using the above described printer - actually a HP Laserjet V was configured as frontend printer and it can print the pdf.
Regards,
Clemens -
Fetching SAP Date and Time format
I am using "RFC_READ_TABLE" function module to fetch SAP table contents using JCO APIs. I need to know the date and time format to parse the values of date and time fields into respective java data types. (I am receiving these values in the form of string using above RFC)
How can I get date and time format information from SAP server?
Regards
AmolHi,
Through T-Code SU01 in general setting tab u can do the general setting for date time, number format
Type tcode SPRO and Got to general settings -> Define Countries then restart the system. -
How to download report data in PDF format
<b>Hii Experts
I have a requirement how i can store my report in pdf format ..
Regards
Hitesh</b>chk this
http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
http://www.erpgenie.com/abap/pdf_creation.htm
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = i_pfad
filetype = 'BIN'
* IMPORTING
* FILELENGTH =
TABLES
data_tab = i_att_cont
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i000(zv) WITH 'Problem mit PDF Darstellung'.
ENDIF.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = spoolnr.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
document = ' '
commandline = i_pfad
program = 'AcroRd32.exe'
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
gui_refuse_execute = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE i000(zv) WITH 'Acrobat Reader nicht gefunden!'.
ENDIF. -
Problem in converting SAP Reports in PDF Format
Problem in taking print out of Reports using ADOBE PDF Printer through any user except ADMIN user,
Do you really think we can help you without providing any information about the issue, scenario, error messages, etc...?
No Enough Information.
Read the "Rules of Engagement" and try it again.
Regards
Juan -
hi,
can any body tell how to convert the sap data into pdf format and send that pdf as an attachment through the email.
it is very urgent.
thanks in advance.*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
Alternative way could be to submit another program and store spool
id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
--> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
check this.
regards,
Prabhu
Maybe you are looking for
-
Purchase Order created from different client machine with same login ID
Hi, Purchase Order created from different machine using same Login ID. How to trace IP address of that Machines. Thanks Hemanth
-
Upgraded to OS X Mavericks and now my Calendar doesn't work.
Yesterday upgraded my Mac to OS X Mavericks and since restarting every time I go to open my Calendar - it quits unexpectedly - and does not open at all. Is this a known problem and how can I correct this - as I use this daily and it has all my futur
-
Deskjet 2800 can't print 11x17 from tray 2 with windows 7
After my PC had windows 7 installed I can't print 11x17 from tray 2. The hp website driver download page doesn't list a windows 7 driver, it instructs me to use the in os driver but that driver will only print to 8.5x11. Is there a fix for this? Than
-
Yamaha MOTIF ES8 Can't get working with Macbook Pro
I found this post but it's been archived and the person still couldn't get it working. http://discussions.apple.com/thread.jspa?threadID=1076838 I can't either, I hook up the Motif via USB and change it to USB and my Mac doesn't see the device under
-
Cannot open Mac Mail messages.
Hi I have a G5 pre Intel OS 10.5.8, with Mac Mail v 3.6. I cannot open my messages. I still can receive and send messages. I checked with my ISP and my settings are correct. Mac Mail's Connection Doctor says connection with the internet and my ISP ar