on 02-03-2010 3:54 PM
Hello,
I need a recommendation for printing smartforms to pdf.
I setup SCOT to produce a pdf file when printing a smartform via medium 5 - external send.
I setup the message to send the pdf to the customers e m a i l adress.
This works fine.
I wanna change the process in the following way:
If I am the creator of the document (for instance an order confirmation) I want to receive the pdf on my own e m a i l adress rather to send it to the customers e m a i l (internet) adress.
After receiving the pdf II wanna send it to the customer with a proper e m a i l text from within my e m a i l software.
Does someone know how to setup the message?
Tried $1, §§, MA, MP, etc. partner roles with medium 5 - external send, but without success!
Please help.
Thanks
wolfi
Hi Kartik,
do you think something is maybe wrong with SCOT configuration?
Cheers
wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kartik,
seems that it doesn't work in update mode.
I created an additional Message Type, set it to schedule time 3 and then do a preview after order has been saved to get the pdf preview and file.
Thank you very very much for your help.
wolf.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandra,
thx. for your reply.
Maybe they gave up, otherwise someone would for sure reply how they solved it???
Believe me, I did a debug of hole print program, every single routine and function!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello!
Tried WFMC_MESSAGES_PROCESS without success.
Maybe because I'm already in this process while executing message?
Now tried last method I'm aware of.
FORM SPOOL_2_PDF.
*
* Read spool job contents (OTF or ABAP list) and convert
* to PDF, download PDF
*
DATA CANCEL.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
DATA: NUMBYTES TYPE I,
pdfspoolid like tsp01-rqident,
jobname like tbtcjob-jobname,
jobcount like tbtcjob-jobcount,
spoolno like TSP01-RQIDENT.
tables: tsp01.
spoolno = 2310.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spoolno
NO_DIALOG = ' '
* DST_DEVICE =
* PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = numbytes
PDF_SPOOLID = pdfspoolid
* OTF_PAGECOUNT =
BTC_JOBNAME = jobname
BTC_JOBCOUNT = jobcount
TABLES
PDF = pdf
EXCEPTIONS
ERR_NO_OTF_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DSTDEVICE = 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.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = numbytes
FILENAME = 'C:\temp\file.pdf'
FILETYPE = 'BIN'
TABLES
DATA_TAB = pdf
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6.
endform. "SPOOL_2_PDF
Took a spool number which exists in spool.
Same behaviour as with all the other functions.
No result with disptach time=4, but with "1" and RSNAST00 it works.
Does really nobody had this problem before? Can't believe
Cheers
wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Part2:
- when executing with dispatch time = 4 and pressing save
=> Message disappears in Message log (Extras-Output-Header-Edit)
=> In SOST is no job waiting
- when executing with dispatch time = 1 and execute it with rsnast00
=> Message is with green signs in Log (Extras-Output-Header-Edit)
=> First I got the acrobat preview window, then the file was saved locally on my disk and afterwards received an email with pdf attachment.
Q: Is it possible that the call is in update task? (in that case saving to frontend won't work).
A: Yes always in update task, cause I wanna press save and then it should convert to pdf.
So RSNAST00 's behaviour is different to message sent with dispatch time = 4 ???
Do I really have to give up?
Thanks a lot for your responses
Wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again,
my program looks this way now:
FORM processing.
...
...
if nast-nacha = '8'.
ls_control_param-getotf = 'X'. " Rückgabe der OTF-Tabelle
ls_composer_param-tdnoprev = 'X'. " Keine Druckansicht zulassen
endif.
...
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
znast = nast
zvbdka = vbdka
zaddres = addr_key
IMPORTING
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
TABLES
ztvbdpa = tvbdpa "Item information
IT_VBDPAU = TVBDPAU "Subitem numbers
IT_VEDPA = TKOMSERVP "Contract Item Validity
IT_VEDKA = TKOMSERVH "Contract Header Validity
IT_VEDPN = TKOMSERVPN "Contract Item Cancellation Data
IT_VEDKN = TKOMSERVHN "Contract Header Cancel Data
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
retcode = sy-subrc.
PERFORM PROTOCOL_UPDATE.
ENDIF.
if nast-nacha = '8'.
PERFORM PREVIEW_PDF using job_output_info.
PERFORM DOWNLOAD_PDF using job_output_info.
PERFORM EMAIL_PDF using job_output_info.
endif.
* get SmartForm protocoll and store it in the NAST protocoll
PERFORM add_smfrm_prot.
ENDFORM. "processing
...
...
FORM PREVIEW_PDF using l_job_output_info TYPE ssfcrescl.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = l_job_output_info-otfdata
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
IF sy-subrc <> 0.
retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
ENDFORM. "PREVIEW_PDF
Edited by: Wolfi on Feb 9, 2010 6:39 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again,
setup a new message type ZBA0 (BA00) with Medium 8.
Nothing changed!
No PDF preview with dispatch time 4 after save. But still works when triggered manually with rsnast00.
Tried an alternative to ''SSFCOMP_PDF_PREVIEW':
- call function 'CONVERT_OTF_2_PDF'
- call method cl_gui_frontend_services=>gui_download
Same behaviour: PDF File is just created when message is executed by rsnast00!
I'm completely lost!
Can anyone make my day
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In your code, you don't set RETCODE correctly. You have to handle all exceptions in your CALL FUNCTION too.
Is it possible that the call is in update task? (in that case saving to frontend won't work). You'll detect it easily if the break points are not reached. You can only debug using debugger option "update debugging".
Hello Kartik,
did u had a chance to view my code sequence?
Something must be still wrong?!
Still have the problem, that message just works when manually triggered by rsnast00.
Thanks for your help.
Cheers
wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think teh code is fine, since i have cheked the code and as you also are telling that manula triggering does work, so no problem with teh code, but may be with medium & itself, so try using medium 8 special function, and chk if it works that way, as medium 8 is for custom coding requirements only.
Hi,
thanks for the information.
Here it is again, hopefully well formatted now
FORM processing.
...
...
ls_control_param-GETOTF = 'X'.
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = 'X'
znast = nast
zvbdka = vbdka
zaddres = addr_key
IMPORTING
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
TABLES
ztvbdpa = tvbdpa
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc 0.
retcode = sy-subrc.
PERFORM protocol_update.
PERFORM add_smfrm_prot.
ENDIF.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = job_output_info-otfdata
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
ENDFORM. "processing
Result is:
- when setting Medium to 1, dispatch time to 4: nothing happens (no printout, no pdf popup)
- when setting Medium to 1, dispatch time to 1, run rsnast00, popup with pdf is coming up! FINE!
Any ideas?
Thx a lot
wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
shorten my program to the following:
FORM processing.
...
...
ls_control_param-GETOTF = 'X'.
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = 'X'
znast = nast
zvbdka = vbdka
zaddres = addr_key
IMPORTING
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
TABLES
ztvbdpa = tvbdpa
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
retcode = sy-subrc.
PERFORM protocol_update.
PERFORM add_smfrm_prot.
ENDIF.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = job_output_info-otfdata
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3.
ENDFORM. "processing
Result is:
- when setting Medium to 1, dispatch time to 4: nothing happens (no printout, no pdf popup)
- when setting Medium to 1, dispatch time to 1, run rsnast00, popup with pdf is coming up! FINE!
Any ideas?
Thx a lot
wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kartik,
helped me a lot!!! Thanks.
Let me tell you the actual state:
1.) When I do a printout with medium=7-simple Mail and Dispatch time = 4 it will process everything without receiving an email.
2.) When I select Dispatch time = 1 and afterwards do a SE38=RSNAST00 I will receive an email!
Strange isn't it?
What am I doing wrong, cause I wanna receive the eMail when the order is saved.
Do you have an idea?
Additionally, are this parameters correct before calling smartforms function?
ls_control_param-GETOTF = 'X'.
ls_control_param-NO_DIALOG = 'X'.
* ls_composer_param-TDNOPREV = 'X'.
* ls_control_param-device = 'PRINTER'.
* ls_control_param-preview = ''.
* ls_composer_param-tddest = 'LOCL'.
Thx a lot
wolfi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes the control parameters that u r setting are correct.
Well I'm not sure why mail is not getting triggered exactly might be some configuration issue and I'm not aware of those,
Did u chk that if mail is getting triggered if u attach it to meduim 5, just try it out once, and let me know the result.
2nd try:
*---------------------------------------------------------------------*
* FORM PROCESSING *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM processing.
DATA: lf_fm_name TYPE rs38l_fnam.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: lf_formname TYPE tdsfname.
DATA: ls_addr_key LIKE addr_key.
DATA: document_output_info TYPE ssfcrespd,
job_output_info TYPE ssfcrescl,
job_output_options TYPE ssfcresop.
PERFORM get_data.
CHECK retcode = 0.
PERFORM set_print_param USING addr_key
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
retcode.
*Get the Smart Form name.
IF NOT tnapr-sform IS INITIAL.
lf_formname = tnapr-sform.
ELSE.
lf_formname = tnapr-fonam.
ENDIF.
* determine smartform function module for invoice
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
* error handling
retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
* Begin REW, 04.02.2010
if nast-nacha = '7'.
ls_control_param-GETOTF = 'X'.
ls_control_param-NO_DIALOG = 'X'.
ls_composer_param-TDNOPREV = 'X'.
endif.
* End REW, 04.02.2010
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
znast = nast
zvbdka = vbdka
zaddres = addr_key
IMPORTING
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
TABLES
ztvbdpa = tvbdpa
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
retcode = sy-subrc.
PERFORM protocol_update.
* get SmartForm protocoll and store it in the NAST protocoll
PERFORM add_smfrm_prot.
ENDIF.
* Begin REW, 04.02.2010
if nast-nacha = '7'.
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE.
DATA: V_LEN_IN LIKE SOOD-OBJLEN.
DATA: I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE.
DATA: WA_BUFFER TYPE STRING.
DATA: I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
DATA: I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
DATA: WA_OBJHEAD TYPE SOLI_TAB.
DATA: V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
DATA: WA_DOC_CHNG TYPE SODOCCHGI1.
I_OTF[] = job_output_info-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.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
* Attachment
REFRESH: I_RECLIST,I_OBJTXT,I_OBJBIN,I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
* Create Message Body Title and Description
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
* Main Text
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.
* Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
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 = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = 'email adress'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = 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.
endif.
* End REW, 04.02.2010
ENDFORM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I would suggest two changes try those and let me know if its working and u r able to send mail or not.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING ' ~'. "here its space and ~ between quotes se carefully
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~ '. "here its ~ and space
CLEAR I_RECLIST.
I_RECLIST-EXPRESS = 'X'.
I_RECLIST-RECEIVER = 'email adress'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
u were not able to pastecode properly as there is limit in these forums that whatever u post should be less than 250 chars.
sorry about the code listing format!
It just packs it alltogether in a sequence?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For some reason I do not get an email of the PDF.
Can u explain why?
Maybe I did something wrong?
----
FORM PROCESSING *
----
........ *
----
FORM processing.
DATA: lf_fm_name TYPE rs38l_fnam.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: lf_formname TYPE tdsfname.
DATA: ls_addr_key LIKE addr_key.
DATA: document_output_info TYPE ssfcrespd,
job_output_info TYPE ssfcrescl,
job_output_options TYPE ssfcresop.
PERFORM get_data.
CHECK retcode = 0.
PERFORM set_print_param USING addr_key
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
retcode.
*Get the Smart Form name.
IF NOT tnapr-sform IS INITIAL.
lf_formname = tnapr-sform.
ELSE.
lf_formname = tnapr-fonam.
ENDIF.
determine smartform function module for invoice
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
retcode = sy-subrc.
PERFORM protocol_update.
ENDIF.
Begin REW, 04.02.2010
if nast-nacha = '7'.
ls_control_param-GETOTF = 'X'.
ls_control_param-NO_DIALOG = 'X'.
ls_composer_param-TDNOPREV = 'X'.
endif.
End REW, 04.02.2010
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
znast = nast
zvbdka = vbdka
zaddres = addr_key
IMPORTING
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
TABLES
ztvbdpa = tvbdpa
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
retcode = sy-subrc.
PERFORM protocol_update.
get SmartForm protocoll and store it in the NAST protocoll
PERFORM add_smfrm_prot.
ENDIF.
Begin REW, 04.02.2010
if nast-nacha = '7'.
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE.
DATA: V_LEN_IN LIKE SOOD-OBJLEN.
DATA: I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE.
DATA: WA_BUFFER TYPE STRING.
DATA: I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
DATA: I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
DATA: WA_OBJHEAD TYPE SOLI_TAB.
DATA: V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
DATA: WA_DOC_CHNG TYPE SODOCCHGI1.
I_OTF[] = job_output_info-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.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: I_RECLIST,I_OBJTXT,I_OBJBIN,I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
Create Message Body Title and Description
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
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.
Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
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 = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = 'email adress'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = 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.
endif.
End REW, 04.02.2010
ENDFORM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK!
I will make a copy of /smb40/rvador01 and insert the code part! No problem!
But, do I have to create a new medium as well and assign my new program to it?
Cause medium 5-external send is already assigned to /smb40/rvador01 and I don't wanna loose the function to send an order confirmation directly to customers email adress.
Any ideas?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
do I need to then modify the printing programm rvador01?
Regards
wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kartik,
used standard process within SCOT.
I wanna have the PDF file rather then send it directly to the customer,
because I have to decide whether I send it by email of my local fax soultion.
Regards
wolfi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok then u need to do custom coding instead of using the standard functionality, in ur driver program
convert ur output to pdf manually and send mail by using custom coding.
check this code wiki the code here will help you.
http://wiki.sdn.sap.com/wiki/display/Snippets/emailsendthroughoutputcontrols
http://wiki.sdn.sap.com/wiki/display/Snippets/SmartformasaPDFtoMailid
U can associate the mail texts in NACE alongwith your output type, select your o/p type and on keft side double click on mail title and texts.
Is that your requirement else could you please explain in bit detail.
ALso How are you sending PDF through mail, did u do any custom coding or using standard functionality???
Edited by: Kartik Tarla on Feb 3, 2010 9:29 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.