on 05-02-2006 8:49 AM
Hi All,
I want to display a smartform pdf output generated in SAP CRM using a Webdynpro application.
1. I have created a custom RFC to provide smartform pdf output in internal table(TLINE) format.
2. I have problems converting this data to pdf in Webdynpro.
Any sort of help is appreciated.
Thanks,
Anil
Hi Nagaraju
First lots of thanks for cliarifying the doubts. But the problem i s
Mycode in this regard is not working. I have still some doubts in this answer. Can you please give me your contact number or your AOL id or any chat id or any personal id please. It is very urgent to discuss with you.
Kindly give me these details.
Lookingforward to you
regards
jalandhar.
1)executeZquote_Writer_Input(); This will be related to Bapi he is going to call to execute a smartform.
2) just explain me this bit of code
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder ().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
He is getting the bin file from the context which is filled after Bapi call.
3) In this code where i have to mention the SMARTFORM name
In SAP systems whenever a smartform is created, a function module related to that smartform will be created automatically.
Executing a smartform means executing that function module.And that function module is not remote enabled.
Each function module generated will have different interfaces depending up on the parameters used in the smartform.
So a remote enabled Function module need to be written in which smartform related FM can be called.
Smartform name will be used in the RFM written by us.
You can pass that name to this RFM through interface or you can hard code it there.
4) Where u r mentioning the smartform name explain me
He is doing it in the RFM written by them.
So you cannot see that Web Dynpro code.
Hope this will be helpful.
Regards,
Nagaraju Donikena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anil
can you please clarify these doubts in you below code
1) What are the mandatory input and output parameters
I have to pass here in this code to my application
2) please check my previous post also in this regards please
Looking for you. Please reply at the very earliest.
-
Convert smartform output in to PDF using CONVERT_OTF function module and you can write pdf using parameter 'binfile' of this function in WebDynpro using the following code:
It is copied from my prg. I hope you understand it.
public void onActionGetQuote(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionGetQuote(ServerEvent)
wdThis.wdGetOppt_QwriterCustController().executeZquote_Writer_Input();
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
{
try
{
String pdfResoucePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), fileName);
FileOutputStream fileOutputStream = new FileOutputStream(new File(pdfResoucePath));
PrintStream ps = new PrintStream(fileOutputStream);
ps.print(pdfOutput);
ps.close();
//Display the PDF to the browser
String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), fileName);
IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileURL, "Pdf Browser", false);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.MENU_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.open();
// To collect all the file created in the server by user
quoteFiles.add(quoteFiles.size(), pdfResoucePath);
} catch (Exception e)
{
throw new WDRuntimeException(e);
}
}
//@@end
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anil
This is regarding my requirement , i have to display a smartform output in webdynpro. Your code is helpful to me, you will be rewarding full points. I have
doubts in this code, can you please clarify them.
1) executeZquote_Writer_Input(); -> is this is a built in function or we have to write some thing in that
2) just explain me this bit of code
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder ().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
3) In this code where i have to mention the SMARTFORM name
4) Where u r mentioning the smartform name explain me
please reply asap
regards
jalandhar.
Convert smartform output in to PDF using CONVERT_OTF function module and you can write pdf using parameter 'binfile' of this function in WebDynpro using the following code:
It is copied from my prg. I hope you understand it.
public void onActionGetQuote(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionGetQuote(ServerEvent)
wdThis.wdGetOppt_QwriterCustController().executeZquote_Writer_Input();
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
{
try
{
String pdfResoucePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), fileName);
FileOutputStream fileOutputStream = new FileOutputStream(new File(pdfResoucePath));
PrintStream ps = new PrintStream(fileOutputStream);
ps.print(pdfOutput);
ps.close();
//Display the PDF to the browser
String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), fileName);
IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileURL, "Pdf Browser", false);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.MENU_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.open();
// To collect all the file created in the server by user
quoteFiles.add(quoteFiles.size(), pdfResoucePath);
} catch (Exception e)
{
throw new WDRuntimeException(e);
}
}
//@@end
}
***************************************
and then delete the file in resources when u close window.
public void wdDoExit()
{
//@@begin wdDoExit()
if (quoteFiles.size() > 0)
{
for (int i = 0; i < quoteFiles.size(); i++)
{
String filePath = quoteFiles.get(i).toString();
if (filePath != null)
{
try
{
File file = new File(filePath);
file.delete();
} catch (Exception fe)
{
throw new WDRuntimeException(fe);
}
}
}
}
//@@end
}
Cheers,
Anil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jalandhar,
1)executeZquote_Writer_Input(); This will be related to Bapi he is going to call to execute a smartform.
2) just explain me this bit of code
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder ().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
He is getting the bin file from the context which is filled after Bapi call.
3) In this code where i have to mention the SMARTFORM name
In SAP systems whenever a smartform is created, a function module related to that smartform will be created automatically.
Executing a smartform means executing that function module.And that function module is not remote enabled.
Each function module generated will have different interfaces depending up on the parameters used in the smartform.
So a remote enabled Function module need to be written in which smartform related FM can be called.
Smartform name will be used in the RFM written by us.
You can pass that name to this RFM through interface or you can hard code it there.
4) Where u r mentioning the smartform name explain me
He is doing it in the RFM written by them.
So you cannot see that Web Dynpro code.
Hope this will be helpful.
Regards,
Nagaraju Donikena
Regards,
Nagaraju Donikena
Hi
Can you please let me know if you hace solved this issue.
Me too require a similar kind of solution.
Thank you
With Wishes
Krishna Kanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Krishna,
Convert smartform output in to PDF using CONVERT_OTF function module and you can write pdf using parameter 'binfile' of this function in WebDynpro using the following code:
It is copied from my prg. I hope you understand it.
public void onActionGetQuote(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionGetQuote(ServerEvent)
wdThis.wdGetOppt_QwriterCustController().executeZquote_Writer_Input();
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
{
try
{
String pdfResoucePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), fileName);
FileOutputStream fileOutputStream = new FileOutputStream(new File(pdfResoucePath));
PrintStream ps = new PrintStream(fileOutputStream);
ps.print(pdfOutput);
ps.close();
//Display the PDF to the browser
String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), fileName);
IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileURL, "Pdf Browser", false);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.MENU_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.open();
// To collect all the file created in the server by user
quoteFiles.add(quoteFiles.size(), pdfResoucePath);
} catch (Exception e)
{
throw new WDRuntimeException(e);
}
}
//@@end
}
***************************************
and then delete the file in resources when u close window.
public void wdDoExit()
{
//@@begin wdDoExit()
if (quoteFiles.size() > 0)
{
for (int i = 0; i < quoteFiles.size(); i++)
{
String filePath = quoteFiles.get(i).toString();
if (filePath != null)
{
try
{
File file = new File(filePath);
file.delete();
} catch (Exception fe)
{
throw new WDRuntimeException(fe);
}
}
}
}
//@@end
}
Cheers,
Anil
Hi Anil,
Thanks for the code. I am trying to do the samething. Displaying Smartform PDF in WebDynpro. I have some questions on your code here. Can you please tell me about the function module that brings PDF into model. Can you please tell me more about the Output parameters/table parameters and their types you used.
I think the statement String pdfOutput = new String(wdContext.currentOutputElement().getBinfile()); is the one that contains the PDF file. If so can you please tell me more about the binfile type in backend? Is it XSTRING?
Please help me with this.
thanks in advance.
Sudha.
Hi Anil,
I am trying to display the smartform stored in SAP from webdynpro java. I am getting the binfle from the BAPI. I have implemented the codes provided by you but while running the application I am getting the null pointer exception.I am not able to retrieve the backend data.Can you provide with any possible solution for that.
Looking forward to the reply.
Regards,
Pawan
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.