List output to PDF download
Hi experts,
Is there other way that a list output screen can be saved in PDF without using spool ?
I am working on the report that using the code "write: " , and the report output in list.
I am searching the solution to save the output list in PDF format to a assigned local or server file, and I don't want to use the spool, bc it needs the program executing is finished, and i want the output list and saving in PDF at the same.
Maybe like set a button, when clicking the butten, then save the output list screen in PDF to a file. Or just writing in the program, when the list show out , then save to a file in PDF format.
I am not sure that ABAP supports the function.
Can anyone help me~~
Thanks anyway!!
Regards
Claire
Thanks for your reply, Satyesh.
I have tried the solution, but I get some trouble.
Here is my code:
case sy-ucomm.
when 'DOWNLOAD'.
call function 'GUI_DOWNLOAD'
exporting
FILENAME = p_fname
FILETYPE = 'BIN'
tables
DATA_TAB = it
exceptions
file_write_error = 1
gui_refuse_filetransfer = 2
others = 3.
endcase.
p_fname = 'C:\test.pdf'.
I assign the filetype to 'ASC' and 'BIN', but both of them bring the error message and interrupt the program.
Here is the error analysis:
The call to the function module "GUI_DOWNLOAD" is incorrect:
The function module interface allows you to specify only fields
of a particular type under "FILENAME". The field "P_FNAME" specified here
has a different field type.
I am still stuck with it.
Please suggest me if i am wrong at any point.
Regards
Claire
Similar Messages
-
Convert ABAP list output to PDF without spool
Hi All,
We have used the FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to convert the list output to PDF. It creates the spool number in SP01 and PDF is getting generated.
But, in our SAP ECC 6.0 server all spools are redirected to printer by default and get printed because it configured like that. We requested BASIS people to reconfigure but they said no for a single report.
So we need to find the alternate solution to generate the PDF without spool. We have searched in sdn, but didnot get any alternate solution.
Please help us in this regard.
Thanks in advance.data: begin of i_list occurs 0,
line(255),
end of i_list.
data:i_mara like mara occurs 0 with header line.
parameters: p_matnr like mara-matnr.
start-of-selection.
set pf-status 'PDFFILE'.
select *
from mara
into table i_mara
where matnr = p_matnr.
loop at i_mara.
write:i_mara-matnr,i_mara-ernam,i_mara-pstat.
endloop.
at user-command.
if sy-ucomm = 'PDF'.
DO.
READ LINE SY-INDEX.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
I_LIST = SY-LISEL.
APPEND I_LIST.
ENDIF.
ENDDO.
NEW-PAGE PRINT ON DESTINATION 'LP03' IMMEDIATELY ' ' COVER TEXT ' ' KEEP IN SPOOL 'X' NEW LIST IDENTIFICATION 'X' LINE-SIZE 132 LINE-COUNT 65 NO DIALOG.
LOOP AT I_LIST.
IF I_LIST-LINE IS INITIAL.
SKIP.
ELSE.
at first.
write: TEXT-001.
endat.
WRITE: I_LIST-LINE+0(132).
ENDIF.
ENDLOOP.
NEW-PAGE PRINT OFF.
data:filename like RLGRAP-filename value 'C:\PDFFILE.PDF'.
DATA: SPOOL TYPE TSP01-RQIDENT.
SPOOL = SY-SPONO.
SUBMIT rstxpdft4
WITH spoolno = spool
WITH download = 'X'
WITH p_file = filename
AND RETURN.
if sy-subrc = 0.
write: 'pdf file generated'.
else.
write:'pdf file not generated'.
EXIT.
endif.
endif.
please paste this code and check once ,if it works modify the code according to ur requirement.
regards,
padmaja -
Display ALV list output in PDF format
Hi All,
My requirement is :
I am displaying output using Function module 'REUSE_ALV_LIST_DISPLAY'. then i will click one button which placed in application tool bar say 'Download to PDF' when i click this button it will display the output in PDF format. I tried with exsting threads but i unable to get suitable solution.Anybody can send me the sample code please.
Thanks in advance.
Maheedharplease go throuh the below procedure and sample Code, this might help you.
Procedure
When we activate the Smartform the system generates a Function Module. The function module name we can get from Smartfrom screen from menubar
Environment => Function Module_Name . In a report we can get this Function module name by calling a Function Module standard SSF_FUNCTION_MODULE_NAME. This function module at runtime calls the FM generated by smartform, which in turn is then used to pass data from the report to Smartform. In the report given below the FM generated is /1BCDWB/SF00000152 . In this FM we can see CONTROL_PARAMETERS in import tab. This is of type SSFCTRLOP. We need to set the GETOTF of this to be X. Setting this field will activate the OTF field in smartform.
In export tab of the FM generated by smartform we can see a parameter JOB_OUTPUT_INFO which is of type SSFCRESCL. The SSFCRESCL is a structure of having one of fields as OTFDATA. OTFDATA in turn is a table of type ITCOO. ITCOO has two fields TDPRINTCOM and TDPRINTPAR. TDPRINTCOM represents command line of OTF format data and TDPRINTPAR contains command parameters of OTF format data.
In every Smartform output in OTF format, TDPRINTCOM begins and ends with //. EP represents the end-of-page value for TDPRINTCOM field.
In addition we need to set few fields at the place where we call this FM(generated by smartform) in our program. While calling this FM we should set control_parameters, output_options, user_settings and job_putput_info fields as shown in program.
Once these settings are done we can call Function Module CONVERT_OTF to convert the OTF data of smartfrom output to PDF data format. Once these are done we can call method cl_gui_fronted_services=>file_save_dialog to specify the directory path where we want to save the output PDF file. After this we can call Function Module GUI_DOWNLOAD to download the PDF file on our local system.
Here is a sample code of program to perform the function.
SAMPLE CODE
*& Report ZAMIT_SMART_FORM_PDF *
REPORT ZAMIT_SMART_FORM_PDF .
data: carr_id type sbook-carrid,
cparam type ssfctrlop,
outop type ssfcompop,
fm_name type rs38l_fnam.
DATA: tab_otf_data TYPE ssfcrescl,
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
file_size TYPE i,
bin_filesize TYPE i,
FILE_NAME type string,
File_path type string,
FULL_PATH type string.
parameter: p_custid type scustom-id default 1.
select-options: s_carrid for carr_id default 'LH' to 'LH'.
parameter: p_form type tdsfname default 'ZAMIT_SMART_FORM'.
data: customer type scustom,
bookings type ty_bookings,
connections type ty_connections.
start-of-selection.
suppressing the dialog box for print preview****************************
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = SPACE.
cparam-getotf = 'X'.
select single * from scustom into customer where id = p_custid.
check sy-subrc = 0.
select * from sbook into table bookings
where customid = p_custid
and carrid in s_carrid
order by primary key.
select * from spfli into table connections
for all entries in bookings
where carrid = bookings-carrid
and connid = bookings-connid
order by primary key.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting formname = p_form
variant = ' '
direct_call = ' '
importing fm_name = fm_name
exceptions no_form = 1
no_function_module = 2
others = 3.
if sy-subrc 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
calling the generated function module
call function fm_name
exporting
archive_index =
archive_parameters =
control_parameters = cparam
mail_appl_obj =
mail_recipient =
mail_sender =
output_options = outop
user_settings = SPACE
bookings = bookings
customer = customer
connections = connections
importing
document_output_info =
job_output_info = tab_otf_data
job_output_options =
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc 0.
error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
tab_otf_final] = tab_otf_data-otfdata[.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
IMPORTING
bin_filesize = bin_filesize
BIN_FILE =
TABLES
otf = tab_otf_final
lines = 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.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = FILE_NAME
path = FILE_PATH
fullpath = FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 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.
************downloading the converted PDF data to your local PC*******
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = FULL_PATH
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'
IMPORTING
filelength = file_size
TABLES
data_tab = pdf_tab
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.
ENDIF.
Check this link it will help you.
https://forums.sdn.sap.com/click.jspa?searchID=5950895&messageID=2375150
Reward points if useful. -
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 -
Unable to open PDF output (PDF downloaded from Interactive Report--APEX)
Hi,
I'm getting below error while opening a PDF file downloaded from an interactive report (APEX).
Adobe reader cound not open "TEST.pdf"because it is either not supportd file or because the file has been damaged.
Thanks & Regards,
Ramamuni.Steps of pdf Printing of Report from FOP:
1) Download and unzip the following needed files in D:\Apex_fop directory.
2) Open your command prompt .
Change the directory to D:\Apex_fop\cocoon-2.1.11.
Set the Java_Home environment variable as: set JAVA_HOME= C:\Program Files\Java\jdk1.5.0_21
then type build war
3) After getting the prompt back as D:>Apex_fop>cocoon-2.1.11>
Copy coocon.war file from the folder D:\Apex_fop\cocoon-2.1.11\build\cocoon.
Paste this file into webapps subdirectory in main tomcat directory having path as D:\APEX_FOP\apache-tomcat-6.0.26\webapps.....place it in the top
level of webapps directory.
4) Now just startup tomcat as D:>APEX_FOP>apache-tomcat-6.0.26>bin>startup.bat
The cocoon.war file will automatically uncompressed as directory.
5) To change the port of apache tomcat , edit apache-tomcat-6.0.26\conf\server.xml & change port attribute of Connector element from 8080 to 8181.
Just check whether Tomcat is running or not as http://localhost:8181/
& to check cocoon type http://localhost:8181/cocoon/
6) Now copy fop_post directory & paste it undes new cocoon directory in webapps having path as D:\APEX_FOP\apache-tomcat-6.0.26\webapps
\cocoon.
7) Now you need to do some apex settings as follows:
In APEX, just log in as ADMIN into apex/apex_admin and went to Instance Settings and did the following:
- Print Serverr: Standard Support
- Print Server Protocol: HTTP
- Print Server Host Address:localhost
- Print Server Port: 8181
- Print Server Script: /cocoon/fop_post
In your APEX application, in the Regions section, Click on the Print link next to your report and do the following settings:
- Enable Report Printing: Yes
- Link Label: Print
- Response Header: Report Settings
- View File As: Attachment
- Output Format: PDF
- Report Layout: Default Report Layout
- Print URL: f?p=&APP_ID.:1:&SESSION.:FLOW_XMLP_OUTPUT_R1063230002781575
8) Open up the Report Page and click Print , You will get the pdf report.
I am sure this will help you
Regards -
To download a list output to excel sheet
Hi All,
I am running the transaction MD47 for Product Group Planning.
I get a list output with as many as 90 columns.
When I try to download the output into an excel (System > List > Save > Local File ) only the columns which appear on the screen are being downloaded. Does any one have pointers on how can I download the whole list into an excel?
Regards,
KarthikHey Gabriel,
I am doing good. How are you today?
How do I do that?
This is a list output not an ALV. I dint find any option to choose an ALV layout.
Regards,
Karthik -
How to download the blocked ALV output to PDF file.
How to download the blocked ALV output to PDF file.
I am able to download the BLocked ALV output in PDF format,
but the each bolck in ALV is displaying different pages of PDF.
In my report I have 4 block in 1 page, I am able to see the output in PDF but in different page.
How to avoid the Page-break in PDF.
Thanks,
Ravi Yasoda.hi,
I believe that your have 4 containers on the screen with individual ALV display. in this case, there is no way to get combined PDF output to my knowledge.
However you can use Smartform/Sapscript as output which would allow you to display ALV in blocks and also print it in one.
Regards,
Nirmal -
Regarding Downloading of Report[List] output into Excel Sheet
Hi All,
Hi i have written one Classical report. I got the output Correctly.
Now i want to download that data into Excel Sheet in excatly the way it displayed in List[Report] output.
I had followed the path <b>System->List->Save->LocalFile->Spread Sheet</b> and tried to download the same.
Though it is downloaded it has not come in exact format.
Now what i want is to add a button above that report & write a program in that to download that data into Excel Sheet.
Can anybody tell me how can solve this issue. If i follow above procedure will the data[List Output] be downloaded into exact format into excel.
If anybody knows other way please sujjest.
Thanks in advance.
Thanks & Regards,
Prasad.Hi Prasad,
I have done a program which downloads the output in the excel sheet in the correct format.
Just check the program. The code given in bold is what you have to use.
REPORT zexp MESSAGE-ID f4 LINE-SIZE 195.
Tables Used ***********************************
TABLES : bseg, bkpf, bsak, lfa1, payr .
Declaring Internal Tables **************************
DATA :
Internal table to hold header data *************
BEGIN OF header OCCURS 0,
ext_date(10) TYPE c,
delimit(1) TYPE c,
ext_time(8) TYPE c,
END OF header,
Internal table to hold detail info **************
BEGIN OF i_data OCCURS 0,
belnr LIKE bsak-belnr,
gjahr LIKE bsak-gjahr,
bukrs LIKE bsak-bukrs,
bldat LIKE bsak-bldat,
xblnr LIKE bsak-xblnr,
blart LIKE bsak-blart,
augdt LIKE bsak-augdt,
augbl LIKE bsak-augbl,
wrbtr LIKE bsak-wrbtr,
shkzg LIKE bsak-shkzg,
lifnr LIKE bsak-lifnr,
name1 LIKE lfa1-name1,
chect LIKE payr-chect,
status(1) TYPE c,
END OF i_data,
Internal table to to collect *****************
BEGIN OF i_data1 OCCURS 0,
belnr LIKE bsak-belnr,
gjahr LIKE bsak-gjahr,
bukrs LIKE bsak-bukrs,
bldat LIKE bsak-bldat,
xblnr LIKE bsak-xblnr,
blart LIKE bsak-blart,
augdt LIKE bsak-augdt,
augbl LIKE bsak-augbl,
wrbtr LIKE bsak-wrbtr,
shkzg LIKE bsak-shkzg,
lifnr LIKE bsak-lifnr,
name1 LIKE lfa1-name1,
sortl LIKE lfa1-sortl,
chect LIKE payr-chect,
status(1) TYPE c,
END OF i_data1,
String variables for formatting file data *************
fidoc_year TYPE string,
comp_code TYPE string,
check_numbr TYPE string,
vendor TYPE string,
inv_date TYPE string,
inv_nbr TYPE string,
paid_dat TYPE string,
inv_amt TYPE string,
status TYPE string,
ref_doc TYPE string,
************Internal table to store the file contents **************
BEGIN OF i_final_file OCCURS 0,
record(300) TYPE c,
END OF i_final_file,
Internal table to store the list of allowed document types ****
BEGIN OF i_doctype OCCURS 0,
blart LIKE bsak-blart,
END OF i_doctype,
Internal table to hold vendor information ************
BEGIN OF i_lfa1 OCCURS 0,
lifnr LIKE lfa1-lifnr,
name1 LIKE lfa1-name1,
sortl LIKE lfa1-sortl,
END OF i_lfa1,
Internal table to hold check information *************
BEGIN OF i_payr OCCURS 0,
chect LIKE payr-chect,
vblnr LIKE payr-vblnr,
gjahr LIKE payr-gjahr,
zbukr LIKE payr-zbukr,
END OF i_payr.
Data declarations **************************
DATA : ws_stblg TYPE bkpf-stblg,
todate TYPE bsak-augdt,
fromdate TYPE bsak-augdt,
w_day LIKE dtresr-weekday,
day LIKE scal-indicator,
d TYPE n,
e_date LIKE sy-datum,
e_time LIKE sy-uzeit,
dd(2) TYPE c,
mm(2) TYPE c,
yy(4) TYPE c,
hh(2) TYPE c,
min(2) TYPE c,
sec(2) TYPE c.
DATA : wa_filepath(50) TYPE c,
wa_filename(50) TYPE c,
wa_c_filename(100) TYPE c,
arch_path(50) TYPE c.
<b>* Data for downloading to list
DATA : list LIKE TABLE OF abaplist WITH HEADER LINE.
DATA : BEGIN OF list_asc OCCURS 0,
msg(300) TYPE c,
END OF list_asc.
DATA: BEGIN OF i_invoiceheader OCCURS 0,
name(30) TYPE c,
END OF i_invoiceheader.
RANGES dates FOR bkpf-budat.</b>
Selection Screen ************************
SELECTION-SCREEN SKIP 2.
SELECT-OPTIONS:
s_bukrs FOR bkpf-bukrs ,
s_blart FOR bkpf-blart ,
s_augdt FOR bsak-augdt. " memory id todat TO fromdat.
PARAMETERS :submit AS CHECKBOX DEFAULT ' ' .
<b>* Download list to file.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'LIST'.
PERFORM download.
WHEN 'BACK'.
EXIT.
ENDCASE.</b>
<b>----
FORM download *
FORM download.
if s_augdt is initial.
dates-sign = 'I'.
dates-option = 'BT'.
dates-low = '20050901'.
dates-high = '20050920'.
APPEND dates.
else.
dates = s_augdt.
append dates.
endif.
/* Submit the same program .
SUBMIT zexp WITH s_augdt IN dates
EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list
EXCEPTIONS
not_found = 1.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
LIST_INDEX = -1 "LIST_INDEX SY-LSIND.
TABLES
listasci = list_asc
listobject = list.
PERFORM download_file.
ENDFORM.
FORM download_file *
FORM download_file.
DATA fname TYPE rlgrap-filename VALUE 'c:\audit_report.xls'.
DATA ftype TYPE rlgrap-filetype VALUE 'DAT'.
DATA numeric_data(10) TYPE c VALUE '0123456789'.
*Table structure should match with list output.
DATA : BEGIN OF i_data1 OCCURS 0,
belnr(12) TYPE c,
gjahr(6) TYPE c,
bukrs(8) TYPE c,
chect(13) TYPE c,
lifnr(12) TYPE c,
name1(37) TYPE c,
bldat(14) TYPE c,
xblnr(18) TYPE c,
augdt(14) TYPE c,
wrbtr(17) TYPE c,
status(4) TYPE c,
augbl(18) TYPE c,
sortl(17) TYPE c,
END OF i_data1.
Header record of the excel sheet.
PERFORM fill_header.
LOOP AT list_asc.
Reads lines starting from the first record in the report. All informatory statements in the report are not read.
IF list_asc+1(10) CO numeric_data.
i_data1 = list_asc .
APPEND i_data1.
ENDIF.
ENDLOOP.
Call the download function.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = fname
filetype = ftype
TABLES
data_tab = i_data1
FIELDNAMES = i_invoiceheader.
ENDFORM.
FORM fill_header *
FORM fill_header.
i_invoiceheader-name = 'Doc Number'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Fsc Year'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Cmp Code'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Check No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Vendor No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Entered by'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Doc Date'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Ref Doc No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Clearing Date'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Amount'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Status'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Clearing Doc No'.
APPEND i_invoiceheader.
i_invoiceheader-name = 'Sort field'.
APPEND i_invoiceheader.
ENDFORM. " fill_header</b>
Initialization *************************
INITIALIZATION.
To initialize the date parameter on the selection screen.
The date by default ranges from previous Monday to Sunday.
todate = sy-datum.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = todate
IMPORTING
day = day.
d = day.
if d < 4.
todate = sy-datum - d - 4 .
else.
todate = sy-datum - d + 3 .
endif.
fromdate = todate - 6.
MOVE: 'BT' TO s_augdt-option,
fromdate TO s_augdt-low,
todate TO s_augdt-high.
APPEND s_augdt.
Start of Selection **************************
START-OF-SELECTION.
Checking the validity of the inputted dates ****************
IF s_augdt-low > sy-datum OR s_augdt-high > sy-datum.
MESSAGE i999 WITH 'You cannot input future date'.
EXIT.
ENDIF.
IF NOT s_bukrs IS INITIAL.
MESSAGE i999 WITH 'Program will run with input parameters in screen!!'.
ENDIF.
Initialize the header data ***********************
e_time = sy-uzeit.
MOVE e_time+0(2) TO hh.
MOVE e_time+2(2) TO min.
MOVE e_time+4(2) TO sec.
CONCATENATE hh min sec INTO header-ext_time SEPARATED BY ':'.
e_date = sy-datum.
MOVE e_date+0(4) TO yy.
MOVE e_date+4(2) TO mm.
MOVE e_date+6(2) TO dd.
CONCATENATE mm dd yy INTO header-ext_date SEPARATED BY '/'.
header-delimit = '~'.
APPEND header.
List allowed document types **********************
PERFORM fill_doc_types.
**To select the documents within the range of week or as inputted **
IF s_augdt IS INITIAL.
MOVE: 'I' TO s_augdt-sign,
'BT' TO s_augdt-option,
fromdate TO s_augdt-low,
todate TO s_augdt-high.
APPEND s_augdt.
ENDIF.
Selecting the records from the database ****************
IF s_bukrs IS INITIAL AND s_blart IS INITIAL.
Select all documents of company code 1000, *********
4200 and 8000, and allowed document types *********
SELECT belnr gjahr augdt augbl bukrs
blart bldat xblnr lifnr wrbtr shkzg
FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
FOR ALL ENTRIES IN i_doctype
WHERE blart EQ i_doctype-blart
AND augdt IN s_augdt
AND ( bukrs = '1000' OR bukrs ='4200' OR
( bukrs = '8000' AND blart NE 'ZP' ) ).
loop at i_data.
Exclude reversed documents
select single stblg into ws_stblg
from bkpf
where bukrs = i_data-bukrs
and gjahr = i_data-gjahr
and belnr = i_data-belnr.
if not ws_stblg is initial.
delete i_data.
endif.
endloop.
ELSEIF s_blart IS INITIAL.
Select all documents of allowed document types ******
and inputted company code ************
SELECT belnr gjahr augdt augbl bukrs
blart bldat xblnr lifnr wrbtr shkzg
FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
FOR ALL ENTRIES IN i_doctype
WHERE blart EQ i_doctype-blart
AND augdt IN s_augdt
AND bukrs IN s_bukrs .
LOOP AT i_data.
Exclude documents of type ZP
for company code 8000.
IF i_data-bukrs = '8000' AND i_data-blart = 'ZP'.
DELETE i_data.
continue.
ENDIF.
Exclude reversed documents
select single stblg into ws_stblg
from bkpf
where bukrs = i_data-bukrs
and gjahr = i_data-gjahr
and belnr = i_data-belnr.
if not ws_stblg is initial.
delete i_data.
continue.
endif.
ENDLOOP.
READ TABLE i_data INDEX 1.
IF sy-subrc NE 0.
MESSAGE i999 WITH 'No records have been selected'.
EXIT.
ENDIF.
ELSE.
Select the documents matching the company codes *****
and document types inputted in the selection screen ****
SELECT belnr gjahr augdt augbl bukrs bldat xblnr
blart lifnr wrbtr shkzg
FROM bsak INTO CORRESPONDING FIELDS OF TABLE i_data
WHERE bukrs IN s_bukrs AND blart IN s_blart
AND augdt IN s_augdt.
SORT i_data BY blart.
LOOP AT i_data.
Filtering the records selected
based on the document type
READ TABLE i_doctype WITH KEY blart = i_data-blart.
IF sy-subrc NE 0.
DELETE i_data.
continue.
ENDIF.
Exclude documents of type ZP
for company code 8000.
IF i_data-bukrs = '8000' AND i_data-blart = 'ZP'.
DELETE i_data.
continue.
ENDIF.
Exclude reversed documents.
select single stblg into ws_stblg
from bkpf
where bukrs = i_data-bukrs
and gjahr = i_data-gjahr
and belnr = i_data-belnr.
if not ws_stblg is initial.
delete i_data.
continue.
endif.
ENDLOOP.
READ TABLE i_data INDEX 1.
IF sy-subrc NE 0.
MESSAGE i999 WITH 'No records have been selected'.
EXIT.
ENDIF.
ENDIF.
IF sy-subrc NE 0.
MESSAGE i999 WITH 'No records have been selected'.
EXIT.
ENDIF.
credit/debit identification ***********************
LOOP AT i_data.
IF i_data-shkzg EQ 'H'.
i_data-wrbtr = i_data-wrbtr * 1.
ELSEIF i_data-shkzg EQ 'S'.
i_data-wrbtr = i_data-wrbtr * -1.
ENDIF.
MODIFY i_data.
ENDLOOP.
for summarizing ******************************
LOOP AT i_data.
MOVE-CORRESPONDING i_data TO i_data1.
COLLECT i_data1.
ENDLOOP.
Vendor informations and Check Informations *****************
SELECT lifnr name1 sortl
FROM lfa1
APPENDING CORRESPONDING FIELDS OF TABLE i_lfa1
FOR ALL ENTRIES IN i_data1
WHERE lifnr = i_data1-lifnr.
SELECT chect vblnr gjahr zbukr FROM payr APPENDING CORRESPONDING
FIELDS OF TABLE i_payr FOR ALL ENTRIES
IN i_data1 WHERE vblnr = i_data1-augbl
AND gjahr = i_data1-augdt(4)
AND zbukr = i_data1-bukrs.
SORT i_data1 BY augbl gjahr bukrs lifnr.
SORT i_payr BY vblnr gjahr zbukr.
SORT i_lfa1 BY lifnr.
LOOP AT i_data1.
READ TABLE i_payr WITH KEY vblnr = i_data1-augbl
gjahr = i_data1-gjahr
zbukr = i_data1-bukrs.
IF sy-subrc EQ 0.
i_data1-chect = i_payr-chect.
ENDIF.
READ TABLE i_lfa1 WITH KEY lifnr = i_data1-lifnr.
IF sy-subrc EQ 0.
i_data1-name1 = i_lfa1-name1.
i_data1-sortl = i_lfa1-sortl.
ENDIF.
i_data1-status = 'X'.
MODIFY i_data1.
ENDLOOP.
**The records are sorted by clearing date, check number and doc type**
SORT i_data1 BY augdt chect blart.
**********The header record is outputted on the screen****************
PERFORM write_header.
********Data is moved to internal table in the file format *************
PERFORM move_data.
Line items are outputted on the screen *********************
PERFORM write_output.
*& Form write_header &*
*& This outputs the header information to screen &*
FORM write_header.
SKIP.
SET PF-STATUS 'LIST'.
Outputting the header information *********************
WRITE : / 'Extraction Date : ' , header-ext_date.
WRITE : / 'Extraction Time : ' , header-ext_time.
FORMAT COLOR 1." INTENSIFIED.
SKIP.
ULINE AT 0(190) NO-GAP.
Outputting line level information **********************
WRITE:/ sy-vline NO-GAP,
(10) 'DOC NUMBER',
sy-vline NO-GAP,
(4) 'F-YR',
sy-vline NO-GAP,
(6) 'C-CODE',
sy-vline NO-GAP,
(10) 'CHECK NUM',
sy-vline NO-GAP,
(10) 'VENDOR NUM',
sy-vline NO-GAP,
(35) 'VENDOR NAME',
sy-vline NO-GAP,
(12) 'INVOICE DATE',
sy-vline NO-GAP,
(16) 'INVOICE NUMBER',
sy-vline NO-GAP,
(12) 'PAID DATE',
sy-vline NO-GAP,
(15) 'INVOICE AMOUNT',
sy-vline NO-GAP,
(2) 'SC',
sy-vline NO-GAP,
(16) 'REFERENCE FI DOC',
sy-vline NO-GAP,
(15) 'SORT FIELD',
sy-vline NO-GAP.
ULINE AT 0(190) NO-GAP.
ENDFORM. " write_header
*& FORM MOVE_DATA &*
*& Formats data in internal table as is required in the file &*
FORM move_data.
LOOP AT i_data1.
Document number and fiscal year should be separted by '|' *****
CONCATENATE i_data1-belnr i_data1-gjahr INTO fidoc_year
SEPARATED BY '|'.
MOVE i_data1-bukrs TO comp_code.
MOVE i_data1-chect TO check_numbr.
Vendor number and vendor name should be separted by '|' *****
CONCATENATE i_data1-lifnr i_data1-name1 INTO vendor
SEPARATED BY '|'.
SHIFT vendor LEFT DELETING LEADING '0'.
SHIFT vendor RIGHT DELETING TRAILING space.
Date fields converted to MM/DD/YYYY format ****************
MOVE i_data1-bldat+0(4) TO yy.
MOVE i_data1-bldat+4(2) TO mm.
MOVE i_data1-bldat+6(2) TO dd.
CONCATENATE mm dd yy INTO inv_date SEPARATED BY '/'.
MOVE i_data1-xblnr TO inv_nbr.
SHIFT inv_nbr RIGHT DELETING TRAILING space.
MOVE i_data1-augdt+0(4) TO yy.
MOVE i_data1-augdt+4(2) TO mm.
MOVE i_data1-augdt+6(2) TO dd.
CONCATENATE mm dd yy INTO paid_dat SEPARATED BY '/'.
MOVE i_data1-wrbtr TO inv_amt.
CONDENSE inv_amt.
SHIFT inv_amt RIGHT DELETING TRAILING space.
MOVE i_data1-status TO status.
MOVE i_data1-augbl TO ref_doc.
CONCATENATE fidoc_year
comp_code
check_numbr
vendor
inv_date
inv_nbr
paid_dat
inv_amt
status
ref_doc
INTO i_final_file-record SEPARATED BY '~'.
APPEND i_final_file.
ENDLOOP.
ENDFORM. " MOVE_DATA
*& Form write_output &*
*& Outputs all data to screen &*
FORM write_output.
LOOP AT i_data1.
FORMAT COLOR 2 INTENSIFIED.
Outputting line level information *******************
WRITE : / sy-vline NO-GAP,
(10) i_data1-belnr,
sy-vline NO-GAP,
(4) i_data1-gjahr,
sy-vline NO-GAP,
(6) i_data1-bukrs,
sy-vline NO-GAP,
(10) i_data1-chect,
sy-vline NO-GAP,
(10) i_data1-lifnr,
sy-vline NO-GAP,
(35) i_data1-name1,
sy-vline NO-GAP,
(12) i_data1-bldat MM/DD/YYYY,
sy-vline NO-GAP,
(16) i_data1-xblnr,
sy-vline NO-GAP,
(12) i_data1-augdt MM/DD/YYYY,
sy-vline NO-GAP,
(15) i_data1-wrbtr,
sy-vline NO-GAP,
(2) i_data1-status,
sy-vline NO-GAP,
(16) i_data1-augbl,
sy-vline NO-GAP,
(15) i_data1-sortl,
sy-vline NO-GAP.
ENDLOOP.
ULINE AT 0(190) NO-GAP.
ENDFORM. " write_output
In the program, I am downloading only the list.. The description of report outputted in the beginning of the report is not downloaded to excel.
What has to be taken into consideration is that, the structure of the table i_data1 which contains the data to be downloaded to the table.
I hope that this will help you.
Regards,
Susmitha -
Download Sapscript output to PDF format
Hi,
how to download sapscript output to PDF formatHi,
Please check below link.
http://www.scribd.com/doc/454814/SAPSCRIPT-to-PDF
Regards,
Anil -
Downloading output as pdf file
hello all,
i have one doubt...how to download one report's output as PDF file.hi,
chk this.
FM is CONVERT_OTF.
CALL FUNCTION "CONVERT_OTF"
EXPORTING FORMAT = "PDF"
IMPORTING BIN_FILESIZE = FILE_LEN
TABLES OTF = OTFDATA
LINES = PDFDATA
EXCEPTIONS ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
also check sample programs
RSTXPDF4/5.
rgds
anver
pls amrk hlpful asnwers -
Download List output displayed
Hi Friends,
I want to donwload the list output displayed from the Report program with the exisitng formatting structure (displayed).
1)From SAP menu we can click on System > List > Save > Local file to download the file locally.
2) I want to obtain same functionality as mentioned in point 1 through a button on tool bar.
I dont want to prepare any internal table locally with the same data that is displayed on the screen, in the same formatting structure and Download, which is similar to a local download functionality.
Please let me know ur suggestions.
Regards,
Lavanya.Then you have to display your O/p in the ALV display ...
so that you can achive your requirement ..Because the ALV has the similar icon for downloading to pc ..etc
by Normal reporting you cannot get this Option .in the Application tool bar . one is there as you menioned
From SAP menu we can click on System > List > Save > Local file to download the file locally.
because by pacing the icon in the Apllication bar it will not call the path ..etc. you have to do the coding ...instead of that ALV is best .
But in the ALV it is there in the standard ALV GRID with Downlaod icon , summation,scroldown ,sorting (A/D) ,etc...
reward points if it is usefull ..
Girish -
Bridge CS4 won't output to pdf multiple images with same filename
Hiya...my googling efforts have thus far failed!
I've got CS4, and in Bridge, I created a New Smart Collection to find all filenames in a folder containing "." or ".jpg" - which in turn searched through all the subfolders like what you used to be able to do in Photoshop CS3. Very simple stuff, but all the images are jpg's, but in multiple folders (I don't want to move them out of the folders, as the files came from an external source, and there are heaps of folders, and I don't want to pdf each subfolder seperately as it will take forever).
The problem is that some of the files have the same filenames (again I'd prefer not to rename, as it happens a lot on this project, and they are all over the place). So whilst Bridge will show the thumbnail images correctly in the content tabbed screen in my New Smart Collection, but once I've done the Output to PDF thing, for example, instead of showing both different images it has pdf only the first image but repeated it twice. And this happens multiple times throughout the pdf, the more times the same filename is used, the more times the first image gets repeated.
I know that it is messy to have multiple similar filenames, but why can't bridge just place the image anyway? It allocated a space for it on the pdf and does show it in bridge, it just doesn't seem to survive the transfer to pdf well.
The only other thing that I have done is use the below link (which was posted on another adobe forum thread) to create a custom pdf output template (nothing too fancy, just number of rows / columns, size, font etc). But I've tried using the standard bridge templates and it does the same thing.
http://www.proficiografik.com/2009/08/03/save-custom-pdf-output-template-in-adobe-bridge-c s4.html
Any help would be appreciated...even if to tell me that I am being unreasonable!
UPDATE 16/11/09
Just to let you know that I seem to have resolved the bug inadvertently with one of the Adobe updates. The below is the link for the AdobeOutputModule-2.1-mul-AdobeUpdate.zip which was released on 2/19/2009 - which allows for headers & footers to be placed in the Ouput pdf. I finally installed it today, and everything seems to be working fine now (i.e. I can pdf multiple images with the same filenames and the pdf will actually show each different image rather than repeating only 1 of the images).
Must have been a fix installed in the contact sheet templates that get installed with the update - not sure why the original version was corrupted, but I've left that with the Adobe guys (I submitted a bug report - and they were able to replicate the problem but hadn't fixed it as yet).
http://www.adobe.com/support/downloads/detail.jsp?ftpID=4228
Message was edited by: djtun71 (16/11/09)When I click import from disc I am asked to choose a disc and then I get this message:
The following photos will not be imported because they are already present in the catalog. To see these photos in the catalog select 'Show in Library' (the import will be canceled).
This is followed by a long list of images. If I click 'Show in Library' I can see all the images with the same filename. And then they start to automatically write over those images with images from the disc. However they keep the same metadata and keywords from the previous images. If I click on Import and deselect the "don't reimport suspected duplicates" box, it imports only the images that don't share filenames and none of the images that do.
Is there a way of setting the "Don't reimport suspected duplicates" box in preferences? -
Hi,
I have one report using Reuse_Alv_List_Display as output. After that I have to download the output to PDF.
By using the following code I can able to download, But the Problem is I have 54 fields( total length to 900 characters) in the out put and while downloading through Spool I am getting only 17 fields in one row and remaining fields are getting in 2nd and 3rd rows and are getting overlap.
So is there any Possibility to download to 54 Fields in PDF.If so, Please help me...
*& Form USER_COMMAND
Form for user-command for providing Pdf Functionlity.
--> No Import / Export Parameters.
FORM user_command USING l_okcode LIKE sy-ucomm
l_selfield TYPE slis_selfield .
CASE l_okcode.
WHEN '&PDF'.
g_flag = 'X'.
PERFORM pdf_download.
ENDCASE.
ENDFORM. " USER_COMMAND
*& Form PDF_DOWNLOAD
Form for Pdf functionalty
--> No Import / Export Parameters
FORM pdf_download .
DATA l_spoolid TYPE tsp01-rqident.
Without archiving
DATA: params LIKE pri_params,
days(1) TYPE n VALUE 2,
count(3) TYPE n VALUE 1, p_file TYPE rlgrap-filename,
valid TYPE c.
CLEAR l_spoolid.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = 'LOCA'
copies = count
list_name = 'TEST'
list_text = 'SUBMIT ... TO SAP-SPOOL'
immediately = 'X'
release = 'X'
new_list_id = 'X'
expiration = days
line_size = 132
line_count = 25
layout = 'X'
sap_cover_page = 'X'
cover_page = 'X'
receiver = 'SAP*'
department = 'System'
no_dialog = ' '
IMPORTING
out_parameters = params
valid = valid.
IF valid <> space.
EXPORT g_flag TO MEMORY ID 'M1'.
SUBMIT z_fi_exec_customercollection WITH s_kunnr IN s_kunnr
WITH s_bukrs IN s_bukrs
WITH s_budat IN s_budat
TO SAP-SPOOL
SPOOL PARAMETERS params
WITHOUT SPOOL DYNPRO
AND RETURN.
ENDIF.
DATA: lt_spooltab TYPE STANDARD TABLE OF rsporq WITH HEADER LINE ,
lc_rq2name LIKE tsp01-rq2name.
CONCATENATE sy-repid+0(8)
sy-uname+0(3)
INTO lc_rq2name SEPARATED BY '_'.
CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
EXPORTING
rq2name = lc_rq2name
rqowner = sy-uname
TABLES
spoolrequests = lt_spooltab
EXCEPTIONS
no_permission = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE:/ 'Error in Find Spool request '.
ENDIF.
SORT lt_spooltab DESCENDING BY rqcretime.
READ TABLE lt_spooltab INDEX 1.
l_spoolid = lt_spooltab-rqident.
SUBMIT rstxpdft4 WITH spoolno EQ l_spoolid
WITH download EQ 'X'
WITH p_file EQ p_file
AND RETURN.
ENDFORM. " PDF_DOWNLOAD
*& Form SET_PF_STATUS
Setting Modified Pf-Status to our program.
--> No Import / Export Parameters.
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD_ALV_C'.
ENDFORM. " SET_PF_STATUSHi,
I dont know the possibility but we can do some thing by using the hirarchial list display, reduce the field lengths where ever is unnecessary you will get it.
Regards,
venkat appikonda. -
Hi,
I have a requirement where in I have to show the output of a custom report in PDF. I have specific layout in which the PDF has to be with header and item details. Can anyone suggest me if i have to go for Adobe forms for this...if yes, then how do i do it? or is there any other way i can show the output in specified PDF format.
Regards
PriyaSET PF-STATUS 'Z_PDF'.
*Table Declarations
TABLES: MARA, MARC, MAKT.
*Internal Table Declarations
DATA: BEGIN OF TS_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
LVORM LIKE MARA-LVORM,
END OF TS_MARA.
*Selection Screen Parameters
SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
TOP-OF-PAGE.
write: 40 'Generating PDF from List Output' color 1 intensified on.
skip 1.
write: /1 'Date :', SY-DATUM,
/1 'User ID :', SY-UNAME,
/1(112) SY-ULINE.
START-OF-SELECTION.
*Perform for Basic Selection
PERFORM GET_MARA.
*Perform to Display Data
PERFORM DISPLAY_MARA.
AT USER-COMMAND.
*User Command to generate PDF Form
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'PDF'.
DATA: L_PARAMS TYPE PRI_PARAMS,
L_VALID TYPE STRING,
W_SPOOL_NR LIKE TSP01-RQIDENT.
*TO GET PRINT PARAMETERS
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
OUT_PARAMETERS = L_PARAMS
VALID = L_VALID.
IF SY-SUBRC <> 0.
ENDIF.
*Internal table for Selection Screen
DATA: BEGIN OF I_RSPARAMS OCCURS 0.
INCLUDE STRUCTURE RSPARAMS.
DATA: END OF I_RSPARAMS.
*Store the current selection screen details
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
CURR_REPORT = SY-REPID
*IMPORTING
* SP =
TABLES
SELECTION_TABLE = I_RSPARAMS
EXCEPTIONS
NOT_FOUND = 1
NO_REPORT = 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.
*SUBMIT TO GET THE SPOOL NUMBER
SUBMIT ZSB_TEST_08 WITH SELECTION-TABLE I_RSPARAMS
TO SAP-SPOOL
SPOOL PARAMETERS L_PARAMS
WITHOUT SPOOL DYNPRO
AND RETURN.
*SELECT THE RECENTLY CREATED SPOOL
SELECT MAX( RQIDENT ) INTO W_SPOOL_NR FROM TSP01
WHERE RQCLIENT = SY-MANDT
AND RQOWNER = SY-UNAME.
*REPORT TO GENERATE SPOOL NUMBER FOR PDF CONVERT
SUBMIT RSTXPDF5 WITH SPOOLNO = W_SPOOL_NR
WITH DSTDEVIC = 'LOCL' AND RETURN .
IF SY-SUBRC EQ 0.
CLEAR W_SPOOL_NR.
*SELECT THE RECENTLY CREATED SPOOL FOR PDF
SELECT MAX( RQIDENT ) INTO W_SPOOL_NR FROM TSP01
WHERE RQCLIENT = SY-MANDT
AND RQOWNER = SY-UNAME.
*REPORT TO DOWNLOAD PDF SPOOL TO GUI
SUBMIT RSTXPDFT5 WITH SPOOLID = W_SPOOL_NR
AND RETURN.
ENDIF.
ENDCASE.
*& Form GET_MARA
* text
* --> p1 text
* <-- p2 text
FORM GET_MARA .
CLEAR : TS_MARA.
REFRESH: TS_MARA.
*To select Materials based on Selection Criteria
SELECT MATNR
MTART
MATKL
LVORM
FROM mara
INTO CORRESPONDING FIELDS OF TABLE TS_MARA
WHERE MATNR IN S_MATNR.
ENDFORM. " GET_MARA
*& Form DISPLAY_MARA
* text
* --> p1 text
* <-- p2 text
FORM DISPLAY_MARA .
CLEAR : TS_MARA.
WRITE: /1 '|', 2(18) 'Material Number' COLOR 7,
28 '|', 29(13) 'Material Type ' COLOR 7,
42 '|', 43(14) 'Material Group ' COLOR 7,
57 '|', 58(13) 'Deletion Flag ' COLOR 7,
112 '|'.
WRITE: /1(112) SY-ULINE.
LOOP AT TS_MARA.
WRITE: /1 '|', 2(18) TS_MARA-MATNR,
28 '|', 29(13) TS_MARA-MTART,
42 '|', 43(14) TS_MARA-MATKL,
57 '|', 58(13) TS_MARA-LVORM,
112 '|'.
WRITE: /1(112) SY-ULINE.
ENDLOOP.
ENDFORM. " DISPLAY_MARA -
How to Convert spool which is for smartform output to PDF?
how to Convert spool which is for smartform output to PDF?
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' is not working for smartform output,
if i use this there will be error spool not contain list output?
than whats the function module or way to convert spool contain smartform output to pdg?
regards,<b>Procedure</b>
When we activate the Smartform the system generates a Function Module. The function module name we can get from Smartfrom screen from menubar
Environment => Function Module_Name . In a report we can get this Function module name by calling a Function Module standard SSF_FUNCTION_MODULE_NAME. This function module at runtime calls the FM generated by smartform, which in turn is then used to pass data from the report to Smartform. In the report given below the FM generated is /1BCDWB/SF00000152 . In this FM we can see CONTROL_PARAMETERS in import tab. This is of type SSFCTRLOP. We need to set the GETOTF of this to be X. Setting this field will activate the OTF field in smartform.
In export tab of the FM generated by smartform we can see a parameter JOB_OUTPUT_INFO which is of type SSFCRESCL. The SSFCRESCL is a structure of having one of fields as OTFDATA. OTFDATA in turn is a table of type ITCOO. ITCOO has two fields TDPRINTCOM and TDPRINTPAR. TDPRINTCOM represents command line of OTF format data and TDPRINTPAR contains command parameters of OTF format data.
In every Smartform output in OTF format, TDPRINTCOM begins and ends with //. EP represents the end-of-page value for TDPRINTCOM field.
In addition we need to set few fields at the place where we call this FM(generated by smartform) in our program. While calling this FM we should set control_parameters, output_options, user_settings and job_putput_info fields as shown in program.
Once these settings are done we can call Function Module CONVERT_OTF to convert the OTF data of smartfrom output to PDF data format. Once these are done we can call method cl_gui_fronted_services=>file_save_dialog to specify the directory path where we want to save the output PDF file. After this we can call Function Module GUI_DOWNLOAD to download the PDF file on our local system.
<b>Here is a sample code of program to perform the function.</b>
SAMPLE CODE
[code]*&---------------------------------------------------------------------*
*& Report ZAMIT_SMART_FORM_PDF *
REPORT ZAMIT_SMART_FORM_PDF .
data: carr_id type sbook-carrid,
cparam type ssfctrlop,
outop type ssfcompop,
fm_name type rs38l_fnam.
DATA: tab_otf_data TYPE ssfcrescl,
pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
file_size TYPE i,
bin_filesize TYPE i,
FILE_NAME type string,
File_path type string,
FULL_PATH type string.
parameter: p_custid type scustom-id default 1.
select-options: s_carrid for carr_id default 'LH' to 'LH'.
parameter: p_form type tdsfname default 'ZAMIT_SMART_FORM'.
data: customer type scustom,
bookings type ty_bookings,
connections type ty_connections.
start-of-selection.
***************** suppressing the dialog box for print preview****************************
outop-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = SPACE.
cparam-getotf = 'X'.
select single * from scustom into customer where id = p_custid.
check sy-subrc = 0.
select * from sbook into table bookings
where customid = p_custid
and carrid in s_carrid
order by primary key.
select * from spfli into table connections
for all entries in bookings
where carrid = bookings-carrid
and connid = bookings-connid
order by primary key.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting formname = p_form
* variant = ' '
* direct_call = ' '
importing fm_name = fm_name
exceptions no_form = 1
no_function_module = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
exit.
endif.
* calling the generated function module
call function fm_name
exporting
* archive_index =
* archive_parameters =
control_parameters = cparam
* mail_appl_obj =
* mail_recipient =
* mail_sender =
output_options = outop
user_settings = SPACE
bookings = bookings
customer = customer
connections = connections
importing
* document_output_info =
job_output_info = tab_otf_data
* job_output_options =
exceptions formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc <> 0.
* error handling
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
tab_otf_final[] = tab_otf_data-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
IMPORTING
bin_filesize = bin_filesize
* BIN_FILE =
TABLES
otf = tab_otf_final
lines = 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.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
* EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILE_NAME =
* FILE_FILTER =
* INITIAL_DIRECTORY =
* WITH_ENCODING =
* PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = FILE_NAME
path = FILE_PATH
fullpath = FULL_PATH
* USER_ACTION =
* FILE_ENCODING =
* EXCEPTIONS
* CNTL_ERROR = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 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.
*************downloading the converted PDF data to your local PC********
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = FULL_PATH
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'
IMPORTING
filelength = file_size
TABLES
data_tab = pdf_tab
* 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.
ENDIF.
[/code]
Thanks and Regards,
Pavankumar
Maybe you are looking for
-
Mail Application Crashes Everytime Open A Message
I looked at the previously posted questions but did not find anything specific my problem. My mail application crashes every time I try to open an email. It only happens when I attempt to open the email. If the preview pane is open, the application c
-
We have an article tha ths been scanned and OCR'd (not by me, but another company) and it has an odd problem where the ocr text doesn't match the page image. This is an article from a journal, with the page range 70-80, 62. When you copy out the ocr'
-
Need to use xsds in PI Mapping
HI, Upto now i used ddf files for mapping in Gentran integration suite. Now i need to xsd files instead of ddf files. How would i convert those ddf files into xsd format. My main task is i want to do same mappings in PI which i did in GIS. Thanks, S
-
FieldPoint I/O Data Type versus Fieldpoint I/O Point Data Type
I have upgrated a project from LV 8.5 version to LV 2011 the Fieldpoint Data Types are different in LV 8.5 it is FieldPoint I/O and in LV 2011 it is Fieldpoint I/O Point. I built the proyect and tried to run it, no errors were present. Now the applic
-
Hi , I am trying to find existing enterprise structure on an IDES system. Apart from looking into the assignment node , is there any other way of finding about the org structure. E.g wher we get a graphical diagram kidn of view? Thanks in advance