Getting OTF data of an SAPscript
Hello Experts,
Right now, I am receiving the OTF data from the combination of the Function Modules 'OPEN_FORM' and 'CLOSE_FORM' and the mail is already being sent by these function modules and the document is being archived. The transmission medium is External Send i.e. 5. However my new requirement is the subject line of the mail should be as high as 255 chars. So now I wish to restrict the use of OPEN_FORM and CLOSE_FORM only for archiving and Print Preview and send the mail using CL_BCS, which allows me the subject length of 255 chars.
I want to retrieve the OTF data. I know we can do that by setting the parameter itcpo-tdgetotf and get the OTF table at CLOSE_FORM. However, I have noticed that when I set the tdgetotf parameter, the archiving is not taking place, which again will be an issue. Is there some other way of retrieving OTF data. I cam acroos function modules such as CONVERT_OTF and CONVERT_OTF_MEMORY. But no use.
So in short, I just want to get the OTF data. Other all things are working for me now, and from what I have found out, I cannot use TDGETOTF and archiving in the same OPEN_FORM.
Any help will be greatly appreciated.
Regards,
Shaheen
Hi ssm,
the problem has been rectified. thanks for your inputs. i remodelled my programming. i set the tdgetotf and got the otf table from there. and used CONVERT_OTF_AND_ARCHIVE for archiving. it works great.
thanks again all...
Emanuel, are you interested to know how am I doing it or you were asking it to answer my question? let me know, in case if you want to, i will share my 2 cents of knowledge.
Similar Messages
-
Get OTF data for a sales order document
I have a problem in getting the information of the created sales order document number as OTF data. I need this OTF data so to convert into PDF format using function module 'CONVERT_OTF_2_PDF'. My situation is i am keeping a parameter for sales order document number . when i execute the report after giving a sales order document number, i should get the OTF data .
Hi!
Firstly you have to define what technique is used for creation of sales order as printed document - smartform or sapscript. Then proceed as follows.
In case of smartform:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZFORMNAME'
IMPORTING
fm_name = v_form_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 v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i_otf[] = w_return-otfdata[].
In case of sapscript:
options-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
options = options
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
OTHERS = 5.
i_otf -
Regards,
Maxim. -
Hi,
I have a situation where I have to call a standard report from my custom report which is based on some condition.
This is fine. But the standard report which I am calling is print program of an SAP Script.
So, the requirement now is that my custom report should be able to send an email of the SAP Script output. For this I need to have the OTF data of the SAP Script in my custom report.
How to get this?
Your help will be highly appreciated.
Thanks,
-SandeepHi,
Go through these links,here they mentioned how to capture OTF data into internal table
http://scn.sap.com/thread/1083143 -
Print preview while getting otf data
hi experts,
can somebody tell me how to get the print preview of sap script
while getting the otf data.
I have set the ITCPO-TDGETOTF = 'X' option in OPEN FORM but when i give it its not showing the output. How can I see output ?hi ajay,
TABLES ITCPO.
DATA: T_OTF TYPE TABLE OF ITCOO.
ITCPO-TDGETOTF = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZPRG_TEST'
OPTIONS = ITCPO
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
OTHERS = 11.
IF SY-SUBRC 0.
ELSE.
CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = T_OTF
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
OTHERS = 5.
ENDIF.
Check this code ok.
why dont you try giving a pdf preview which will be possible.
Regards,
Midhun Abraham
Edited by: Midhun Abraham on Oct 12, 2008 11:01 AM
Edited by: Midhun Abraham on Oct 12, 2008 11:05 AM -
Smartform printing + Get OTF Data
Hello, i have a problem with smartforms. I need to both print the smartforms and get the OTF Data in order to save it to disk and email it. But if I mark the getotf check in control parameters, it doesn't print. In fact the description for that field says: Return of OTF table. No printing, display, or faxing.
Is there a way to get both the printed version and the OTF Data without having to call the Smartforms function module twice with different control parameters?
Thanks in advance.Hello
steps to fulfill your requirement
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Select A option !'
text_question = 'Want a PDF file for this Transaction ?'
text_button_1 = 'Yes'(001)
text_button_2 = 'No'(002)
display_cancel_button = ' '
start_column = 25
start_row = 6
IMPORTING
answer = a.
IF a = '1'.
*for CONTROL_PARAMETERS
gw_ssfctrlop-getotf = 'X'.
gw_ssfctrlop-no_dialog = 'X'.
*for OUTPUT_OPTIONS
gw_ssfcompop-tdnoprev = 'X'.
gw_ssfcompop-tdimmed = 'X'.
CALL FUNCTION fm_name
CALL FUNCTION 'CONVERT_OTF'
CALL FUNCTION 'DOWNLOAD'
endif.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Select A option !'
text_question = 'Want to have a print privew for the same?'
text_button_1 = 'Yes'(001)
text_button_2 = 'No'(002)
display_cancel_button = ' '
start_column = 25
start_row = 6
IMPORTING
answer = a.
IF a = 1.
CALL FUNCTION fm_name. (without the control and output parameters).
endif.
This will surely solve your problem
Cheers,
Suvendu -
How to get both OTF data and spool at a time
Hi Experts,
My requirement is to get both OTF data and spool.
In 'OPEN_FORM' i tried passing itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
I was able to get OTF data but spool is not getting generated.
IF i pass only itcpo- TDNEWID = 'X'. the spool is getting generated but not OTF data.
when both the fields are set i.e. itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
the spool is generation is getting supressed.
Similarly when i tried to get OTF data by passing itcpo-TDGETOTF = 'X'. to 'OPEN_FORM' as i need to convert it to PDF and send it to vendors as email ,
The print preview in TCODE ME23n was not getting generated for 'MESSAGE' option 'External send'.
Please suggest me how to get both OTF data and spool at a time.Hi Kartik,
This one is similar to my question to print and email invoice at same time. I pass itcpo-tdgetotf = 'X' in order to get otfdata and send email with the attachment of otfdata.
Now I have data in otfdata, but when I call print_otf function, I clear out itcpo-tdgetotf, and passed
itcpo-tddest = device_type but I still get error message said 'Handler not valid for open spool request'.
Can you give me a working example that you have otfdata table and print data from that table. I also post my question on other thread
submit report and export to memory
thanks -
Hi All,
I need to know is it possible to get OTF data by calling FM CLOSE_FORM as well create a spool in SP01 for related script.
Regards
Dhiraj ShettyHi,
Manual conversion to OTF format
If there are more than 10 pages,
Tick the spool request
then click Edit -> OTF display -> No. of OTF pages
Convert SAP Script to text
Display the spool request
then click Goto -> List display
Automatic conversion to OTF format
tables: tline.
data: begin of int_tline1 occurs 100.
include structure tline.
data: end of int_tline1.
call function 'OPEN_FORM'
device = 'OTF_MEM'
after CLOSE_FORM
call function 'CONVERT_OTF_MEMORY'
exporting
format = 'ASCII'
max_linewidth = 132
tables
lines = int_tline1
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
write the text file to spool
loop at int_tline1.
if int_tline1-tdline = space.
skip.
else.
write:/ int_tline1-tdline.
endif.
endloop.
Regards
Sudheer -
Get infotype data in e-mail/sapscript - Dynamic action-
Hello,
we developed a dynamic action sending a mail if an employee leave the company.
We can catch data in infotype 0000 and 0001 in the sapscript used in the mail, but we would like also fetch data from other infotypes.
We tried to generate an ABAP code from an ad hoc query, but it was impossible to get the return tables in the sapscript.
Are there other solutions to get infotype data in saps scripts?
Kr,Hi ,
you can follow the below solution .
1. Create a custom report for the leaving/terminated employees by using the action in infotype 0000 with field massn, massg.
2. you will get all the employees from table pa0000 who are laving between a date interval .
3. by using the personnel numbers from pa0000 get other infotypes information.
4. create a smartform/script for your requirement.
5. using the program you can send the data to the employees.
another way .
if you know the name of the script you can create some variables for the other fields from other infotypes in that script and you can populate the variable values using perform in program command using a custom program in that script. -
SSF function module to disable pop window but OTF data is not coming.
Hi Experts,
My requirement is to get the PDF from the SSF function module and email it and i don want to display the pop option
I passed these parameters
1.no_dialog = c_x.
2.-preview = c_x.
3.-no_open = c_x.--|
4.no_close = c_x.---| if i add these two conditions i don get printer pop up but i don get the data for " job_output_info " also.
to this function module ,
Please tell me how to get data into " job_output_info " import parameter by not displaying the pop up for printer.
Thanks and Regards in advance.Hello,
we did it using the following code.
DATA: w_ctrlop TYPE SSFCTRLOP,
w_return TYPE SSFCRESCL.
DATA ls_job_output_info TYPE ssfcrescl.
DATA p_pdf_len TYPE i.
DATA pt_tlines TYPE TABLE OF tline.
(function_name is the name of the smartform)
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
CALL FUNCTION function_name
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = ls_job_output_info
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.
REFRESH pt_tlines.
CLEAR: p_pdf_len.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = p_pdf_len
TABLES
OTF = ls_job_output_info-otfdata
LINES = pt_tlines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc <> 0.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = p_pdf_len
filename = p_filename
filetype = 'BIN'
TABLES
data_tab = pt_tlines
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 s614(zef) DISPLAY LIKE 'E'.
ENDIF. -
hello,
Im trying to convert a script to pdf data.
In the open_form I set getotf = 'X' and in the close form , i get the OTf data.
I convert this otf to pdf data.
In the pdf output, I only have the static fields and no data.Though the number of pages generated are same in the PDF output and the script.
help me figure it out ..Hi,
There is a very useful post to check how you have converted otf to pdf:
Emailing Sap Scripts
Cheers,
Bhanu -
Error OTF end command // missing in OTF dat
Hi
I am converting a smartform of a PO into a PDF. when i am using the option of pint immediately in message option of PO. I am getting this error OTF end command // missing in OTF dat . when i am using option 3 which in not print immediately. i am able to convert it into pdf file and save in my local folder. please advice.when you click the message button while creating a PO. it will take to next page where you add your output type that is output, partner etc.. after you add and click on further data button there you will have option for dispatching here when you add slect option 4 whihc is print immediately. then i am getting the error. if i am using the other options i am able to down load into pdf but not able to see print preview. please advice
-
OTF end command // missing in OTF data when using CONVERT_OTF_2_PDF
Hi
When using the function module CONVERT_OTF_2_PDF I am getting the strange scenario that for some users it is giving the error message "<u><b>TD 030: OTF end command // missing in OTF data</b></u>".
I am executing this function module using the OTF output data received from a smartform executed with the parameter control-parameters-getotf = X and I am not formatting it in any way.
any assistance in this is much appreciated.hi
good
go through this link,which ll give you detail idea about this function module
http://www.jt77.com/development2/programming-07636.html
thanks
mrutyun^ -
Hi all,
Is there any way of creating a spool request or printing OTF data directly from an internal table.
Scenario is that I have read a spool request with multiple pages into OTF format and now have an internal table with OTF data. I have then split the spool data at page level into another internal table.
This table also contains OTF data . Is there anyway of printing this internal table directly to printer. If not is there any way of creating a spool request from this internal table?
Regards,
PreetMay be i can help to some extent. I will just tell you how to convert a internal table into spool. I have done the coding
REPORT zpmm_pdf .
TYPES : BEGIN OF itab,
name(20) TYPE c,
age TYPE i,
*** TYPE c,
END OF itab.
DATA : gt_itab TYPE STANDARD TABLE OF itab,
gw_itab TYPE itab.
DATA : counter TYPE i.
********************Data declaration for use in converting to pdf
DATA : pripar LIKE pri_params.
DATA : lw_space VALUE ''.
DATA : itab_pdf LIKE tline OCCURS 0 WITH HEADER LINE.
<b>*To get spool info</b>
DATA : rqident LIKE tsp01-rqident ,
rqcretime LIKE tsp01-rqcretime .
<b>DATA: spool_id LIKE tsp01-rqident.</b>
DATA : numbytes TYPE i,
cancel.
DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
********************END of Data declaration for use in converting to pdf
START-OF-SELECTION
DO 20 TIMES.
gw_itab-name = 'swetabh_shukla'.
gw_itab-age = counter + 1.
gw_itab-*** = 'M'.
counter = counter + 1.
APPEND gw_itab TO gt_itab.
CLEAR : gw_itab.
ENDDO.
<b>* Gt_itab is the internal table that we will write to spool</b>
*Start
SET PARAMETER ID 'ZPDF' FIELD lw_space.
<b>CALL FUNCTION 'GET_PRINT_PARAMETERS'</b>
EXPORTING
in_parameters = pripar
line_size = 255
layout = 'X_65_132'
no_dialog = 'X'
IMPORTING
out_parameters = pripar
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
<b>*********To write data in spool</b>
NEW-PAGE PRINT ON PARAMETERS pripar NO DIALOG .
RESERVE 5 LINES.
<b>*********From here data will be written in spool</b>
WRITE : 'Name',
'Age',
LOOP AT gt_itab INTO gw_itab.
WRITE : / gw_itab-name,
gw_itab-age,
gw_itab-***.
ENDLOOP.
<b>*****To switch off spool writing</b>
NEW-PAGE PRINT OFF.
************End of spool writing
<b>******To get the latest spool id of spool written by us</b>
SELECT rqident rqcretime FROM tsp01
INTO (rqident,rqcretime)
WHERE rqowner = sy-uname
ORDER BY rqcretime DESCENDING.
EXIT.
<b>******** It will just read the latest spool id and exit</b>
ENDSELECT.
MOVE rqident TO spool_id. <b>" We get the spool id here of the spool we wrote</b>
<b>*Now spool_id contains the spool id. We can convert this spool to pdf also as given *below</b>
****************************************************To convert spool to pdf
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spool_id
NO_DIALOG =
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
PDF_SPOOLID =
LIST_PAGECOUNT =
BTC_JOBNAME =
BTC_JOBCOUNT =
TABLES
pdf = itab_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.
END-OF-SELECTION
To download the pdf file as local file
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = numbytes
filename = gv_filename
filetype = 'BIN'
filetype_no_show = 'X'
IMPORTING
act_filename = gv_filename
filesize = numbytes
cancel = cancel
TABLES
data_tab = itab_pdf.
<b> I think i gave a lot of extra code, but i just gave it for proper understanding.
Only a few days ago i came across this concept. So had the ready made code.</b>
<b>Please do reward point if helpful</b>
Regards
swetabh -
Archive Smartform Copies - Error - OTF end command // missing in OTF data
Hi All,
We are printng invoices and archiving them at the same time.
When I try to print and archive just the original invoice it works fine
That is , it prints and archives.
However when I set the flag SSFCOMPOP-TDARCCOP to 'X' (Archive Copies as well),
I get the error OTF end command // missing in OTF data.
Im guessing that the system tries to archive multiple copies and the End of File Command // at the end of each copy is causing the issue. But I dont know how to go about solving it.
Regards,
Nehal.Implemented SAP Note 1123505 - OTF-PDF conversion. Archiving several copies
-
Converting OTF data from script to Spool Request
Hello,
Is there any way to convert OTF data into Spool Request.
Actual scenario is for the Order Acknowledgement form they have configured the output type for Print Medium and here the spool is generated through Close_Form . Based on the spool no they are converting the spool to PDF and then placing a copy in the Unix Directory.
They have also configured the form for Fax Medium , but here in the close_form they are getting the Fax number instead of spool number. As this way it just Fax the output to required destination , user require a copy of the output should be converted to PDF and then it has to be placed in Unix directory as it is happening for print medium.
The problem here in the close form for first case , i can see the spool id but in the second case that is not happening . So only OTF data is available with me. So is there any way where i can pass OTF data get spool id . So that if i have spool id rest will be taken care by my existing logic.
I Appreciate your valuable inputs.
Thanks,
SubashCheck this code snippet.
data : it_spool TYPE STANDARD TABLE OF rsporq ,
it_pdf TYPE STANDARD TABLE OF tline ,
v_objtype TYPE rststype-type ,
v_name TYPE rststype-name .
*& Form find_spool_request_id
FORM find_spool_request_id.
CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
EXPORTING
allclients = '320'
datatype = '*'
has_output_requests = '*'
rq0name = nast-dsnam
rq1name = '*'
rq2name = '*'
rqdest = 'LOCL'
rqowner = sy-uname
TABLES
spoolrequests = it_spool
EXCEPTIONS
no_permission = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i000 DISPLAY LIKE 'E' WITH text-002.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " find_spool_request_id
*& Form convert_spool_to_pdf
FORM convert_spool_to_pdf .
READ TABLE it_spool INTO wa_spool INDEX 1.
v_spoolno = wa_spool-rqident.
*Get Spool request attributes
SELECT SINGLE *
FROM tsp01
INTO tsp01
WHERE rqident EQ v_spoolno.
IF sy-subrc <> 0.
MESSAGE i000 DISPLAY LIKE 'E'
WITH text-003 v_spoolno text-034.
LEAVE LIST-PROCESSING.
ENDIF.
v_client = tsp01-rqclient.
v_name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = v_client
name = v_name
part = 1
IMPORTING
objtype = v_objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i000(zz) DISPLAY LIKE 'E'
WITH text-003 v_spoolno text-034.
LEAVE LIST-PROCESSING.
ENDIF.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = v_spoolno
no_dialog = ' '
TABLES
pdf = it_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
OTHERS = 12
Maybe you are looking for
-
Selection from logical database.
The question is simple. =) Wy does the second part works but not the first one. Isn't it possible to do like that. Anyone that can help with how i can do? <b>Event : start-of-selection employees not connected to position</b> rp-provide-from-last p00
-
Opening a file results in "Untitled" filename
Recently (for about 2 weeks) Fireworks has a new trick up it's buggy sleeve: Whenever I open a file, it loads and then Fireworks shifts from showing the filename in the tab to "UntitledX" where X is a number. Now when I try to save it asks me where t
-
"Page cannot be displayed" when opening DatabaseControl in Oracle 11g
Hi, This is a new installation of Oracle 11.2.0.3 on Win 2003 32bit. The install was successful (at least no errors) but I am having a problem with Enterprise Manager. When I go to the web page (https://servername:1158/em) then I receive the error "P
-
How to know which workflow is triggered by an event
Dear all, We have a event of a object type. Say: EVE1 of obj ZOBJ1. And this is used as a triggering event in a workflow. We need to identify which is the workflow. How should we find that? Regards, Vivek
-
Using UUID istead of commoen fields
HI All I Have two Z DB tables with almost the same fields and my question is if in table one table instead the common fields I can use UUID . 1. what is the benefit of this 2. how i can read data from table one This are the tables Table one mandt typ