Dynamically generate PDF with web dynpro
Is it possible to generate a PDF in web dynpro abap without using the interactive form UI element ? In other words just take the data in my context and convert that into a xstring pdf using a predefined template and interface?
Hi
Do tell your solution for others to benefit
Regards
Yuval
Similar Messages
-
Prerequisites to generate PDF in web dynpro
hi Web dynpro Gurus,
I am trying to create a web dynpro application, which uses two BAPIs, The first BAPI output results in some data which I am displaying in a table format.
Now among the data retrieved from the first BAPI is INVOICE number.
Now on clicking the invoice number, the second BAPI should be called and that would result in the PDF file.
So please help me in this issue.
Thanks and regards
krisHi,
For WD4A the information about PDF is here:
http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/241a427ff6db2ce10000000a1550b0/frameset.htm
And for WD4J here's the information with all the relevant links inside:
http://help.sap.com/saphelp_nw2004s/helpdata/en/60/6fc10c6748479392101e09c9e8d33a/frameset.htm
Regards, Heidi -
Hello,
I have a problem with generating a PDF file with ABAP WebDynpro. I have an ALV and there I read a line. From this line I want to build a smartform which should be converted into PDF. I think my coding works. I have no syntax errors and when I debug the coding, everything looks good. I also get my popup that I want to have. But then I got an error: "File does not begin with '%PDF-'."
I look for this error here in SDN but I could not find a solution. I have also tried to do what is mentioned in note 1042424.
Can anybody helps me?
Regards, MarkusSebastian, thanks for your help, but I have used the funtions you have written.
I summarize my coding:
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZRPM_STECKBRIEF'
importing
fm_name = fm_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
CALL FUNCTION fm_name
EXPORTING
control_parameters = ls_control_parameters
is_attributes = ls_attributes
lt_cap = lt_cap_data
iv_dateinr = lv_dateinr
iv_gate1 = lv_datgate1
iv_chancen = lv_chancen
* IV_RISIKEN =
* IV_BEWERTUNG =
iv_ziel = lv_short_texts
it_fin = lt_fin_data
report_reason = doc_type
IMPORTING
job_output_info = ls_formdata
TABLES
it_nutzen = lt_test3
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
lt_otf[] = ls_formdata-otfdata[].
call function 'SSFCOMP_PDF_PREVIEW'
exporting
i_otf = lt_otf
exceptions
convert_otf_to_pdf_error = 1
cntl_error = 2
others = 3.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
* max_linewidth = 132
IMPORTING
bin_filesize = pdf_size
bin_file = pdf_data
TABLES
otf = lt_otf
lines = lt_pdf
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
data:
node_pdf type ref to if_wd_context_node,
elem_pdf type ref to if_wd_context_element,
stru_pdf type if_componentcontroller=>element_pdf ,
item_source like stru_pdf-source.
* navigate from <CONTEXT> to <PDF> via lead selection
node_pdf = wd_context->get_child_node( name = if_componentcontroller=>wdctx_changing ).
* get element via lead selection
elem_pdf = node_pdf->get_element( ).
* set single attribute
elem_pdf->set_attribute(
exporting
* name = `SOURCE`
name = `PDF`
value = pdf_data ). -
Generating PDF in Web-Dynpro - empty window popup
Hi Expertise,
I notice that in FM Y_GLXX_WD_JAVA_PDF has calls CONVERT_OTF. It returns different value bin_file in 4.6 & ecc6. In Ecc6 there wasnt return PDF header %PDF 1.3 - ......... but 4.6 had returns. It cause the portal site will prompt out empty windows instead of prompt out PDF screen.
Any ideas, which FM should i use to replace CONVERT_OTF or other solutions??
Regards,
azel
Edited by: azel aziz on Sep 4, 2008 4:33 AMFor your information, i am currrently developing in Webdynpro Java. But, i don't think that is the case because the Java code will convert the Binary String to Bytes. The problem is why the BAPI returning different BIN_FILE values from two different system (ECC6.0 & 4.6C)?
After the execution, the BAPI will return the PDF value as String
[http://inakimi.multiply.com/photos/album/48/webdynpro#1]
And this is the code in WD Java converting the String to Bytes:
IWDCachedWebResource resource;
wdThis.setData();
String line = wdContext.currentOutputElement().getBin_File(); byte[] pdfContent = line.getBytes();
try{
resource = WDWebResource.getWebResource(pdfContent, WDWebResourceType.PDF);
IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getURL(), "PDF File");
window.setWindowPosition(5, 5);
window.setWindowSize(600, 600);
window.show();
}catch(Exception e){
Edited by: azel aziz on Sep 5, 2008 3:25 AM -
Strange problem of Pdf downloading with Web Dynpro
Hi, experts, I have to setup a project to realize pdf downloading with web dynpro. But unluckily, I have tried all the methods in this froum ,there's really strange problem .Because when I click the link of Download UI link, there's no reaction at all, I really don't know why.Below is the codes I used , can anyone help me ? thank you very much!
public void wdDoInit()
//@@begin wdDoInit()
IWDAttributeInfo attInfo =
wdContext
.currentContextElement()
.node()
.getNodeInfo()
.getAttribute(
"Pdfsource");
ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) type;
binaryType.setFileName("test.pdf");
binaryType.setMimeType(WDWebResourceType.PDF);
try {
int length =
(int) wdContext.currentPdfdownloadElement().getBin_Filesize();
byte b[] = new byte[length];
b = wdContext.currentPdfdownloadElement().getBin_File();
wdContext.currentContextElement().setPdfsource(b);
} catch (Exception ex) {
"Pdfsource" is the context value attribute of type binary.And Bin_File is the xstring type parameter from my RFC contains pdf content.
I used two views and one customer-controller . I put some value in the first view to set search condition.and the second then appears and have the download UI element. Are there any additional codes I should use? pls help!Hi Hao,
Try this out
Suppose the file name is test.doc in c drive in server
create a context attribute filedata of binary type
bind it to data property
write the following code
try
File input = new File("C:
test.doc");
int length =(int)input.length();
//Create a byte array b to hold the file
byte b[] = new byte[length];
FileInputStream in = new FileInputStream(input);
//Reading the file to a byte array b
in.read(b);
in.close();
//Setting the data from the byte array to the context element.
wdContext.currentContextElement().setfiledata(b);
catch(Exception ex)
wdComponentAPI.getMessageManager().reportSuccess("Error in File
IO"+ex.toString());
// Structure information of the context attribute
IWDAttributeInfo attinfo = wdContext.getNodeInfo().getAttribute("filedata");
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attinfo.getModifiableSimpleType();
// Default File name which appears when opened on client machine
binaryType.setFileName("testing.doc");
//Explicitly setting the file type
binaryType.setMimeType(WDWebResourceType.DOC); -
Issue with emailing dynamically generated PDF (InteractiveForm UI element)
Hi Experts ,
I have a requirement according to which i need to generate PDF dynamically using webdynpro java and email the dynamically generated PDF.
I am facing issue while emailing the dynamically genarated pdf.
It gives me an exception :
nested exception is: javax.mail.MessagingException: IOException while sending message; nested exception is: java.io.IOException: no data
This is because its unable to get the binary data (byte array) of the dynamically generated PDF which is required to send mail.
Could some one suggest me how to fetch the binary data of the dynamically generated PDF.
For dynamic PDF generation i am using dynamic generation of UI element InteractiveForm UI Element
In case of static PDF (i.e. the PDF genarated by inserting the InteractiveFrom Ui element on the view using the insert child option) we do set the pdf source property of Interactive Form UI element to a context variable attribute of type binary but my problem is ,how to set the PDF source of a dynamically generated Interactive form UI element to a context variable attribute of type binary ..
Any help would be highly appreciated.
Regards ,
NavyaHi Frank ,
the code to generate PDF dynamically is written in the WdDoModifyView section of the view as the PDF need to be generated dynamically., i.e. by adding InteractiveForm UI elements at runtime.
I tried the code suggested by you but i gave mean exception.
errorjava.io.FileNotFoundException:
(The system cannot find the path specified)
Kindly let me know where i am going wrong .
Below is the code that i had written in a separate method m_mail().
This would take as input the name of the dynamically generated data node and is called from the wdDoModifyView section of the view
public void m_mail( java.lang.String p_dynamicnodeName )
ByteArrayOutputStream templateSourceOutputStream = new ByteArrayOutputStream();
// This would need to have the Templatefile in the Mimes-Directory of the Webdynpro-Component
String templateUrl = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), "AdobeView1_InteractiveForm.xdp");
InputStream templateSourceInputStream = new FileInputStream(templateUrl);
IOUtil.write(templateSourceInputStream, templateSourceOutputStream);
IWDPDFDocumentCreationContext pdfContext = WDPDFDocumentFactory.getDocumentHandler().getDocumentCreationContext();
pdfContext.setData(WDInteractiveFormHelper.getContextDataAsStream(wdContext
.nodeCtx_vn_dynmcnd()
.getChildNode(p_dynamicnodeName, IWDNode.NO_SELECTION)));
pdfContext.setTemplate(templateSourceOutputStream);
pdfContext.setInteractive(false);
IWDPDFDocument pdf = pdfContext.execute();
if (pdf != null) {
pdfArray = pdf.getPDF();
Kindly let me know where am i going wrong.
Regards ,
Navya -
How to display smartform as PDF in web dynpro java
Hi,
Where can I find sample program to display smartform as PDF in web dynpro java.
Thanks.
Regards,
Henry1. Create a smart form in the R/3 side
2. Now create a function module with the corresponding export parameter:
3. Make sure that the function module is marked remote enabled.
4. In NWDS create an Adaptive RFC model which points to the FM created in R/3 under the webdynpro application
5. Now create an application and view inside it to display the PDF and Insert a frame inside the view
6. Create a value node and an attribute say url of type string inside that node and bind it to the source
7. In the doInit() method place the following code
> ZTest_Pdf_1_Input input = new ZTest_Pdf_Input();
> wdContext.nodeZTest_Pdf_Input().bind(input);
> try {
> wdContext.currentZTest_Pdf_InputElement().modelObject().execute();
> }
> catch (Exception e) {
> e.printStackTrace();
> }
> wdContext.currentInternalElement().setUrl(convert(wdContext.currentOutputElement().getBin_File()));
Inside that view create a method to convert the string to url so that it can be passed as a string to the setUrl method of the currentContextElement() , say convet(byte[] doc_content) which return a string.
Inside that methos write the following code,
> String url = "";
> WDWebResourceType webResType = WDWebResourceType.PDF;
> IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType);
> try {
> url = webResource.getURL();
> }
> catch (Exception e) {
> e.printStackTrace();
> }
> return url;
Hope It will be helpful
Regards,
Sam Charles J. -
Problem in submit button on adobe form integrated with web dynpro
Hello,
I'm facing prob in triggering web dynpro event onSubmit for Interactive form.
I've created a submit button from web dynpro activex pallete on adobe form (integrated with web dynpro) to send the form as email.
Then in the web dynpro view where this form is embedded i have created an action against onSubmit event and called a method within this.
However, on clicking Submit button this event is not getting triggered.
Please let me know what is lacking in this process?
Thanks.Hi,
I am also facing the same problem. i have developed a simple scenario under which user have to input his/her details and on submit button it will be updated to database.
I have tried the above solution but after adopting this solution all the editable fields become non-editable.
so the above solution is not working for me could you help me out.
I think ... try this....
When you create the Adobe Form from WebDynpro, you need to follow one step in SFP Transaction or inSE80 transaction. Open the Adobe Form in any one the transaction and now in SAP menu bar "Utilities" in that you will find the "INSERT THE WEBDYNPRO SCRIPT" just click on that one. Then you will see a new Script Object is being created with the name "ContainerFoundation_JS" under the "Variables" in the Heirarchy of the Object Pallete of the Adobe Form.
This step is mandatory to use the SUBMIT Button of the "WebDynpro Native", to trigger the OnSubmit event of the WebDynpro.
Thanks
Edited by: shailendra2sap on Mar 6, 2009 12:24 PM -
Search Help on Adobe Interactive Form with Web Dynpro ABAP
Hi All,
I have created Adobe Interactive Form with ZCI type and XML based interface type using Webdynpro ABAP.
I placed a text field USER_NAME on the form ( data element is linked to search help USER_COMP ).
Added Native WD UI element 'Value Help' to form to search for users and changed script
*var fieldName = "INSERT_NAME_HERE*"; to var fieldName = "USER_NAME";
The problem is that when I click on the value help button, nothing happens.
Is any more additional steps required ?
Thanks
KaruHello
Check this
F4 Value Help on Adobe Interactive Form with Web Dynpro ABAP
Thanks
Anirudh -
Can't open libHaru-generated PDF with Reader, other readers work.
Our application uses libHaru to export PDF images. These PDFs can be opened using PDFlite on Windows, Preview on Mac and some other readers. However, I have tried several versions of Adobe Reader on both platforms and the files fail to open with the message: "There was an error processing a page. There was a problem reading this document (14)." So, it seams that Adobe Reader believes that there is problem with this file. However, from my very limited understanding of PDF structure, I have no idea what might be wrong, so I don't know how to fix it. The file is written unencrypted. It is about as simple a PDF as we can generate - a red-filled rectangle. I would greatly appreciate any suggestions or help.
Here is a sample PDF:
%PDF-1.3
%∑æ≠™
1 0 obj
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/Kids [ 4 0 R ]
/Count 1
>>
endobj
3 0 obj
<<
/Producer (Haru Free PDF Library 2.3.0-dev)
>>
endobj
4 0 obj
<<
/Type /Page
/MediaBox [ 0 0 236 207 ]
/Contents 5 0 R
/Resources <<
/ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
/Pattern <<
/Type /Pattern
/PatternType 1
/PaintType 2
/TilingType 2
/BBox [ 0 0 100 100 ]
/XStep 100
/YStep 100
>>
>>
/Parent 2 0 R
>>
endobj
5 0 obj
<<
/Length 6 0 R
>>
stream
1 0 0 -1 -118 296 cm
1 w
0 0 0 RG
[] 0 d
1 0.3 0.3 rg
q
% Rect
119.25 90 m
352.5 90 l
352.5 294.75 l
119.25 294.75 l
119.25 90 l
h
B
Q
endstream
endobj
6 0 obj
135
endobj
xref
0 7
0000000000 65535 f
0000000015 00000 n
0000000064 00000 n
0000000123 00000 n
0000000188 00000 n
0000000458 00000 n
0000000647 00000 n
trailer
<<
/Root 1 0 R
/Info 3 0 R
/Size 7
>>
startxref
666
%%EOFYou would need to post a sample PDF that demonstrates the problem. All you posted there is text. (PDF is a BINARY file format)
From: Adobe Forums <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Date: Thu, 13 Oct 2011 11:02:42 -0700
To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
Subject: Can't open libHaru-generated PDF with Reader, other readers work.
Can't open libHaru-generated PDF with Reader, other readers work.
created by Fred Snerd<http://forums.adobe.com/people/Fred+Snerd> in PDF Language and Specifications - View the full discussion<http://forums.adobe.com/message/3969828#3969828 -
Exception occured when deploying in Visual Composer with web dynpro mode
Hi,All
when I deploy application in visual composer with web dynpro mode, exception occured as following, please help me.
Thanks.
best regards
Jiande Ding
The initial exception that caused the request to fail, was:
com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to prepare application sap.com/tcwd4vcengineconfigstd for startup. Reason= Clusterwide exception: Failed to start application sap.com/tcwd4vcengineconfigstd: The referenced application sap.com/tcwd4vccorestdinfoactors cannot be started. Check the causing exception for details. Hint: Is the referenced application deployed correctly on the server?
at com.sap.engine.services.webdynpro.WebDynproContainer.prepareStart(WebDynproContainer.java:1494)
at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:223)
at com.sap.engine.services.deploy.server.application.StartTransaction.prepareLocal(StartTransaction.java:176)
at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesLocal(ApplicationTransaction.java:365)
at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:132)
... 8 more
Edited by: Jiande Ding on Nov 4, 2008 1:08 PMHi
Check out this link
http://help.sap.com/erp2005_ehp_03/helpdata/EN/7c/9ce742bdab5604e10000000a155106/frameset.htm
Thanks -
Upload a file in KM repository with Web dynpro for abap
Hi gurus, i´m trying to create a KM repository and then upload a file into this repository with Web dynpro for abap , but i can´t find any info. Can anyone help me with this problem, i have to solve it ASAP...
Thanks for all....
Regards,
Diego.Please referr to the ideas on this thread.
Install Problems withe the NW04s ABAP Trial verssion
You have installed the loopback adapter and made the propriate entries in the hosts file, right?
Regards,
Rich Heilman -
Full ABAP Edition-Trial (with Web Dynpro for ABAP) Max DB data volume
I recently installed Full ABAP Edition-Trial (with Web Dynpro for ABAP)- SPS08.
http://static.flickr.com/89/243544270_91e713e3a3_o.jpg
as you can see, it's already 92% acquired ( just after installation)
Is it correct?
or it's better to add another volume?
The other question is
according to the license installation guide,
it sounds like we can delete the temp licese with SAP*.
so I did like that but i got the following message
http://static.flickr.com/81/243546622_bc99d1af2b_o.jpg
Well, I could delete the old license with BCUSER.
Thanks,
DavidHello,
to your first question.
The MaxDB database has a feature which can
increase the database automatically.
This ( auto_extend ) is turned on for the SDN Preview
installation.
That means the database should extend a further datavolume
automatically when the filling level gets over 90%.
In your case the database already added two more datavolumes. The installation only creates one.
Best regards, Stefan -
Business Graphics with Web Dynpro?
Hello @ all,
I have got a question about displaying dashboards and other charts on mobile devices using SAP Technology.
1) Does someone know, when it will become possible to display BusinessGraphics in Mobile Devices like BlackBerry, Pocket PC a.s.o buildt with Web Dynpro?
2) Which Technology can I use instead of Web Dynpro? Does it make sense to use HTMLB or should we use non SAP Products like "JFree Chart" for J2EE applications specially buildt for Mobile Devices?
Thank you for any hints!
MehmetHi Memhet!
You can use Business Graphics with Web Dynpro with version NWDS 2.0(we are in was 6.40)and could be displayed on mobile devices.We use Symbol devices.I am not sure abt Blackberry.Is that your question? OR Are you looking for some alternate solution to WebDynpro.Is that because you have some limitations in running your WD applications in mobile devices?Just trying to understand......
Thx
Gisk
Message was edited by: Sivakumar Ganesan(Gisk)
Message was edited by: Sivakumar Ganesan(Gisk)
Message was edited by: Sivakumar Ganesan(Gisk) -
Dynamic radio button in web dynpro abao
Hi expert,
I want to dynamic radio button by web dynpro abap .
Kindly give me a soulation ASAP.
Thanks and regard's
Vikashhi,
method wddomodifyview .
if first_time eq abap_true.
data: LR_CONTAINER type ref to CL_WD_UIELEMENT_CONTAINER,
LR_RADIOBUTTON1 type ref to CL_WD_RADIOBUTTON,
LR_RADIOBUTTON2 type ref to CL_WD_RADIOBUTTON,
LR_FLOW_DATA type ref to CL_WD_FLOW_DATA.
" bind text property will give TEXT that appears next to Radio Button
CALL METHOD cl_wd_radiobutton=>new_radiobutton
EXPORTING
bind_selected_key = '01'
BIND_TEXT = 'saurav'
receiving
control = LR_RADIOBUTTON1.
" bind text property will give TEXT that appears next to Radio Button
CALL METHOD cl_wd_radiobutton=>new_radiobutton
EXPORTING
bind_selected_key = '02'
BIND_TEXT = 'mago'
receiving
control = LR_RADIOBUTTON2.
LR_FLOW_DATA = CL_WD_FLOW_DATA=>NEW_FLOW_DATA( element = LR_RADIOBUTTON1 ).
LR_FLOW_DATA = CL_WD_FLOW_DATA=>NEW_FLOW_DATA( element = LR_RADIOBUTTON2 ).
LR_CONTAINER ?= view->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER' ).
LR_CONTAINER->ADD_CHILD( LR_RADIOBUTTON1 ).
LR_CONTAINER->ADD_CHILD( LR_RADIOBUTTON2 ).
endif.
endmethod.
Thanx.
Maybe you are looking for
-
Error installing Nokia Suite! Need help.
Hello everybody, I am trying to install Nokia Suite on my laptop, running on Windows 7 64 bit. I downloaded two different install files from http://www.nokia.nl/support/software/nokia-pc-suite/download . First I selected my phone (N97) and then downl
-
Having trouble with if else when used with event.value... please help
Please can someone shed any light on where i'm going wrong. I have a pdf form that uses a drop down menu for the SubBrand and a series of checkboxes for the Location. the following code is placed as a custom calculation script in an address text fiel
-
Ipad mini is frozen with connect to itunes picture have tried reset several times, no luck
New update for iOS, ipad froze mid stream. Has an itunes logo and connection cord picture. Cannot reset, tried reconnecting to iTunes, and it doesn't recognize the ipad. Any other ideas?
-
Can I write or mark on a picture before printing it?
Hello, Is there a way to write or draw on a picture using iphoto? I need to put some arrows and numbers to reference different spots in the picture. Thanks Bobejoe
-
MSI FX5200 128MB Personal Cinema problems
Greetings from Sweden. I had problems with a jerky video picture. That problem was solved for the most part by adjusting the horozontal and vertical video motion values. I should add that when I turned off the sound card completely in the BIOS, the v