cancel
Showing results for 
Search instead for 
Did you mean: 

Display PDF from BAPI in Webdynpro

Former Member
0 Kudos

Hi all,

I have a BAPI that returns a PDF file as a TLINE table, and I need to display the result in a Java Webdynpro, do you guys know how I can do that? Thank you in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello SAPer

The TLINE table is not basically a PDF file but an OTF file. I suggest you to call one more BAPI 'Convert_OTF' that takes this TLINE table as input and returns a pdf_file.

Then in JAVA Web Dynpro, use the following code in your action handler after calling the respective RFC :-

byte[] pdfContent;

String pdfFileName = null;

pdfContent = wdContext.current<Bapi_name_OutputElement>().getE_Pdf_File();

pdfFileName = "<name>"

IWDCachedWebResource pdfResource= WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);

try

{

wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),pdfFileName,true).open();

} catch (WDURLException e)

{

msgMgr.reportException(e.getMessage(),false);

}

I hope this helps you.

Regards

Kapil.

Former Member
0 Kudos

Hi Kapil,

Thank you for your reply. I am aware of the Convert_OTF function, but the problem is that it returns an XSTRING, and BAPIs can't return XSTRINGs, you can't even wrap them in a structure ://

Have you already used an RFC for this? can you please give the FM signature?

Best regards,

Issam

Former Member
0 Kudos

The FM signature for the RFC that we used are as follows :

FUNCTION z_sm_epcp_bapi_get_packing_pdf.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_RMA_NUMBER) TYPE ZSM_DTE_EPCP_RMA_ORDER_NUMBER

*" EXPORTING

*" VALUE(E_PDF_FILE_SIZE) TYPE I

*" VALUE(E_PDF_FILE) TYPE XSTRING

*" TABLES

*" CT_GET_PACKING_PDF_RETURN STRUCTURE BAPIRET2 OPTIONAL

I hope this helps you.

Regards

Kapil

Former Member
0 Kudos

Tried to add the RFC with the same signature to a BAPI object, but it does not accept the XSTRING parameter ://

Former Member
0 Kudos

Hi,

If I am not wrong, you get the data of the PDF file in TLINE Table right?

Consider this solution only if my interpretation is right...

See, in this concern, you got to create a UI Element - Adobe Form and mention the data source as this TLINE.

And design this Adobe Form as per your format.

I hope this should help.

Regards,

<i><b>Raja Sekhar</b></i>

Former Member
0 Kudos

Thank you Raja for your reply. Actually I don't want to design a an interactive form, it's just a static PDF file (generated from a smartform), and yes it is returned in a TLINE table. We don't have the ADS installed on the server, so I can't use the UI element Adobe form. Do you have another idea?