How can I call remote ejb through jsp?(null)
Trying the code:
<%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
<%
int h=8;
int w=8;
Hashtable p = new Hashtable ();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
Context ctx= new InitialContext(p);
Object homeref = ctx.lookup("si3.test");
addHome home = (addHome) PortableRemoteObject.narrow(homeref, addHome.class);
add the_ejb = home.create();
out.println(the_ejb.add(h,w));
out.println("adf");
the_ejb.remove();
%>
yzj wrote:
> I have two server running weblogic5.1.
> If the jsp and ejb locate the same server running weblogic 5.1 ,works well .But one deploys the ejb (jndi name si3.test),the other runs the jsp.I use jsp call the remote ejb ,catch exception :
>
> GMT+08:00 2000:<E> <ServletContext-General> Root
> > cause of ServletException
> > javax.naming.NameNotFoundException: 'si3.test'; remaining name 'si3.test'
> > at
> > weblogic.jndi.toolkit.BasicWLContext.resolveName(BasicWLContext.java,
> > Compiled Code)
> > at
> > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:133)
> > at
> > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:574)
> > at javax.naming.InitialContext.lookup(InitialContext.java:349)
> > at jsp_servlet.client._jspService(client.java:90)
> > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> > at
> > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
> > :124)
> > at
> > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
> > l.java:744)
> > at
> > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
> > l.java:692)
> > at
> > weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
> > Manager.java:
> > 251)
> > at
> > weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
> > at
> > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
> > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
> > Code)
>
> Why? Can you help me? Thanks.
> The jsp's source(Client.jsp ):
> <%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
> <%
> int h=8;
> int w=8;
> Hashtable p = new Hashtable ();
> p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
> p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
> Context ctx= new InitialContext(p);
> addHome home = (addHome) ctx.lookup("si3.test");
> add the_ejb = home.create();
> out.println(the_ejb.add(h,w));
> out.println("adf");
> the_ejb.remove();
> %>
>
>
[att1.html]
Similar Messages
-
How can i call shell command in JSP?
My OS is Linux, and my WWW server is Tomcat,
can i call shell command , such as gcc or setup,
If yes, how can i? Would you give a source example?
Thank you!Hi,
I did this simple class to launch a process and after the cose there is an example to use it:
import java.io.*;
import java.util.*;
public class ProcessExec {
private String[] command;
private StreamGobbler errorGobbler;
private StreamGobbler outputGobbler;
public ProcessExec() {
public ProcessExec ( String[] command) {
this.command = command;
this.errorGobbler = null;
this.outputGobbler = null;
public String[] getCommand() {
return ( this.command );
public void setCommand( String[] command ) {
this.command = command;
public void exec() {
try{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(this.command);
// any error message?
errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
// any output?
outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
// kick them off
errorGobbler.start();
outputGobbler.start();
}catch (Throwable t){
t.printStackTrace();
}//catch
public String getErrorMessage() {
while ( this.errorGobbler.isAlive() ) {;}
return ( this.errorGobbler.getResult().toString() );
public String getOutputMessage() {
while ( this.outputGobbler.isAlive() ) {;}
return ( this.outputGobbler.getResult().toString() );
} // ProcessExec
Example to use it:
try {
ProcessExec pe = new ProcessExec( command );
pe.exec();
errorMessage = pe.getErrorMessage();
outputMessage = pe.getOutputMessage();
} catch ( Exception e ) {
System.out.println (e);
As you can guess the string "command" must be the command you have to launch and errorMessage and outputMessage will contain the error and the output that the process will generate.
Try it; i hope this will help you.
Cheers.
Stefano -
How can I call DLL's Through Forms5.0
I've done the following exercise for calling DLL's
I tried to put thier dll in orant/bin directory but unable to get the values from DLL. I used user_exit D2K built in function but not able to get the result..
Ex:
DLL is = api1.dll
This dll having n number of functions in that one of the function is GetUid..This contain one in parameter which will take length of userid and one out parameters which will return Userid from DLL..
The syntax I used in D2K is as follows.
First I hv put this dll in orant/bin directory
and used following syntax in D2K
user_exit('GetUID(:global.uid,20)');
But it was dispalying the msg GetUID does not exist..
I have put one entry in registry like FORM50_USEREXITS orant/bin/api1.dll.
But the same error repeats..
Please revert as to how I can go about it.
nullAssuming that you don't need to do anything with that pointer aside from pass it around, you can declare that parameter as a "ByVal Long image" in your declaration. Declare a variable (as a Long) to pass in to the image parameter.
-
HOW can I call EJB with JSP?
Hi, I'm working with JSP and want to include some EJB. I dont know how can I access EJB through JSP. I dont know if I use the right code in JSP for calling EJB. Did someone know how to use that? Can someone tell me if is the right code in JSP in my example?
Thanks, Kristjan
THIS IS THE JSP: (useejb.jsp)
<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/ejbtaglib.tld" prefix="EJB" %>
<%@ page import="mypackage1.MySessionEJB" %>
<%@ page import="mypackage1.MySessionEJBHome" %>
<%@ page import="mypackage1.impl.MySessionEJBBean" %>
<HTML>
<head><TITLE>USEBEAN</TITLE></head>
<body>
<EJB:useHome id="mySessionEJBHome" type="mypackage1.MySessionEJBHome" location="java:comp/env/ejb/mySessionEJB" local="false" />
<EJB:useBean id="mySessionEJBBean" type="mypackage1.impl.MySessionEJBBean" local="false">
<EJB:createBean instance="<%=mySessionEJBHome.create() %>" />
</EJB:useBean>
<%= mySessionEJBBean.calc() %>
</body>
</html>
THIS IS THE EJB CODE:(MySessionEJBBean.java)
package mypackage1.impl;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.lang.String.*;
public class MySessionEJBBean implements SessionBean
public void ejbCreate(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void ejbRemove(){}
public void setSessionContext(SessionContext ctx){}
public String calc(String value)
return value + value;
public String zanka(String x)
return x;
(MySessionEJB.java)
package mypackage1;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface MySessionEJB extends EJBObject
public String calc(String value) throws RemoteException;
String zanka(String x) throws RemoteException;
(MySessionEJBHome.java)
package mypackage1;
import javax.ejb.EJBHome;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
public interface MySessionEJBHome extends EJBHome
public MySessionEJB create() throws RemoteException, CreateException;
}You might want to look at using a Java Bean wrapper, this can be done automically using WebSphere. It creates what is called an access bean which the JSP imports.
HTH,
J.Clancey -
(261936172) Q general How can I access an EJB hosted on a remote server?
Q<general> How can I access an EJB hosted on a remote server?
A<general> The ability to add EJB control files enables you to access an EJB that
is deployed to the server on which your web service is running. When you select
"add EJB control" you need to supply the home and remote interfaces for the EJB
as well as the JNDI name. This does not provide you with the capability for creating
a control for a remotely hosted EJB. To use a EJB hosted on another server you
will have to provide the appropriate code within your web service itself. You
will have to programmatically gain to access the JNDI for the remote server, lookup
up the home stub and use it to create the remote stub for the EJB. Of course,
to make this work you must have the necessary client interfaces in you classpath
(home and remote interfaces) which can easliy be achieved by adding the EJB client.jar
file to the lib directory in the webservice WEB-INF folder.just define the different server path in the description xml file
<jndi-name>jnp://serverA(B)/....</jndi-name> -
How can I call a JSP Page in other Workspace?
I have two workspaces:
1. Workspace1: where is my application
2. Workspace2: where is JSP files generated by BI Beans .
How can I make reference in a JSP page in Workspace1 to a JSP page in workspace2? this is to include the JSP pages generated by BI Beans to my appliction.
Thanks in advance.Thanks Deepak but I think you don´t understand me.
I would like the include works like a normal include. I have a jsp in my application
and , when the client requests this jsp, in the jsp should be added the result
of the other jsp ejecution that belong to other application in the same domain.
Is this possible?
Thank you very much.
Deepak Vohra <[email protected]> wrote:
> A Jsp from a different application is included with a relative url to
>th=
>e Jsp.
><%@ include file=3D"relative url" %>
>
>A Jsp could be included with request parameter.
> <jsp:include page=3D'<%=3D request.getParameter("incFile") %>' />
>
>javilla wrote:
>
>> Hi,
>>
>> I'd like know if it=B4s possible to include jsp or servlet from differe=
>nt applications.
>
-
How can I deploy the EJB to the remote AP Server
Dear All,
Any one know how can I deploy an EJB to the AP server which is not located on the local machine, using Jdev9.0.3.1.
I have try to new a connection with the server name and the testing connection section is successful, however when I deploy the EJB to that connection the error comes out as following:
java.lang.InstantiationException: Illeagal values: min-instances is greater than max-instances
at com.evermind.server.ejb.deployment.BeanDescriptor.parseOrionAttribute(BeanDescriptor.java:410)
at com.evermind.server.ejb.deployment.ExposableBeanDescriptor.parseOrionAttribute(ExposableBeanDescriptor.java:352)
at com.evermind.server.ejb.deployment.SessionBeanDescriptor.parseOrionAttribute(SessionBeanDescriptor.java:260)
at com.evermind.sFatal Error: Illeagal values: min-instances is greater than max-instances
erver.ejb.deployment.BeanDescriptor.parseOrionXML(BeanDescriptor.java:423)
at com.evermind.server.ejb.deployment.SessionBeanDescriptor.parseOrionXML(SessionBeanDescriptor.java:265)
at com.evermind.server.ejb.deployment.EJBPackage.parseOrionBean(EJBPackage.java:804)
at com.evermind.server.ejb.deployment.EJBPackage.parseOrionEnterpriseBeans(EJBPackage.java:646)
at com.evermind.server.ejb.deployment.EJBPackage.parseDeploymentMainNode(EJBPackage.java:455)
at com.evermind.xml.XMLConfig.parseRootNode(XMLConfig.java:268)
at com.evermind.xml.XMLConfig.init(XMLConfig.java:147)
at com.evermind.server.ServerComponent.initDeployment(ServerComponent.java:305)
at com.evermind.server.ServerComponent.copyAndDeploy(ServerComponent.java:374)
at com.evermind.server.ServerComponent.initDeployment(ServerComponent.java:276)
at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDeployment.java:607)
at com.evermind.server.administration.ServerApplicationInstallation.finish(ServerApplicationInstallation.java:464)
at java.lang.reflect.Method.invoke(Native Method)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:80)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
Thank you very much!!Your question is a bit unclear.
If you are referring to converting from using JInitiator to JRE, pl see MOS Doc 290807.1 (Deploying Sun JRE (Native Plug-in) for Windows Clients in Oracle E-Business Suite 11i).
If you are referring to upgrading Java versions for use by EBS, pl see MOS Doc 401561.1 (Using J2SE Version 6 with Oracle E-Business Suite 11i).
MOS Doc 300482.1 (Overview of Using Java with Oracle E-Business Suite Release 11i) gives an overview of Java usage with 11i.
HTH
Srini -
Calling an EJB from jsp - ServletException
I am unable to call an EJB from jsp, unless I put the actuall classes of
the EJB into the classpath. Is this the right way to do it?
The exception is:
Servlet failed with ServletException
javax.servlet.ServletException: Servlet class: 'jsp_servlet._result'
could not be loaded - the requested class wasn't found in the
classpath:
'/local/apps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_delete/wl_local_comp34107.war:/local/apps/bea/wlserver6.0/./config/gmodomain/applications/.wl_temp_do_not_delete/WEB-INF/_tmp_war_gmo_gmo_webwar:/local/apps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_delete/WEB-INF/_tmp_war_gmo_gmo_webwar'
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:532)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:191)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:148)
at
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:306)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:246)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
where result.jsp is the jsp page calling the EJB. I did an import of the
EJB classes in the jsp.
like i said, it works if I put the bean classes in the classpath. But is
it right?
if I have these in the exploded format, do I need to put anything in the
application web.xml under:
wlserver6.0/config/gmodomain/applications/DefaultWebApp_gmo/WEB-INF ?
redhat 6.2, wl6.0sp1
here are the xml files:
web.xml:
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<!--
$Id: web.xml,v 1.2 2001/03/14 22:23:03 jeff Exp $
$Source:
/usr/local/cvsroot/JUnitEE/example/components/web-war/WEB-INF/web.xml,v
$
-->
<web-app>
<display-name>My Web Application</display-name>
<description>none</description>
<ejb-ref>
<ejb-ref-name>MyWeb</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.blah.ejb.myweb.WyWebHome</home>
<remote>com.blah.ejb.myweb.MyWeb</remote>
</ejb-ref>
</web-app>
weblogic.xml:
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web
Application 6.0//EN"
"http://www.bea.com/servers/wls600/dtd/weblogic-web-jar.dtd">
<weblogic-web-app>
<jsp-descriptor>
<jsp-param>
<param-name>
pageCheckSeconds
</param-name>
<param-value>
1
</param-value>
</jsp-param>
<jsp-param>
<param-name>
verbose
</param-name>
<param-value>
true
</param-value>
</jsp-param>
<jsp-param>
<param-name>compileCommand</param-name>
<param-value>/local/apps/jdk1.3.0_02/bin/javac</param-value>
</jsp-param>
</jsp-descriptor>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>MyWeb</ejb-ref-name>
<jndi-name>MyWeb</jndi-name>
</ejb-reference-description>
</reference-descriptor>
</weblogic-web-app>
thanks,
Gary
Did you package your JSPs in a WAR and your EJBs in a JAR and package the
WAR and JAR in an EAR? That is how to do it in 6.0. Works well.
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"gmo" <[email protected]> wrote in message
news:[email protected]...
> I am unable to call an EJB from jsp, unless I put the actuall classes of
> the EJB into the classpath. Is this the right way to do it?
> The exception is:
> Servlet failed with ServletException
> javax.servlet.ServletException: Servlet class: 'jsp_servlet._result'
> could not be loaded - the requested class wasn't found in the
> classpath:
>
'/local/apps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_d
elete/wl_local_comp34107.war:/local/apps/bea/wlserver6.0/./config/gmodomain/
applications/.wl_temp_do_not_delete/WEB-INF/_tmp_war_gmo_gmo_webwar:/local/a
pps/bea/wlserver6.0/config/gmodomain/applications/.wl_temp_do_not_delete/WEB
-INF/_tmp_war_gmo_gmo_webwar'
>
> at
>
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
a:532)
>
> at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:191)
>
> at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:148)
>
> at
>
weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:30
6)
>
> at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208)
>
> at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:246)
>
> at
>
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:1265)
>
> at
>
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1622)
>
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
>
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
> where result.jsp is the jsp page calling the EJB. I did an import of the
> EJB classes in the jsp.
> like i said, it works if I put the bean classes in the classpath. But is
> it right?
> if I have these in the exploded format, do I need to put anything in the
> application web.xml under:
> wlserver6.0/config/gmodomain/applications/DefaultWebApp_gmo/WEB-INF ?
>
> redhat 6.2, wl6.0sp1
>
> here are the xml files:
> web.xml:
>
> <?xml version="1.0"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>
> <!--
> $Id: web.xml,v 1.2 2001/03/14 22:23:03 jeff Exp $
> $Source:
> /usr/local/cvsroot/JUnitEE/example/components/web-war/WEB-INF/web.xml,v
> $
> -->
>
> <web-app>
> <display-name>My Web Application</display-name>
> <description>none</description>
> <ejb-ref>
> <ejb-ref-name>MyWeb</ejb-ref-name>
> <ejb-ref-type>Session</ejb-ref-type>
> <home>com.blah.ejb.myweb.WyWebHome</home>
> <remote>com.blah.ejb.myweb.MyWeb</remote>
> </ejb-ref>
> </web-app>
>
> weblogic.xml:
>
> <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web
> Application 6.0//EN"
> "http://www.bea.com/servers/wls600/dtd/weblogic-web-jar.dtd">
> <weblogic-web-app>
> <jsp-descriptor>
> <jsp-param>
> <param-name>
> pageCheckSeconds
> </param-name>
> <param-value>
> 1
> </param-value>
> </jsp-param>
> <jsp-param>
> <param-name>
> verbose
> </param-name>
> <param-value>
> true
> </param-value>
> </jsp-param>
> <jsp-param>
> <param-name>compileCommand</param-name>
> <param-value>/local/apps/jdk1.3.0_02/bin/javac</param-value>
> </jsp-param>
> </jsp-descriptor>
> <reference-descriptor>
> <ejb-reference-description>
> <ejb-ref-name>MyWeb</ejb-ref-name>
> <jndi-name>MyWeb</jndi-name>
> </ejb-reference-description>
> </reference-descriptor>
> </weblogic-web-app>
>
> thanks,
>
> Gary
>
>
-
How can I send purchase order through SAP mail ?
How can I send purchase order through SAP mail ? Can any one explain whts the NACE settings?
just do it as <b>Anji reddy</b> said to you ...or else ... in the purchase order trascation ...print it ... so that it will generate the spool request for that purchase order ....
so the the belwo program is for sending <b>the Spool Request data as Email to any Email id ...</b>
The code below demonstrates how to retrieve a spool request and email it as a PDF document. Please note for the below program to process a spool request the program must be executed in background otherwise no spool request will be created. Once you have had a look at this there is an modified version of the program which works in both background and foreground. Also see transaction SCOT for SAPConnect administration.
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
*** Alternative way could be to submit another program and store spool
*** id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
* Get spool id from program called above
* IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
* FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
* FORM get_job_details *
FORM get_job_details.
* Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
* FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
* FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
* perform send_email using p_email2.
ENDFORM.
* FORM send_email *
* --> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
* Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
* CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
* If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
* FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
Girish -
How can i call a business model function?
Hello!
I have a simple problem
A gui view-backing - function call the setUsername by FacesContext und operative Buinding - it works well.
Now i want to call the the function getUsername from a function inside the class EntityImplEx - both classes are in the business model in different class-pathes.
How can I call the function getUsername from AppModule?
package model.app;
public class AppModuleImpl extends ApplicationModuleImpl implements AppModule {
public String username = "init";
public void setUsername(String ss) {
username=ss;
public String getUsername() {
return(username);
package model.entity;
public class EntityImplEx extends EntityImpl {
***************************You probably don't want to call a function in your UI from your AM.
Doing this will break the MVC design pattern and will make your AM depends on a specific UI page.
The way to communicate between the two is through service methods on the AM that are invoked from the UI layer.
See chapters 8.3-8.5 in the developer guide:
http://download.oracle.com/docs/html/B25947_01/bcservices003.htm#sm0206 -
How can I call a FM in WDA?
Hi All,
Plz tell me, How can I call a function module in WDA.
I have an Inputfield and a attribut under a node. I have a FM, too.
I need to call the FM in a Method.
How can I do it?
thx
Best Regards
ShuoHi,
For eg, if you want to display the result of FM in webdynpro input field.
IN wddoinit method of view that is created by you,
DATA:
node_node1 TYPE REF TO if_wd_context_node,
elem_node1 TYPE REF TO if_wd_context_element,
stru_node1 TYPE wd_this->element_node1 ,
item_attr1 type string.
You can use pattern to call the FM
CALL FUNCTION 'FUNCTION_NAME_XXXX'
importing
var1 = item_attr1
YOu can use webdynpro code wizard to generate this code. ( read attribute )
navigate from <CONTEXT> to <NODE1> via lead selection
node_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
get element via lead selection
elem_node1 = node_node1->get_element( ).
get single attribute
elem_node1->set_attribute(
EXPORTING
name = `ATTR1`
value = item_attr1 ).
If you want more information please go through the tutorials available in sdn or visit
help.sap.com and search for webdynpro abap.
Thanks,
Prashanth -
How can I call a condition type in my ALV report
I am having one condition type.Then how can I call a condition type in my ALV report.
Hi,
If you have any conditions then filter your data according to that conditions through SQl queries.
And then display it through ALV.
Regards
Mudit -
How can I call a nonstatic class
Hello All,
I've wrote a simple bean for my testcase that count a value (e.g. site access):
public class Bean1 {
private int accessCount = 1;
public int getAccessCount() {
return (accessCount++);
If I call the bean with a jsp-site, it works fine with different scope. e.g. session and application.
With session scope different browser count different. With application scope different bowser count together. Thats the normal attitude.
My jsp code:
<jsp:useBean id="counter" class="ml.view.Bean1" scope="session" />
<jsp:getProperty name="counter" property="accessCount" />
This don't work with a static bean (normal too), but I can only call a static class in my UIX site.
I call the bean from uix with the invoke element. Is that correct? How can I call a nonstatic class with a special scope? Which other solution ist possible?
My uix code:
<invoke method="getAccessCount" result="${uix.eventResult.getAccessCount}" instance="${sessionScope.myBean.getAccessCount}" exception="${uix.eventResult.error}" javaType="ml.view.myBean"/>
Thank you for any solution!
The error messages are:
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java)
at oracle.cabo.servlet.event.InvokeEventHandler._invoke(Unknown Source)
at
and so forth...false in my uix code example: javaType="ml.view.myBean"
correct: javaType="ml.view.Bean1"
Sorry :-) that was only an error in my post not in the really example. -
How can send servlet out put to jsp
Hi friends,
my problem is ..
1.In my jsp (let us assume that Test.jsp ) emded tag which emding out put from Servlet.. like
<embed name="svg" border="1" type="image/svg+xml" width="100%" height="100%" src="http://localhost:8080/demo/Test?"/>
here the jsp is calling Servlets but at the time display the jsp cannot understand the out put comming from servlets ..
plz help how can read a Servlet data from JSP
thanksUse <jsp:include page="relative_url_to_servlet"/>. Then have your servlet get the PrintWriter for output from response.getWriter() and you should have it.
I do this every once in awhile. -
How can i solve a issue through remeady
how can i solve a issue through remeady..
With Regards
PrasantaHello,
Remedy and other similar products are the tools which track the Action / Time taken for resolving a call. Normally, once an issue is reported, that will be recorded in a tool with an estimated fix time. If the call is not fixed / actioned within the estimated time, it go as breached.
The analyst need to update the call status in the tool. They will need to update the actions taken, call notes ..etc. Once the issue is fixed, you may set the call status as resolved. Once you set the status as resolved, the user who riased the issue will get an e-mail. They will confirm whether the issue is actually closed or not. Depends upon their cconfirmation, the status will be set to Closed or again Reopen.
This is a typical helpdesk tool scenario.
Prase
Maybe you are looking for
-
String comparison having single quote
hi i m comparing a string which already have a single quote like this var_name=khurram' shehzad select * from table where name=' var_name '; plz help me how to do it bcoz its creating probelm thanks and regards,
-
Problem while setting username password to router
Hi, i am trying to connect to router using java program. i am connecting with out any problem. while giving the credentials like username and password i can't placing the original username password.instead some thing is setted. here is my code pub
-
Can SIPServletResponse be edited?
Hi All, Is it possible to update an SipservletResponse received from b-party in sip application before it is send to a-party? Scenario is like this. 1 SIP application receives INVITE and route it to b-party using proxy object. 2 SIP application recei
-
Sharing Files between PC and Mac
I have a PC running Windows Vista, and a new Macbook. I have set folders on my PC to share with other computers on my network, and I have shared my printer as well on this same network. I can connect to my PC from my Mac using the "Connect to Server"
-
Rom UK to South IPhone 3GS Synching Problems - HELP PLEASE
Hey, I need help. Every time I connect my iphone to my HP laptop, it says it can't read the iphone and wants to restore the software. I go through this route, and it sometimes allows me to synch my contacts, but I have no joy with apps or music. This