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 AM
For 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
Similar Messages
-
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 -
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 ). -
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. -
Generate Adobe Interactiveform pdf using Web Dynpro Java API.
I created pdf form by using standard "InteractiveFormElement" and it is displaying correctly in browser.
Now there is a requirement to provide url link to the same pdf that is displayed with InteractiveFormElement. To generate pdf, I was doing something the below.
//Copied XDP file from the srcconfigurationcomponents<package><file>.xdp
//to srcmimiescomponents<package><file>.xdp
try {
templateUrl = WDURLGenerator.getWebResourceURL(
wdComponentAPI.getDeployableObjectPart(),
"CompView_InteractiveForm.xdp");
} catch (WDURLException e) {
IWDPDFDocumentCreationContext pdfContext =
WDPDFDocumentFactory.getDocumentHandler().getDocumentCreationContext();
pdfContext.setData(
WDInteractiveFormHelper.getContextDataAsStream(wdContext.nodeDataNode()));
pdfContext.setTemplate(templateUrl);
IWDPDFDocument pdf = null;
try {
pdf = pdfContext.execute();
} catch (WDPDFDocumentRenderException e) {
wdComponentAPI.getMessageManager().reportException(
"pdfContext.execute() " + e.getLocalizedMessage(), false);
IWDPDFDocument.execute() is raising exeception "Template used in PDF render
operation is invalid or cannot be found". template url is indeed correct. I checked by
assigning to that url to linkToUrl Element and opening the xdp file.
Please help me to identify the issue. Thank you.Hi Ajay,
Use getResourcePath instead of getWebResourceURL
templateUrl = WDURLGenerator.getResourcePath(
wdComponentAPI.getDeployableObjectPart(),
"CompView_InteractiveForm.xdp");
Thanks
Ram -
Hi all gurus.
I developed a Web Dynpro application to let the users create their own sales orders.
Now I need to let them print the orders when they need to. Searching on the documentation I have, I've never found anything about crating a pdf print from the WD Application.
There must be a way, because I managed to do that even with the very old ITS (the one in which you had to write HTML code...) but i cannot find how.
Can anyone help me please? Even a tutorial would be very appreciated.
Thank you in advance...>
horatiusx wrote:
> Hi all gurus.
>
> I developed a Web Dynpro application to let the users create their own sales orders.
>
> Now I need to let them print the orders when they need to. Searching on the documentation I have, I've never found anything about crating a pdf print from the WD Application.
>
> There must be a way, because I managed to do that even with the very old ITS (the one in which you had to write HTML code...) but i cannot find how.
>
> Can anyone help me please? Even a tutorial would be very appreciated.
>
> Thank you in advance...
You need a Smartform, SAPScript, or AdobeForm to be defined for your output. Define an action/method for print, then pass the data to your Form. SmartForms are not bad, as SmartForms generate a Function Module, and are easy to call.
Call the SmartForm Function with PDF output = 'X' (parameter within Output Control I think). Then pass the PDF_DATA[] table (type = TAB_SOLIX) to a new window output .
Don't have the code in front of me, but have done it several times.
Adobe Forms is another good option, but you need Adobe Server, and generally I have found ADOBE to be SLOOOOOWWWWW. I think Steve Jobs might have been on to something with ADOBE -- just my opinion.
And of course, it can be done with SAPSCript, but I would need a whole blog on how to do that..... -
Mass upload & Download of PDFs in Web Dynpro ABAP
Hi All,
Is it possible to download multiple PDF's at one go ? for example if you have a Table UI control where each row has one clickable link that generates a PDF using WebDynpro ABAP Application, we want to enable multiselect property of Table UI and provide Mass Download Button control on click of which all selected rows should generate PDF and then get dowloaded to a specific location on machine (c:/). or if there is any other alternative possible ?similarly for Mass Upload we wish to multi select PDFs and upload them to R/3 at one go ?
please let me know if such thing is possible ? if yes is it a good option to have ? as we have users who have to upload these PDF one by one and they wish if they could simply select all PDFs at one go and click Mass upload..Note that there are some validation that we perform once we upload PDF before posting PDF data to backend.
your help & comments would be Highly Appreciated !!
Thanks
Asif>
Maged Ishak wrote:
> Hi Thomas,
>
> could you give me an example how can i download multiple objects without multiple prompts with the class CL_ABAP_ZIP. I use a Web Dynpro for ABAP and I have for Example many word file and i want to download all file in one ZIP-File.
> thanks in advance
> mishak
You simply use the CL_ABAP_ZIP class to combine the multiple binary strings of the word files together.
data izip type ref to cl_abap_zip.
data zip_xstring type xstring.
create object izip.
loop at ifiles assigning <Wa_file>.
izip->add( name = <wa_file>-filename
content = <wa_file>-filecontent ).
endloop.
zip_xstring = izip->save( ). -
Print Version PDF in Web Dynpro ABAP Developements
Hi!
But when we push the print button, it works but doesn't generate the pdf document correctly.
alvexport.pdf 1 bytes_ the size of the document isn't correct because there is not content inside.
Best Regards.>
Gabriel Rodriguez Jimenez wrote:
> I put this direction to verify de ADS
>
> http://maep7java.miquel.es/AdobeDocumentServices/Config?style=rpc
>
> making a rpc test "works"
>
>
> The test conection in sm59 ADS works
>
>
> Also check to see if any of the sample AdobeForms WDA applications are working. <-- where I can check this?
>
>
> Thanks
The connection test in SM59 only does a basic PING to the web service endpoint. Often it will show OK, when in fact the ADS is not setup correctly. That is why there are some test applications that do more.
For proper testing of your setup see OSS Note 944221. But basically run the ABAP programs FP_PDF_TEST_00 and FP_CHECK_DESTINATION_SERVICE. You can also try running the web dynpro components WDR_TEST_ADOBE and WDR_TEST_ADOBE_PDF_ONLY -
Smartform as PDF in Web Dynpro for ABAP
Hello Experts,
I have developed one Web Dynpro application in which i am trying to show PDF converting from smart from on button click.
I am seeing blank screen when i try to display PDF? But when i check i debugging data passed successfully to context element.
PDF source property mapped to review context element.
I used below code to show PDF in view method:
call function 'SSF_FUNCTION_MODULE_NAME'
call function lv_fm_name
call function 'SSFCOMP_PDF_PREVIEW'
call function 'CONVERT_OTF'
elem_pdf->set_attribute(
exporting
name = `SOURCE`
value = data ).
Thanks
Rajesh YadlaLooks quite alright, but since you only have provided a few function modules, there is 'no' way of telling what is going wrong. I can however give you a link and compare your coding with the one from the tutorial:
[How to display a smartform as PDF in WD4A|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785] -
After SP upgrade, pdf in web dynpro could not display dollar symbol
Dear Experts,
We have updated the following support packages:
SAP_BASIS 14-18
SAP_ABA 14-18
PI_BASIS 14-18
SAP_BW 15-20
SAP_AP 12-15
EA-HR 23-61
SAP-HR 23-61
E-RECRUITMENT 18
After that, Some webdynpro for abap which used PDF report has some errors, which dollar could not be displayed, which indicates some kind of error 'o'.
We check that the pattern is of this column is from old version :num{$zzz,zzz,zz9.99} to num{($z,zzz,zz9.99)} . How could we deal with this ? And where could I find the related influence of the SP upgrade of adobe and web dynpro?
Thanks & Best Regards,
DerekChris,
You may be right. Also it requires some configuration in SAP KPro ( document class etc).
Please see SAP [Help |http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVBDS/BDS_STRUCTURE.pdf]on Business Document Services.
At page 64 of this document under topic 'Display Documents' 'Feature it says. "If it is not possible to display the document in place, an appropriate viewer that is available on the
PC is started and the document is displayed u201Cout placeu201C -
How to display pdf in Web Dynpro Page
Hi Experts,
I need to display the pdf file in web dynpro page. I am using Web dynpro 7.1(CE), in that no ui element like Iframe. With Iframe we can display the pdf file in web Dynpro page in 7.0.
But My problem is how display pdf with out using Iframe.
Please any one tell how to display with any other UI elements.
Regards,
Sunil.Hi sunil..
chk this link..
<u><b>Pdf</b></u>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0401535-f81c-2a10-0192-ffd41e8e8d59
<u><b>Adobe</b></u>
/people/achim.hauck/blog/2005/02/04/my-struggles-with-the-adobe-document-services-in-was640
<u><b>Configuration</b></u>
http://help.sap.com/saphelp_nw70/helpdata/en/43/8a1a8ece230c8ce10000000a11466f/content.htm
<u><b>Adobe Document services</b></u>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9e4e9afb-0701-0010-f8a8-b8cd093662c2
<u><b>Configuring Guided procedure of Interactive Forms</b></u>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b9ea34c2-0701-0010-e2a2-d8e9cd6d85dc
<u><b>Forum Discussions abt Adobe Document Services</b></u>
Re: Configuring the Destination URL for the Adobe Document Services
Hop will this helpful for u..
Regards,
GS -
Display archive doc as pdf from web dynpro?
Hi All,
We have a situation where we want to display archived pdf's from a web dynpro. I have put an interactive form ui element on my view and bound this to an attribute of type xstring on the context.
When I run it, i get an error message saying that file does not begin with '%PDF-'. I've tried putting this on the front of the string but i didn't work either.
So can anyone tell me the process for displaying archived pdf's from a web dynpro.
Many thanks in advance,
Liz.This is the code necessary to get it to work:
get optical archive id of pdf to display
select single * from toahr into ls_toahr
where sap_object = 'PREL'
and OBJECT_ID = lv_obj_id
and ar_object = ls_zhr_paylsip-zhr_doc_type.
lv_archiv_id = 'H1'.
lv_document_type = ls_toahr-ar_object.
lv_archiv_doc_id = ls_toahr-arc_doc_id.
lv_signature = 'X'.
lv_compid = 'data'.
free lt_binarchivobject.
call function 'ARCHIVOBJECT_GET_TABLE'
exporting
archiv_id = lv_archiv_id
document_type = lv_document_type
archiv_doc_id = lv_archiv_doc_id
ALL_COMPONENTS =
signature = lv_signature
compid = lv_compid
importing
length = lv_length
binlength = lv_binlength
tables
archivobject = lt_archivobject
binarchivobject = lt_binarchivobject
exceptions
error_archiv = 1
error_communicationtable = 2
error_kernel = 3
others = 4.
if lt_archivobject[] is not initial.
describe table lt_archivobject lines lv_rowcount.
lv_rowcount = lv_rowcount * 1024.
call function 'SCMS_BINARY_TO_XSTRING'
exporting
input_length = lv_rowcount
first_line = 1
last_line = lv_rowcount
importing
buffer = lv_xstring
tables
binary_tab = lt_binarchivobject
exceptions
failed = 1.
endif.
Where yo bind lv_xstring to the the pdfSource via the context -
ADT: Web Dynpro view/window error "Failed to create the part's controls"
Hi, all
Most of the things in my ADT work fine (e.g. programs, structures, domains), even the Web Dynpro Componentcontroller can be edited.
However, with Web Dynpro view and window I get this error message: "Failed to create the part's controls".
In SAP GUI everything works fine.
Why could this happen and what can I do?
My system details:
32-bit Windows 7
Eclipse Luna Release (4.4.0)
ADT from https://tools.hana.ondemand.com/kepler, according to these instructions: SAP Development Tools for Eclipse.
SAP GUI 7.30, patch level 9.
SAP_ALL authorizations
Java: SE, version 7 update 60
Activated services (SICF): wdy_aie_vd_preview, toolsdocu, docu
The Java error log in Eclipse is quite long. It starts with:
java.lang.IllegalStateException: java.lang.IllegalArgumentException: No enum constant com.sap.adt.wda.controller.semanticfs.common.ControllerFileServices.ControllerObjectTypeEnum.WDYNWZ
at com.sap.adt.tools.core.ui.editors.AdtFormEditor.addPages(AdtFormEditor.java:222)
at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:138)
at com.sap.adt.tools.core.ui.editors.AdtFormEditor.createPages(AdtFormEditor.java:1251)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:362)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:140)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:99)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:321)
at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
As it is not popular to post long logs unnecessarily, I will skip the rest of it for the moment - let me know if it could help and I will post it.
Thanks for help!
KR,
IgorHi Ponraj,
note applied without any problem.
I'm still facing some difficulties accessing a WD component, maybe you could suggest me how to solve/proceed:
in Eclipse Luna, I can access now a WD but "Layout" tab doesn't work - HTTP 403 Forbidden - Service cannot be reached. I guess it's a missing configuration, could you help me out on this?
EDIT: This one is solved; I just missed to activate a service in SICF (WDY_AIE_VD_PREVIEW).
That Eclipse module however seems not to be very stable; I tried to open a standard SRM WD view (wd component /SAPSRM/WDC_DO_SOCO_GAF_1, view V_AO_SOCO_GAF_1) and that resulted in the message:
500 SAP Internal Server Error
ERROR: Conversion of type C LENGTH 255 to type TABLE OF DEEP_STRUCTURE not supported. (termination: RABAX_STATE)"
is there a way, from the Methods tab, to access directly to a particular method's implementation? The only way I found is going manually under the IMPLEMENTATION tab and CTRL+F with the method's name.
is there any way to access to a particular enhancement made on the WD? Using SapGUI, there's a special "vortex" button to switch on a specific enhancement, but under Eclipse I can't find the alternative command.
I know we're getting a bit OT with respect to the topic, anyway if there's a guide that could help clarifying my doubts please, share that documentation
BR,
M. -
Creating and Edit Order in Web Dynpro (seperate window or view?)
Hi,
I have just done with Web order creation in web dynpro and is going to start on Edit now. Should I have a seperate window for Edit or should I put it together in the same window as Create order?Hi Jackson,
Most of the time for such kind of requirements it is generally prefer to have a seperate view for edit and that is being called using the plugs from the main screen.
The flow will be like this:
View 1 (main View having data, Fieds for editing are disabled) -
> Fires Plug to Edit view -
> Edit View ( With all fields enabled which you want for editing).
In kind of a design the main advantage is, you can directly keep the required nodes in the component controller and map these nodes in main view and edit view, both. Without even caring for any data flow.
Data flow will be automatically be taken care by the component controller. The only one thing which needs to be handled is the UI elements enable and disable property. Because in the case of the main view you need to keep the disbale property of most of the UI element as True (as you don want user to edit anythign in this main view). In the edit view the disable property of same UI elements will be set to False, as used can edit any thing in this edit view.
If you keep this kind pf approach one more added advantage is that you can pass various parameters in the plug function. So if you want to handle something on the bases of sone flag etc then you can pass those parameters in the plug method.
However, as replied earlier, the decision is purely based upon your requirement. If the requirement is to show the edit screen as a Pop-up then you can help it!! Go with it..
I hope this will solve your issue. Please revert back if you need any other information.
Thanks and Regards
Pravesh
Maybe you are looking for
-
iphone has been in recovery mode for 4 hours and hasn't come back to the home screen and how can i fix this and get it back to working order? the iphone 4S has been in recovery mode for a long time and i have tried to press and hold the power and hom
-
Dear All Is it possible to see the Vendor balances Account Group wise. The user wants to only enter the Vendor Account Group which he gave during configuration and wants a report based on that Account Group... Thanks & Regards Kanwaljit
-
Fresh install of Arch (after much head banging :>), followed the guide from start to finish (EFI install) but after installing xorg I can't start it. Adapter 04:03.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0
-
Hi, I have created a sample ear with the ejb archive & the web archive & deployed to the J2ee engine. I have a jsp in the web module. What is the url i need to give to access this from the browser? Thanks in advance
-
Connection Between Two Databases
Hi, I have two databases called DBS1 and DBS2. Both are in one system. I need link between these two databases. I want a query as follows. select * from cust@DBS2; # from DBS1 select * from temp_cust@DBS1; # from DBS2 Is possible link between DBS1 an