Spool to PDF - First page blank w/ run in background
I have a report that I write to spool using NEW PAGE PRINT ON/OFF. I use the FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to convert it to PDF. Everything works fine in the foreground. The problem is when a background job is scheduled, and the file written to the app server, a blank page is inserted at the beginning of the PDF file. No data is lost, just a blank page inserted.
Has anyone seen this before? If so, what was the fix?
Thanks in advance
Message was edited by: Thomas Branom
The process is the same for both foreground and background.
Here is some of the code, please not I took out the page break for each new customer name, but the blank page still occurs when executing in background.
** Routine to write to spool
FORM write_to_spool USING rv_download TYPE xfeld.
DATA: s_out TYPE get_data=>type_out,
t_temp_out LIKE STANDARD TABLE OF s_out,
v_kunnr TYPE kunnr,
* v_name1 TYPE name1_gp,
v_pos TYPE i VALUE '0'.
APPEND LINES OF cl_get_data->t_out TO t_temp_out.
SORT t_temp_out BY kna1-name1 kna1-kunnr vbak-bstnk.
FORMAT RESET.
** Turn on writing to spool
IF rv_download = 'X'.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS gs_pri_param
NO DIALOG.
ENDIF.
LOOP AT t_temp_out INTO s_out.
** This will cause a page break at each new customer
** name, I even commented out the 'NEW-PAGE' and I still
** get a blank page at the beginning of the PDF
IF v_name1 <> s_out-kna1-name1.
IF NOT v_name1 IS INITIAL.
ULINE AT /(c_line_size).
NEW-PAGE.
ENDIF.
v_name1 = s_out-kna1-name1.
ENDIF.
v_pos = 3.
WRITE : / '|'.
WRITE AT v_pos s_out-vbak-vbeln.
v_pos = v_pos + 13.
WRITE AT v_pos(16) s_out-vbak-bstnk.
v_pos = v_pos + 18.
WRITE AT v_pos s_out-likp-inco1.
v_pos = v_pos + 11.
WRITE AT v_pos(20) s_out-likp-inco2.
v_pos = v_pos + 22.
* WRITE AT v_pos(20) s_out-kna1-name1.
* v_pos = v_pos + 22.
WRITE AT v_pos(20) s_out-kna1-ort01.
v_pos = v_pos + 22.
WRITE AT v_pos s_out-kna1-regio.
v_pos = v_pos + 10 .
WRITE AT v_pos(20) s_out-likp-lifex.
v_pos = v_pos + 23.
IF NOT s_out-likp-wadat IS INITIAL.
WRITE AT v_pos s_out-likp-wadat.
ENDIF.
v_pos = v_pos + 13.
IF NOT s_out-estprt IS INITIAL.
WRITE AT v_pos s_out-estprt.
ENDIF.
v_pos = v_pos + 13.
IF NOT s_out-actprt IS INITIAL.
WRITE AT v_pos s_out-actprt.
ENDIF.
v_pos = v_pos + 13.
IF NOT s_out-bolsnt IS INITIAL.
WRITE AT v_pos s_out-bolsnt.
ENDIF.
v_pos = v_pos + 13.
IF NOT s_out-cstclr IS INITIAL.
WRITE AT v_pos s_out-cstclr.
ENDIF.
v_pos = v_pos + 13.
IF NOT s_out-likp-lfdat IS INITIAL.
WRITE AT v_pos s_out-likp-lfdat.
ENDIF.
WRITE AT c_line_size '|'.
ENDLOOP.
ULINE AT /(c_line_size).
** Turn off writing to spool
IF rv_download = 'X'.
NEW-PAGE PRINT OFF.
ENDIF.
** Routine to convert spool to pdf and save to file
FORM convert_pdf CHANGING rv_rc TYPE sysubrc.
DATA: t_seltab TYPE STANDARD TABLE OF rsparams,
s_seltab TYPE rsparams,
s_tsp01 TYPE tsp01,
t_tsp01 LIKE STANDARD TABLE OF s_tsp01,
v_objtype LIKE rststype-type,
v_type LIKE rststype-type,
is_otf TYPE char1,
v_numbytes TYPE i,
v_numbytes1 TYPE i,
v_pdfspoolno LIKE tsp01-rqident,
v_jobname LIKE tbtcm-jobname,
v_jobcount LIKE tbtcjob-jobcount,
* t_pdf TYPE type_t_pdf,
t_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
s_pdf LIKE LINE OF t_pdf,
v_pdflength TYPE i,
v_filename TYPE string.
FIELD-SYMBOLS <f> TYPE ANY.
** Get the spool, if no spool, then give error and exit
SELECT * FROM tsp01 INTO TABLE t_tsp01
WHERE rqident = sy-spono.
IF sy-subrc <> 0.
rv_rc = 1.
MESSAGE s060(zb) WITH sy-spono. "NO SPool
EXIT.
ENDIF.
LOOP AT t_tsp01 INTO s_tsp01.
* Determine spool format
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = s_tsp01-rqclient
name = s_tsp01-rqo1name
part = 1
IMPORTING
type = v_type
objtype = v_objtype.
IF v_objtype(3) = 'OTF'.
is_otf = 'X'.
ELSE.
is_otf = space.
ENDIF.
* Convert to PDF format
IF is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = s_tsp01-rqident
IMPORTING
pdf_bytecount = v_numbytes
pdf_spoolno = v_pdfspoolno
btc_jobname = v_jobname
btc_jobcount = v_jobcount
TABLES
pdf = t_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.
IF sy-subrc <> 0.
rv_rc = 1.
MESSAGE s061(za) WITH sy-spono. "NO SPool
EXIT.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = s_tsp01-rqident
IMPORTING
pdf_bytecount = v_numbytes
pdf_spoolno = v_pdfspoolno
btc_jobname = v_jobname
btc_jobcount = v_jobcount
TABLES
pdf = t_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.
IF sy-subrc <> 0.
rv_rc = 1.
MESSAGE s061(za) WITH sy-spono. "NO SPool
EXIT.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* Download the file to local pc if requested and not in background.
IF NOT p_fname1 IS INITIAL AND sy-batch IS INITIAL.
v_filename = p_fname1.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_filename
filetype = 'BIN'
bin_filesize = v_numbytes
IMPORTING
filelength = v_numbytes1
TABLES
data_tab = t_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE s062(za) WITH p_fname1.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
MESSAGE s065(zb) WITH 'Downloaded' v_numbytes
p_fname1.
ENDIF.
ENDIF.
* Write the PDF file server if requested.
IF NOT p_fname2 IS INITIAL.
v_numbytes1 = v_numbytes.
DESCRIBE FIELD t_pdf LENGTH v_pdflength.
LOOP AT t_pdf INTO s_pdf.
IF v_numbytes > v_pdflength.
TRANSFER s_pdf TO p_fname2.
ELSEIF v_numbytes <> 0.
ASSIGN s_pdf(v_numbytes) TO <f>.
TRANSFER <f> TO p_fname2.
ENDIF.
v_numbytes = v_numbytes - v_pdflength.
ENDLOOP.
CLOSE DATASET p_fname2. "Open in perform chk_dwnld_param
MESSAGE s065(zb) WITH 'Wrote' v_numbytes1 p_fname2.
ENDIF.
ENDLOOP.
Message was edited by: Thomas Branom
Similar Messages
-
Data is missing in Even Page when report running in background (spool)
Hi
I have this weird problem in my report. The report would run in background convert the data in to PDF from spool and then email it to people.
Now when the PDF has more then 1 page the error occurs.
It drops the last row from the even page. The total at the end and every thing shows correctly. If there r more than 2 pages then on page 3 the last row is not dropped and its all fine but again on page 4 it drops one record and on page 5 again its working fine.
One thing is it also puts an extra line(horizontal line which is not in the code) on those pages where its unable to put the record and its always the last one on the even page. I also looked up the spool. Its doing it in the spool too. So i think its not the PDF converter its when the spool is getting created for some reason its droping the rows for the even pages...
Did any one else encountered some thing like this? please help.
Thanks
Message was edited by:
Anwarul Kabiris there any problem with Background spools with SAP? We are running R3 here. And looks like its the spool background job that's creating the error. When i execute the report it shows all the record in print preview or if i print it.
Please Help! -
Error in converting from a PDF (first page does not convert)
I want to convert a PDF to an excel worksheet. The file is some 30 pages this month, the first page renders as a picture, the rest of the pages convert correctly! I have tries converting to other formats but end up with either unusable text or the first page as an image, albeit of the first page but not usable.
I think the graphic at the top of the first page is the cause as the conversion process is looking at the whole page now as a graphic and not 'seeing' the text in the table below.
Any help, ideas appreciated as I have spent hours on the Internet and in front of the pc trying to sort this out.
Thanks
PhilipCustomer Support: http://helpx.adobe.com/contact.html?step=CPDF_how-tos-troubleshooting_stillNeedHelp
Cancel your subscription: http://helpx.adobe.com/x-productkb/policy-pricing/cancel-subscription-acrobat-online-servi ces.html
[topic moved to PDF Pack forum] -
First Page blank -Crystal Reports 2008 Service Pack 1 install issues
Hi,
After installation of Crystal Reports 2008 Service Pack 1 - Redist Install on Web server. First page of all the reports are blank .But when next page is clicked next page displays information ,then previous page the report displayed.
On loading the first page of the report is blank.
The report is fine in Crystal reports
After navigating to the second page - the data on the second page appears with no issues -
Then Navigate back to the first page then the first page data appears.
Thanks in advance .
Regards
PrakashJust to clarify why this needed to be done. The CR msm and msi files install the correct files into a bin directory. The bin directory is specific to the version of Crystal Reports. Also, the viewer files are installed into the default web site aspnet_client folder. Thus if an application is installed into a custom website, you will have issues, such as red X-es instead of images, errors, failure to load report, etc. For more documentation on this issue see these articles:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50aa68c0-82dd-2b10-42bf-e5502b45cd3a
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0437ea8-97d2-2b10-2795-c202a76a5e80
Ludek -
We made some minor modifications to a report, added a field to an empty space on the middle of the form and updated a simple formula to display one line less of an address and now it seems that the report works fine but the first page doesn't show any data. Does anyone have any ideas what would cause the first page to be without data? The 2nd, 3rd, and 4th pages print data on them fine. None of the formatting changed on the report.
Thanks in advance.This was a new project for me and we found out the developer had fixed a bug that we reintroduced by adjusting some table linking. Once the developers fixed the bug the first page was no longer blank. It was more of a missing data issue than a totally blank page. Thanks for all your input.
-
When the page will be load how to make the page blank in run time
Dear
when i will run the page the fields shoud come with blank Field.
i want to make it in runtime.
example- i have one page having employees data. but when i will run that page the data will not come only blank fields should come, after thar i will create.duplicate how to make the page blank field in runtime
-
M1319f mfp laserjet... first page blank.
Hi, my laserjet printer always spits out a blank page before printing. Kinda makes it hard to print checks in order. It was working fine with, then lastnight started the first blank page.
Thanks for the help.
GeneHi, my laserjet printer always spits out a blank page before printing. Kinda makes it hard to print checks in order. It was working fine with, then lastnight started the first blank page.
Thanks for the help.
Gene -
PDF document first page is blank when executing in background
Hi,
I am creating spool before displyaing report output by using GET_PRINT_PARAMETERS and NEW PAGE PRINT ON option and displaying report header and report final internal table. calling NEW PAGE PRINT OFF
finally i am sending mail, by using SO_NEW_DOCUMENT_SEND_API1 function module in foreground executing and background execution.
When we execute in foreground i am recieveing mail and pdf is perfect.
when we execute in background i am recieveing mail. But when i opend the pdf document in mail, PDF doucment first page is balnk and second page onwards i am able to see the report output
why the PDF first page is blank when i execute the same report with same variant in back ground.
Please help me in this issue.
Thanks in advance
RajuHi Raju,
<li> Call ABAP4_COMMIT_WORK function module after NEW-PAGE PRINT OFF command.
NEW-PAGE PRINT OFF.
CALL FUNCTION 'ABAP4_COMMIT_WORK'.
Thanks
Venkat.O -
Blank First Page in Sub Report
Hi,
My sub report display the first page blank with data starting from the second page. The first page just displays the Report Header. How can I fix this?
Thanks.
ReenaIs it possible that there is a group in the subreport and you have Keep Group Together set in the Group Options?
Fuskie
Who would bet the group data is larger than what fits on a single page and Crystal reacts to that by pushing the whole thing to the second page... -
Laserjet 4000n keeps printing (multiple) copies of first page
My LaserJet 4000n model C4118A serial no. nlqwo15293 manufactered Feb 16 1999 is conected to home LAN (bt Home Hub 5)
If I print a copy of the menu map using the buttons on the control panel I get muliple copies.
If I try to print 1 copy of a 2 page document I get multiple copies of the first page
I'm running Windows Vista Home Premium
Suggestions please
is the printer unrepairable?Hi!
Thanks for the reply. I changed the settings of the printer to 'Pass Copies as Separate Output Request(in SAP System)' and re-tried printing 5 copies of the BOL and it again seems to print the first page 5 sides then Terms and conditions on 5 sides, then again 5 sides of page 2 and followed by 5 sides of T&C.
My settings on the smartforms is front page "D' and the back and the Last page is blank setting. This runs well when I just have to print one copy of my BOL , it prints the front page and then T&C on its back side , then again the second page and T&C on its back . This only messes when its more than one copy of the set of BOL.
Please suggest as to what to do next to make it print in proper sets.
Thanks and Regards
Aarav -
Diadem 2012
I've had a recurring issue which I've l lived with for quite a while and have not been able to narrow down what causes it.
Sometimes a report exported as a PDF has a blank page 1 (missing what should be on page 1 - I only see a black border outline when opening the PDF) and from page 2 on looks normal. Originally the reports were created from a template TDR. After we upgraded to Diadem 2012 I rewrote the report code to dynamically create each report from scratch and the problem happened using both methods. I run this code on different computers and using a variety of source files and I haven't been able to figure out a pattern.
All the reports are being automatically generated so I don't have a TDR to compare to the PDF.
For example, today I generated an Attribute, a dirty and a clean report. Page 1 of the attribute report was blank, but the dirty and clean reports look fine. Page 1 for all 3 reports is a page containing the serial numbers which were used to generate the rest of the report. If there are enough serial numbers to require more than one page, the second page prints fine.
I have a different product which page 1 of the dirty report is blank. There is no attribute report for this product. It's almost like there is some initialization code that needs to happen is not happening, but it fixes itself once it goes on to page 2, and all future reports for the product work fine. But I'm using the same code on a different computer and it is not generating blank pages.
The code for the first page of the attribute, dirty and clean is the same code. The attribute and dirty/clean routines are in different code files so the routine which generates the serial number page is copied.
Looking for any ideas.
thanks,
JamesJames
I feel for you, this looks like a hard one to narrow down to a solution. I have made automatically generating reports to PDF as well.
It does sound some initialization code is not being ran consistently. With my limitations of can't see code, and really do not have the time if did have code. But I can offer some tips used to trouble shoot similar issues.
1) As far as comparing the tdr to PDF. You can add right before the PDF is made, a command to save the tdr file. That will allow you to verify that the PDF output command is not the issue. It will also allow code to be developed to detect it missing, and log it.
2) Once you have a TDR of the first page not happening, you can develop code to look at the report objects to check that the first page has values in it.
3) Once you have the code that will detect the first page not being present, then this sub or function can be can at various pages of the app, with results logged to DIAdem log or other fie. This has the potential to reduce the possible area causing the issue.
General notes:
a) When you are refering to the specific pages. Is this by page number or by page name? I usually use page name to get the page I want.
b) When it builds the report and report objects, Is the app naming the objects as it makes them? If it was then it would make is more straightforward to check for them missing.
I am thinking that once you have a sample TDR with the missing first page information, It opens up the troubleshooting options.
If some examples of the above are helpful. Just let me know.
Paul -
PDF's that I create look fine in all readers except Adobe Reader for Android where the first page is blank. I can't figure out why though for the life of me. Anyone have an idea why something like this would occur?
Thanks Mehwish,
Do you have any insight into why this occurred and if there's a way to avoid it until you guys get this fixed? Any ETA on the fix? This is a huge issue for us right now and I'm trying to figure out any workaround possible. Thanks. -
Only first page of pdfs will display in Reader for iPad?
When I attempt to open some (not all) pdf files, only the first page of the document will display. The remaining pages show up blank, with the top toolbar also not displayed.
These files are downloaded from my university's Blackboard app, with some working properly and others not despite them all being pdfs. I have tried downloading them directly from Blackboard and uploading them to Google Drive (where they display properly) and downloading them from there, but neither works. All files will open and display properly in iBooks so it seems that the problem is with Adobe Reader. How do I fix this?Are you running the latest Adobe Reader Version i.e. 11.0.1? Can you please share the file where you are encountering this issue to [email protected]?
-
No data found in report csv or pdf output on first page load
No data found in report csv output on first page load. Report shows up on page, but no data found in csv or pdf output. I always need to submit the page and then it shows data in downloads. The page contains a form (read-only) with a report that references 4 page items by using something like the following:
and b.employee_no = v('P5_EMPLOYEE_NO')
and c.fisc_year_pk = v('P5_FISC_YEAR_PK')
and b.job_class = v('P5_JOB_CLASS')
and b.organization = v('P5_ORGANIZATION')
Again, report in the page shows up except there is no data in downloads. Can anyone help me solve this problem? I'm running Oracle APEX 4.2.1 in Oracle database 11gR2.
Thanks.Sounds like a classic session state issue.
You need to populate you page items using page rendering computations to ensure they're set to session state.
Or if the download is triggered from a button press, you need to ensure those page items are submitted to session state, perhaps via a PL/SQL action.
Scott -
I was developing an desktop application with C#.NET2.0
I would like to insert a PDF file to a repository and then generate the thumbnail of first page to a (jpg/png) file and store to the database for preview as the Icon in my application.(Like to Window Explorer)
I have read around the boards and found that the machine must be installed with only the full of Acrobat Professional, right?
If the appliction have to be run to a lot of client. Do I need to buy the lecense to all machines? Or Are there the other ways?If you want to use the Acrobat SDK, which is a tool for automating
Acrobat, you need to buy and install Acrobat on each client.
Adobe's PDF Library, which doesn't require Acrobat and has a different
(negotiated) licensing model based on royalties might be a better fit.
In either case, this would be written in C/C++.
Aandi Inston
Maybe you are looking for
-
I have kept getting some sort of messages about my apple id or icloud being disabled or something like that. My mail @me.com doesn't work, I can't send messages, Safari and Chrome won't let me do anything. First I thought it was just the Chrome. S
-
Hi All, I am new to MAC, i installed MAC os in windows 7 through the VM Ware, i tried to install xcode 4.1 and many version of xcode, after i download the .dmg file when i open it "xcode icon" is blocked, when double click it, says Update the version
-
Strange SP2-0042: unknown command in sqlplus
Hello everyone,i was attemptting to execute a sql statement from an external file. But i got "SP2-0042: unknown command "ï»? - rest of line ignored.". It's works with ANSI but can not based on UTF8 encoding.My file only contains as following : spo db
-
Here is what I've got: try // Load the JDBC driver String driverName = "com.mysql.jdbc.Driver"; // MySQL MM JDBC driver Class.forName (driverName); // Create a connection to the database ser
-
Photoshop Elements 8 will not allow me to sign in. I get an error message
My operating system is Windows 7 Professional using Google Chrome browser. My Photoshop Elements 8 serial # is 1057-1150-6317-4223-0314-8582 When I try to sign in to the program I get this message "Service is currently unavailable. Please try again