How to Initialize input parameter in bean
Hi all
I have html(input), jsp (display), and bean .
I want to give users option click next to display more records or go back to begin a new search again.
therefor I need to initialize the input string, but
I use string=null
or setString(" '') in my public void again()method what else I can use?
Thank you
Hi, Thank you for your reply,
so far my question is
1) I don't put string=null in my again meth() and if I do input something in my text box everytime, I can do the new search or continue display (next or back ),
at this situation, if I input some in my text box once, then I try to submit the empty search form, I still got the old display result, let me give some example, make it more easy to understand.
i search people in text box, 1000 recode in database, I click next or back to look what I need , I do a new search like duck , it work fine, but that if I submit a empty search form , I want the dispaly is not match is show, but I still got all duck information.
2) if I did put string=null in my again method , session is gon't even i clic the next , it jump to new search .
any ideal???
Similar Messages
-
Need Help-How Store the input parameter through java bean
Hello Sir,
I have a simple Issue but It is not resolve by me i.e input parameter
are not store in Ms-Access.
I store the input parameter through Standard Action <jsp:useBean>.
jsp:useBean call a property IssueData. this property exist in
SimpleBean which create a connection from DB and insert the data.
At run time servlet and server also show that loggging are saved in DB.
But when I open the table in Access. Its empty.
Ms-Access have two fields- User, Password both are text type.
Please review these code:
login.html:
<html>
<head>
<title>A simple JSP application</title>
<head>
<body>
<form method="get" action="tmp" >
Name: <input type="text" name="user">
Password: <input type="password" name="pass">
<input type="Submit" value="Submit">
</form>
</body>
</html>LoginServlet.java:
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String user=request.getParameter("user");
String pass=request.getParameter("pass");
co.SimpleBean st = new co.SimpleBean();
st.setUserName(user);
st.setPassword(pass);
request.setAttribute("user",st);
request.setAttribute("pass",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}SimpleBean.java:
package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean {
private String user="";
private String pass="";
private String s="";
public String getUserName() {
return user;
public void setUserName(String user) {
this.user = user;
public String getPassword() {
return pass;
public void setPassword(String pass) {
this.pass = pass;
public String getIssueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getUserName();
getPassword();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:odbc:simple");
System.out.println("Connected....");
PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String User=getUserName();
st.setString(1,User);
String Password=getPassword();
st.setString(2,Password);
st.executeUpdate();
System.out.println("Query Executed");
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
}submit.jsp:
This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("user")).getUserName() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("pass")).getPassword() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request" />
<jsp:getProperty name="st" property="IssueData" />
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>issue.jsp</jsp-file>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Please Help me..Thanks.!!!
--Dear Sir,
Same issue is still persist. Input parameter are not store in database.
After follow your suggestion when I run this program browser show that:i.e
This is Submit page Hello Student Name: vijay
Password: kumar
<jsp:setProperty name="st" property="userName" value="userValue/> Your logging is saved in DB
Please review my code.
login.html:
{code}<html>
<head>
<title>A simple JSP application</title>
<head>
<body>
<form method="get" action="tmp" >
Name: <input type="text" name="user">
Password: <input type="password" name="pass">
<input type="Submit" value="Submit">
</form>
</body>
</html>{code}
LoginServlet.java:
{code}import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String userValue=request.getParameter("user");
String passValue=request.getParameter("pass");
co.SimpleBean st = new co.SimpleBean();
st.setuserName(userValue);
st.setpassword(passValue);
request.setAttribute("userValue",st);
request.setAttribute("passValue",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}{code}
SimpleBean.java:
{code}package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean {
private String userValue="";
private String passValue="";
private String s="";
public String getuserName() {
return userValue;
public void setuserName(String userValue) {
this.userValue = userValue;
public String getpassword() {
return passValue;
public void setpassword(String passValue) {
this.passValue= passValue ;
public String getissueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getuserName();
getpassword();
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Connection loaded");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
System.out.println("Connection created");
PreparedStatement st=con.prepareStatement("insert into vij values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String userName=getuserName();
st.setString(1,userName);
String password=getpassword();
st.setString(2,password);
st.executeUpdate();
System.out.println("Query Executed");
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
}{code}
submit.jsp:
{code}This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("userValue")).getuserName() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("passValue")).getpassword() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request" />
<jsp:setProperty name="st" property="userName" value="userValue/>
<jsp:setProperty name="st" property="password" value="passValue"/>
<jsp:getProperty name="st" property="issueData" />
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Sir I can't use EL code in jsp because I use weblogic 8.1 Application Server.This version are not supported to EL.
Please help me...How store th input parameter in Database through Java Bean -
How Insert the input parameter to database through Java Bean
Hello To All..
I want to store the input parameter through Standard Action <jsp:useBean>.
jsp:useBean call a property IssueData. this property exist in
SimpleBean which create a connection from DB and insert the data.
At run time when I click on submit button servlet and server also show that loggging are saved in DB.
But when I open the table in Access. Its empty.
Ms-Access have two fields- User, Pass both are text type.
Please review these code:
login.html:
<html>
<head>
<title>A simple JSP application</title>
<script language=javascript>
function f(k)
document.forms['frm'].mykey.value=k;
document.forms['frm'].submit();
</script>
<head>
<body>
<form method="get" action="tmp" name="frm">
Name: <input type="text" name="User">
Password: <input type="password" name="Pass">
<input type=hidden name="mykey" value="">
<input type="button" value="Submit" onclick="f('submit.jsp')">
<input type="button" value="Issue" onclick="f('issue.jsp')">
</form>
</body>
</html>LoginServlet.java:import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String User=request.getParameter("User");
String Pass=request.getParameter("Pass");
co.SimpleBean st = new co.SimpleBean();
st.setUser(User);
st.setPass(Pass);
request.setAttribute("User",st);
request.setAttribute("Pass",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("/"+request.getParameter("mykey"));
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}SimpleBean.java:package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean
private String User="";
private String Pass="";
private String s="";
public SimpleBean(){}
public String getUser() {
return User;
public void setUser(String User) {
this.User = User;
public String getPass() {
return Pass;
public void setPass(String Pass) {
this.Pass = Pass;
public String getissueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getUser();
getPass();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:odbc:simple");
System.out.println("Connected....");
PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String User=getUser();
st.setString(1,User);
String Pass=getPass();
st.setString(2,Pass);
int y= st.executeUpdate();
System.out.println(y);
System.out.println("Query Executed");
con.commit();
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return this.s;
catch(Exception e)
e.printStackTrace();
return "failed";
}submit.jsp:
This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("User")).getUser() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("Pass")).getPass() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request"/>
<jsp:setProperty name="st" property="User" value="request.getParamaeter("Pass")"/>
<jsp:setProperty name="st" property="Pass" value="request.getParamaeter("Pass")"/>
<jsp:getProperty name="st" property="issueData"/>
<% st.getissueData(); %>
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>issue.jsp</jsp-file>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Please Help me..Dear Sir,
Accordingly your suggestion I check the SimpleBean class putting the constant values in this bean class.That is Sucessfully Inserted constant values in database.
Like for example..
myfirstjavabean.java:
package myfirstjava;
import java.io.*;
import java.sql.*;
public class myfirstjavabean
private String firstMsg="Hello world";
private String s="";
public myfirstjavabean()
public String getfirstMsg()
return firstMsg;
public void setfirstMsg(String firstMsg)
this.firstMsg=firstMsg;
public String getissueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getfirstMsg();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:odbc:sampleMsg");
System.out.println("Connected....");
PreparedStatement st=con.prepareStatement("insert into Table1 values(?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String Msg=getfirstMsg();
st.setString(1,Msg);
int y= st.executeUpdate();
System.out.println(y);
System.out.println("Query Executed");
con.commit();
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return this.s;
catch(Exception e)
e.printStackTrace();
return "failed";
}Vij.jsp:
<html>
<body>
<jsp:useBean id="st" class="myfirstjava.myfirstjavabean" scope="request" />
<jsp:getProperty name="st" property="firstMsg" />
<jsp:getProperty name="st" property="issueData" />
</body>
</html>These above example sucessfully inserted the Hello World message in database.
But which value I put user input at run time Its not inserted in database.
Which is my previous problem that is persist.
Please Help.. -
How to give input parameter to Bapi when executing a method.
Hi All,
I have 1 input field and 1 button.I've defined a model node and inside that model attribute in my view.If I enter something in the Input field the value should go to the particular model attribute I defined.How to pass that input parameter.I have a action like this....
public void onActionGetDateDetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionGetDateDetails(ServerEvent)
wdThis.wdGetGetDateDetailsCustController().execute_Bapi_Get_Date_Details("");
// while executing the above method I have to pass the input parameter typed in the input field.
Structure of my context :
Bapi_Date_Details
>Network List(Model Node)
|
-->Network (Model Attribute)
//@@end
Help me to solve this.
Thankx in advance.
Regards,
Karthick.K.EHi Karthick,
You can associate an input field's value to a BAPI in two ways:
1) binding the input UI element's 'value' directly to the BAPI's input attribute that you want to set. This is the methos Noufal suggested. In this method, make sure you initialize the attribute through the following lines of code in the doInit() method, else, the input field will be disabled.
<b><Bapi_name>Input input = new <Bapi_name>Input();
input.set<Attribute_name>(new <dataType>);</b>
2) The second method is settting the input's 'value' to some other attribute(say 'abc') and giving this value to the input parameter just before calling the RFC.
input.set<Attribute_name>(wdContext.currentContextElement.getAbc());
Hope this helps,
Best Regards,
Nibu -
How to give input parameter to application form through se38 program?
Hi all,
How can i call my application form from within my se38 program?
is there any way then please tell me?
and how to pass input parameters to application form through se38 program?
Thanks and Regards,
Arpita.Hi you can pass the parameter using application program. You can pass the value using the interface of the function module given below.
parameter p_matnr type mara-matnr.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = gc_smart_form 'Name of ur smart form
variant = ' '
direct_call = ' '
IMPORTING
fm_name = lv_fmname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE 'E'
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION lv_fmname
EXPORTING
control_parameters = gs_ssfctrlop
output_options = gs_ssfcompop
user_settings = ' X'
**---This is where u can pass ur paramter to the smart form*
matnr = p_matnr.
called from batch job
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5 .
Thanx and hope this would help.
Regards,
Aruna
Edited by: Aruna Kumari Chekka on Dec 12, 2008 6:24 AM
Edited by: Aruna Kumari Chekka on Dec 12, 2008 6:29 AM -
How to pass input parameter (parameterized mapping) to java mapping program
Hello
I have a question about the parameterized mapping with Java (PI 7.1).
In the operation mapping (using Java-class) I defined a inputer parameter (string). I think I am supposed to retrieved the value using:
arg0.getInputParameters().getString("myInputParameterName");
where arg0 is the TransformationInput object.
However I am not able to get the value, I got runtime exception saying the inputer parameter doesn't exit.
Then I figured out maybe I need to bind the OM input parameter to Java mapping parameter, just like in case of message mapping, you need to bind OM parameter to MM parameter. However there is no way to define input parameter for the java mapping program.
Anybody has done java mapping with parameterized mapping?
Anybody can give any hint for this?
Thanks
JaysonInputParameters params = container.getInputParameters();
DynamicConfiguration conf = (DynamicConfiguration) params.getValue(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
http://help.sap.com/saphelp_nwpi71/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
Edited by: Anand on Dec 10, 2008 4:13 PM -
How to set dynamic parameter in bean
I want to set a change able paramerter in my bean what can I do?
like
db.setCatalog(" HkData "); hard code, work fine.
but if
public String getOurDatabase(){
return ourDatabase;}
public void setOurDatabase ( String ourDatabase ) {
this.ourDatabase =ourDatabase; }
what is the correct syntax in
db.setCatalog(" ? ");Hi follow is my bean, I need code in ???? place
Thank you
package num;
import java.util.*;
import java.sql.*;
public class NameBean1 implements java.io.Serializable {
/* Member Variables */
private String fieldNumber;
private String name;
private String hiTiter;
private String subType;
private String string;
private String ourDatabase;
/* ArrayLists to hold recordsets */
private List fieldNumberList, nameList, hiTiterList, subTypeList;
/* Helper Variables */
private int currentRow;
private int rowCount;
private boolean anyRecords = false;
private Connection db = null;
private ResultSet rs=null;
/* Constructor */
public NameBean1() {
again();
/* Get Database Connection */
private void dbConnect() {
if (db == null) {
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
db = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;selectMethod=cursor","test","1234");
what is code in here????????
catch (Exception e) {
System.out.println("Error Connecting to catalog DB: " + e.toString());
/* Accessor Methods */
public String getfieldNumber() {
return fieldNumber;
/* one way to set data will get from database */
public void setFieldNumber(String fieldNumber) {
this.fieldNumber =fieldNumber;
public String getName() {
return name;
public void setName(String _name) {
name = _name;
public String getHiTiter() {
return hiTiter;
public void setHiTiter(String _hiTiter) {
hiTiter = _hiTiter;
public String getSubType() {
return subType;
public void setSubType(String _subType) {
subType = _subType;
public String getString(){
return string;
public void setString( String string ) {
this.string =string; }
public void setOurDatabase(String ourDatabase){
ourDatabase=ourDatabase;
public String getOurDatabase() {
return ourDatabase;
/* Read-only attribute */
public int getCurrentRow() {
return currentRow;
public int getRowCount() {
return rowCount;
/* Populate Record List */
public boolean Mysearch() {
/* If fieldNumberList is empty, then execute the query */
if (fieldNumberList.isEmpty()) {
try {
Statement s = db.createStatement();
String Sql=" select ourDatabase.dbo.ViruName00.FieldNumber, Name, HiTiter, SubType, Storage";
Sql+=" from ourDatabse.dbo.ViruName00,ourDatabse.dbo.Storage00";
Sql+=" where ourDatabse.dbo.ViruName00.NewNum=ourDatabse.dbo.Storage00.NewNum and Name like'%"+string+"%'";
Sql+=" Union";
Sql+=" ourDatabse.dbo.select ViruName01.FieldNumber,Name, HiTiter,SubType, Storage";
Sql+=" from ourDatabse.dbo.ViruName01, ourDatabse.dbo.Storage01";
Sql+=" where ourDatabse.dbo.ViruName01.NewNum = ourDatabse.dbo.Storage01.NewNum and Name like'%"+string+"%'";
Sql+=" Union";
Sql+=" select ourDatabse.dbo.ViruName02.FieldNumber,Name, HiTiter, SubType,Storage";
Sql+=" from ourDatabse.dbo.ViruName02, ourDatabse.dbo.Storage02";
Sql+=" where ourDatabse.dbo.ViruName02.NewNum=ourDatabse.dbo.ourDatabse.dbo.Storage02.NewNum and Name like'%"+string+"%'";
Sql+=" Union";
Sql+=" select ViruName03.FieldNumber,Name, HiTiter, SubType, Storage";
Sql+=" fromourDatabse.dbo. ViruName03, ourDatabse.dbo.Storage03";
Sql+=" where ourDatabse.dbo.ViruName03.NewNum=ourDatabse.dbo.Storage03.NewNum and Name like'%"+string+"%'";
rs = s.executeQuery (Sql);
fieldNumberList.clear();
nameList.clear();
hiTiterList.clear();
subTypeList.clear();
rowCount = 0;
while (rs.next()) {
fieldNumberList.add(rs.getString("FieldNumber"));
nameList.add(rs.getString("Name"));
hiTiterList.add(rs.getString("HiTiter"));
subTypeList.add(rs.getString("SubType"));
rowCount++;
anyRecords = true;
}//end while
}//end try
catch (Exception e) {
System.out.println("Error populating productBean: " + e.toString());
}//end if
return anyRecords; }//end function
public boolean getAnyRecords() {
return anyRecords; }
/* Reset current row */
public void setStartRow(int start) {
if (start < rowCount) {
currentRow = start;
/* Move to next row */
public int nextRow() {
if (currentRow == rowCount) {
currentRow = 0; // Reset for next page request
return 0; // return 0 to indicate end of recordset
/* Populate bean properties with current row */
setFieldNumber((String)fieldNumberList.get(currentRow));
setName((String)nameList.get(currentRow));
setHiTiter((String)hiTiterList.get(currentRow));
setSubType((String)subTypeList.get(currentRow));
currentRow++;
/* return currentRow*/
return currentRow;
public void again(){
/* Initialize bean properties */
setFieldNumber("");
setName("");
setHiTiter("");
setSubType("");
/* Initialize arrayLists to hold recordsets */
fieldNumberList = new ArrayList();
nameList = new ArrayList();
hiTiterList = new ArrayList();
subTypeList = new ArrayList();
fieldNumberList.clear();
nameList.clear();
hiTiterList.clear();
subTypeList.clear();
/* Initialize helper variables */
currentRow = 0;
rowCount = 0;
anyRecords= false;
/* Get database connection */
dbConnect();
rs=null;
} -
How to Restrict Input Parameter in MD02
Dear Sir,
While running In the Tcode MD02 , we are looking for the following requirement :
Under MRP Control Parameter , the parameter "Create Purchase Requisition" must have a default value as 3 and it should be grayed-out also so that user is not able to change the default value .
I request SAP experts to kindly help me , as how can we meet the above requirement please .
Regards
B MittalHi,
Probably you can use Transaction Variant (T. Code : SHD0) for this purpose.
Refer below link for further details..
http://help.sap.com/erp2005_ehp_03/helpdata/EN/bf/ec07845db911d295ae0000e82de14a/frameset.htm
Regards,
Siva -
Help: How to put input parameter into report?
I am working on a report. The user is require to enter the search date and the report is created base on the search date. This search date parameter is required to show on the paper report. How do I make it?
Thank you.
JimmyJimmy,
You need to add &1 to the where clause of your Query (SQL statement). Then run the report you will be prompted to add your criteria. Add it to your where clause like this:
Select .... from table
where ...
and &1
Amir Orojeni,
Oracle DBA -
How to make input parameter with multiple values in function module?
Dear Experts,
I want to add BUKRS as import field to a FM, what is the best way of of making it accept multiple enteries.
Regards,
KiranhI kiran,
The simple way is to create a data element & domain with value range where u provide set of fixed values or provide a check table to it.
Use that data element in a table <ztable>.
Code:
Parameters:
p_burks like <ztable>-dataelement.
Call Function <function_name>
exporting
p_burks = p_burks, -
How to pass input value to the IN parameter in a function
Hi ,
I'm new to pl/sql programming.
The below function is used inside a package and the package is invoked in visual studio.
The function uses 2 input parameters.
Out of which 'in_report_parameter_id' value comes thru job processor service 's job request.
The second IN paramter values are hard coded in the function.
I'm not able to understand this.
If the values are hard coded , how to make sure that only the hard coded values are the right ones?
Please anyone could explain to me?
I really dont have good idea about how to pass INPUT parameter to the functions or procedure
Is there any nice document which could give me good understanding about what are the ways or types we could pass values to the input parameter in subprograms?
thanks in advance.
CREATE OR REPLACE FUNCTION get_class_text_str
in_report_parameter_id IN NUMBER,
in_which IN VARCHAR2 DEFAULT 'SELECT'
RETURN VARCHAR2
IS
end_text VARCHAR2 (50) := '';
my_class_text_str VARCHAR2(10000) := '';
my_class_value_str VARCHAR2(10000) := '';
CURSOR class_text(c_1_text VARCHAR2, c_2_text VARCHAR2) IS
SELECT c_1_text || report_parameters.report_parameter_value
|| c_2_text
|| report_parameters.report_parameter_value
|| '" '
FROM report_parameters
WHERE report_parameters.report_parameter_id = 3690
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
GROUP BY report_parameters.report_parameter_value
ORDER BY CAST(report_parameters.report_parameter_value AS NUMBER);
BEGIN
IF (in_which = 'SUM') THEN
OPEN class_text ( 'SUM(NVL("Class ', '", 0)) "Class ' );
ELSIF (in_which = 'PERC')THEN
OPEN class_text ( 'ROUND((("Class ', '" / "Total") * 100), 2) "Class ' );
end_text := ', DECODE("Total", -1, 0, 100) "Total" ';
ELSE
OPEN class_text ( 'SUM(DECODE(bin_id, ', ', bin_value, 0)) "Class ' );
END IF;
LOOP
FETCH class_text INTO my_class_value_str;
EXIT WHEN class_text%NOTFOUND;
my_class_text_str := my_class_text_str || ', ' || my_class_value_str;
END LOOP;
CLOSE class_text;
my_class_text_str := my_class_text_str || end_text;
RETURN my_class_text_str;
END get_class_text_str;
/Edited by: user10641405 on Nov 19, 2009 8:16 AM
Edited by: user10641405 on Nov 19, 2009 8:30 AMThis is not a design I would use, but should work if coded properly. I would probably build a reference cursor query as text and use one open fetch and close.
You have 2 input parameters, in_report_parameter_id and in_which. I could not find where in_report_parameter_id was used in the program, but the value passed in for in_which is being used in IF logic to decide how to open the cursor. After the cursor is open rows are being fetched and eventually the cursor is closed.
The values in_which are compared to are hard-coded. It is the programmer's job to make sure the values listed are the right values and the actions taken are also correct. Your program is assuming that if the first 2 values are not encountered the third one listed is the one you want.
To pass input values to a procedure you merely provide the values as a literal or variable in the call, something like
whatever := get_class_text_str(1,'SELECT'); -
Declaring input parameter for flag in procedure!!!!!
hi,
can anyone tell how to declare the flag i,e true or false as an input parameter in the procedure.
here is the code wat i have
create or replace procedure test
cur_out out sys_refcursor
as
begin
open cur_out for
select field1
from Test
where REPORTING_FLG = 'y' --(here i want the user to select 'Y' or 'N' )
ORDER BY field1;
end TEST;
In the where condition i want the user to select the 'y' or 'N'. So i have to give input parameter i guess. So could anyone let me know how to give input parameter for flag.
Urgent PLZ!!!
Thank u in Advance.May be this way:
Create or Replace procedure test (cur_out out sys_refcursor,flg in varchar2)
as
begin
open cur_out for select field1 from Test
where REPORTING_FLG = flg
ORDER BY field1;
end TEST;
We can only pass Input parameters! -
How to disabled the input parameter dialog box in crystal reports 9
Post Author: Murtaza
CA Forum: General
Hi friends,I have got stuck with a weird problem. In my
crystal report, I have set up some input parameters. I am setting
values for these parameters somewhere inside code. But I don't
want to show the default input parameter dialog box. Under any case,
user should not see the ugly parameter dialog box that crystal
presents. Please suggest me how I can achieve
this. I cannot do this through code, because our environment does
not allow that. I have to do this in crystal reports viewer and
by setting some property of the crystal report object. But everything
must be done on UI, not through code. So, the solution should not be the following.
// step before step 1
// **** the line needs to refer to the report and be set before setting
ReportSource in the viewer to myReport
myReport.EnableParameterPrompting = False
Any help would be greatly appreciated. MurtazaPost Author: sleahcim
CA Forum: General
Hi Murtaza,
Unfortunately, I am not aware of any method to suppress the prompt for the input parameters, but still use them. It is truly a design-related issue for the report. The reason that the prompt appears is because the parameter it is prompting for is used in the report; in particular either the Group or Record Selection, or referenced in another formula.
The only way I can think of to not show the prompt, is to not use the parameter in the report. You did mention that you are setting the value of the parameter inside of the report -- are you doing this through using a formula? Perhaps you can just remove the parameter and only use the formula that you are setting the default values with.
-Michael -
How can I pass dynamic value as a user input parameter in discoverer?
Hi,
I have a requirement for a discoverer report like this: The report will display only details for Suppliers that have expired (or soon to be) Insurance details. That is the Expiration Date is less than or equal to the day the report is being run plus any days specified in the Number of Days in the Future Parameter.
The sample code as:
SELECT s.segment1 vendor_number
,s.vendor_name
,flv1.meaning classification
,pca.certificate_number
,pca.certifying_agency
,pca.expiration_date
,flv2.meaning status
FROM ap_suppliers s
,pos_bus_class_attr pca
,fnd_lookup_values flv1
,fnd_lookup_values flv2
WHERE pca.vendor_id = s.vendor_id
AND flv1.lookup_code = pca.lookup_code
AND flv1.lookup_type = pca.lookup_type
AND flv2.lookup_code = pca.class_status
AND flv2.lookup_type = 'POS_BUS_CLASS_STATUSES'
AND pca.expiration_date <= trunc(sysdate) + <No. of Days in the Future>
order by pca.expiration_date asc
Now the parameter is Number of Days in the Future (Enter the number days in the future to extract the data. This will default to 0).
Is it possible in discoverer to do so as in query i do that like a condition as pca.expiration_date <= trunc(sysdate) + <No. of Days in the Future>.
How can I pass <No. of Days in the Future> as a user input parameter in discoverer?
Please help.Hi,
All you need to do is to create the condition in the discoverer instead of in the query.
Create a custom folder containing the following sq (note that i removed the condition)l:
SELECT s.segment1 vendor_number
,s.vendor_name
,flv1.meaning classification
,pca.certificate_number
,pca.certifying_agency
,pca.expiration_date
,flv2.meaning status
FROM ap_suppliers s
,pos_bus_class_attr pca
,fnd_lookup_values flv1
,fnd_lookup_values flv2
WHERE pca.vendor_id = s.vendor_id
AND flv1.lookup_code = pca.lookup_code
AND flv1.lookup_type = pca.lookup_type
AND flv2.lookup_code = pca.class_status
AND flv2.lookup_type = 'POS_BUS_CLASS_STATUSES'
Then create a discoverer report using this folder using all fields.
Create a new calculation as (use this exact syntax):
Sysdate + :No_of_Days_in_the_Future
Create a new condition:
pca.expiration_date <= <your calculation>
To complete it add a sort as you did in the SQL.
That's it.
Tamir -
How can i dynamically select columns based on the input parameter?
I have an input parameter which takes single numeric value.
Based on this value i have to dynamically select table-columns .
For eg: if i have following fields in my table :
SEM_1
SEM_2
SEM_3 and SEM_4.
And if i give numeric input as 2 , then i have to select "SEM_2" column only.
if the input is 3 then i have to select "SEM_3" only and leave the rest of the columns.
how do i achieve this dynamic feature in the "Select ..... From...... table...." statement in the ABAP??Hi,
you should try something like this.
TYPES: cond(72) TYPE c.
data: condtab TYPE TABLE OF cond,
condw type cond.
data: lv_field(30) type c value 'SEM_'.
write p_num to lv_field+4(1).
condw = lv_field.
append condw to condtab.
SELECT (CONDTAB) FROM table INTO.....
Kostas
Message was edited by:
Kostas Tsioubris
Maybe you are looking for
-
Aperture 3 RAW file edited in Photoshop
I did this according to the Aperture 3 Manual: "...select an image and choose Photos > Edit With > [application name]. Aperture makes a new master and version of your image and opens it in Adobe Photoshop. After you make your changes and save the ima
-
Itunes error message can someone plz help.
Hello I have uninstalled and then reinstalled itunes multiple times and I keep getting this following message. "The instruction at "0x00ed408c" referenced "0x00ed408c". The memory could not be "written".Click OK to terminate the programnced at " Can
-
Dear all, Once running CM40 in background, I receive an error message like: "No capacity requirements were found in the evaluation period Message no. CY140 Diagnosis No capacity requirements records were found for the selected orders in the evaluatio
-
Hello, I've installed v11 of crystal reports and imported jobs created in 8.5 This worked but now i find that when i go to set the destination for the report i cant see the option of a printer, although I had this in 8.5. Can anyone please tell me ho
-
My ipod nano is currenty not turning off. After I've charged it and its disconnected from the computer it'll remain on, and when I try to turn it off (either by pushing and holding the play button, or by clicking on the sleep button on the menu), it