Oracle APEX print with API - oracle

I need to export a report saving it in PDF format. I created a button that submits to a new page, which performs the following piece of code:
APEX_UTIL.DOWNLOAD_PRINT_DOCUMENT (
p_file_name => 'myreport123',
p_content_disposition => 'attachment',
p_application_id => :APP_ID,
p_report_query_name => 'MY_REPORT_QUERY',
p_report_layout_name => 'MY_REPORT_LAYOUT',
p_report_layout_type => 'xsl-fo',
p_document_format => 'pdf'
)
;
MY_REPORT_QUERY and MY_REPORT_LAYOUT are defined in the shared components. When I press the button, it downloads a pdf file, but it looks empty or corrupted.
What could be wrong? Do I need to specify the print server? And what about the field APP_ID?
I can confirm that both the query and layout work when I download the report by directly redirecting the page to the url of MY_REPORT_QUERY.
Thanks in advance and best regards.

Related

Calling an XML report by clicking a button on Oracle form and downloading the output

I have an xml report defined which produces a pdf output when submitted from SRS window.
Now the same report needs to be called from form by clicking a button.
The report should run and the output must be available there itself as a downloadable pdf file.
Thanks
This can be done following two steps:
1- First you have to attach layout to your concurrent request using fnd_request.add_layout.
2- Then you have to submit the concurrent request using fnd_request.submit_request.
Your code goes as follows:
--Setting Layout for the Request
l_layout := apps.fnd_request.add_layout(
template_appl_name => 'XXCUST',
template_code => 'XXEMP',
template_language => 'en',
template_territory => 'US',
output_format => 'EXCEL');
--
--Submitting Concurrent Request
--
l_request_id := fnd_request.submit_request (
application => 'XXCUST',
program => 'XXEMP',
description => 'XXTest Employee Details',
start_time => sysdate,
sub_request => FALSE,
argument1 => 'Smith');
to get information about templates, you can use following SQL:
SELECT * FROM xdo_templates_b
WHERE template_code = ‘FNDCPPGD_XML’;
SELECT * FROM xdo_templates_tl
WHERE template_code = ‘FNDCPPGD_XML’;

OS Ticket Open Ticket CSRF Token Dump Error

When i open new ticket in OS Ticket System, after ticket submission dump the array in the top of the page.
Error shown below.
Click to show image
Update
Error in text form:
Array ( [CSRFToken] => a56c08a9f49842de2ab3fc8e02d13ca2921d5f49 [a] => open [695fbbb799cdbbc2] => usman.saif22#gmail.com [ecf6c52d42557ef0] => M Usman [fec356fce5ea2de9] => [fec356fce5ea2de9-ext] => [topicId] => 2 [83163d48527225db] => Testing [message] => Testing [draft_id] => [emailId] => 0 [deptId] => 0 [cannedattachments] => Array ( ) )
This error occur when open new ticket, even ticket is successfully opened. But, shown this error when user open ticket.

Zip multiple files and download using php codeigniter

I am trying to create a zip file including 2 text files and download it. Here is my code. $fda and $fwl are 2 array datas.
$dataZip = array(
'./downloads/fda.in' => $data1,
'./downloads/fwl.in' => $data2
);
$this->zip->add_data($dataZip);
$this->zip->archive('./downloads/files_backup.zip');
$this->zip->download('files_backup.zip');
But it always returns error as a wrongly formatted string and nothing is downloaded.
fda.in�X�n�0}�+�
Could anybody tell me where I was wrong?
I found out the solution. All I have to do is add ob_start(); in the open of the controller file.
ob_start();
$dataZip = array(
'./downloads/fda.in' => $fda,
'./downloads/fwl.in' => $fwl
);
$this->zip->add_data($dataZip);
$this->zip->archive('./downloads/files_backup.zip');
$this->zip->download('files_backup.zip');

Can't 'file.open.read' a url within a ruby if-block

I want to create a ruby script which will take barcodes from a text file, search a webservice for that barcode and download the result.
First I tried to test the webservice download. In a file when I hardcode the query things work fine:
result_download = open('http://webservice.org/api/?query=barcode:78686112327', 'User-Agent' => 'UserAgent email#gmail.com').read
It all works fine.
When I try to take the barcode from a textfile and run the query I run into problems.
IO.foreach(filename) {|barcode| barcode
website = "'http://webservice.org/api/?query=barcode:"+barcode.to_str.chomp + "', 'User-Agent' => 'UserAgent email#gmail.com'"
website = website.to_s
mb_metadata = open(website).read
}
The result of this is:
/home/user/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/open-uri.rb:37:in `initialize': No such file or directory # rb_sysopen - http://webservice.org/api/?query=barcode:78686112327', 'User-Agent' => 'UserAgent email#gmail.com' (Errno::ENOENT)
I can't figure out if this problem occurs because the string I generate somehow isn't a valid url and ruby is trying to open a non-existent file, or is the issue that I am doing all this in a for loop and the file/url doesn't exist there. I have tried using open(website).write instead of open(website).read but that produces the same error.
Any help would be much appreciated.
The error message you get explicitly states, that there is no such file:
http://webservice.org/api/?query=barcode:78686112327', 'User-Agent' => 'UserAgent email#gmail.com'.
You try to pass all the parameters to open method using 1 big string (website), which is wrong. You should do it like that.
IO.foreach(filename) do |barcode|
website = "http://webservice.org/api/?query=barcode:#{barcode.to_str.chomp}"
mb_metadata = open(website, 'User-Agent' => 'UserAgent email#gmail.com').read
end

How to save a backup of mails sent through MIME::Lite in Perl 5?

I am sending mail through MIME::Lite perl module.I want that my sent mails should be saved in Sent items folder of my mail inbox.Please suggest me a way to do this.
Thanks
script-
use MIME::Lite;
my $msg = MIME::Lite->new(
From => 'xyz#abc.com',
To => 'abcd#gmail.com',
Subject => 'sending mail',
Type => 'multipart/mixed',
);
$msg->attach(
Type => 'TEXT',
Path => '/home/user/myName/cppLab/a.txt',
Filename => 'aabc.txt',
Disposition => 'attachment',
);
$msg->attach(
Type => 'TEXT',
Data => "learning to send mail",
);
#$msg->print(\*STDOUT);
#$msg->print_header(\*STDOUT);
$msg->send;
print "mail sent.."
Depends on how you access your inbox. In any case, you'll probably need MIME::Lite's as_string method that you can call on messages to retrieve the entire text including headers and possibly attachments.
For local mailboxes:
If your mail folders use the Maildir format, you could use Maildir::Lite to simply write the returned string to an appropriately named (Maildir::Lite does that for you) file.
For mbox folders, have a look at Mail::Box::Mbox
Local mailboxes can be handled in just a few lines of Perl. If your inbox is remote and needs IMAP, there's always IMAP::Client but I don't really have a clue about it. Perhaps a local Maildir plus offlineimap would do, too?

Resources