How to check 1000+ values comming as In parameter in plsql code.

Hi,
For a PLSQL procedure
I am geting in all 5 parameters from front end. One of which is a comma separated list of 1000+ values. Now I need to check these values to retrieve from the database.
eg. create procedure sp1(param1 date, param2 varchar2,param3.....,param5 varchar2)
as
begin
select col1,col2,col3 from tab1
where param1 = to_date(date)
and param2 = 'abcd'
and param5 = (list coming from front end)
How should I pass this list to param5 for selection criteria so that each time single value is retrieved and row is returned to the front end
Also How should I return this resultset to front end. Should I use OUT parameter as sysrefcursor?
it will really help me if I get any example on above problem.
Thanks in advance.
Edited by: 954825 on Aug 24, 2012 7:39 AM

Solomon Yakobson wrote:
Bad design. Fifth parameter should be collection. Anyway:
and ',' || list-coming-from-front-end || ',' like '%,' || param5 || ',%'SY.Unfortunatly there is a high chance that this fails because of the 4000 characters limitation in sql.
If there are truely 1000+ values. Lets assume 1100.
This means: 1100 characters just for the comma + at least 1100 characters for single char values.
Single chars of cause do not make sense. Most languages don't have so much different characters, this means the list would have repeating values.
If we assume that all values are different, this means we are speaking about a minimum of 3 chars.
Therefore 1100 + 3* 1100 = 4400 chars. SQL limit broken.
I think the only solid solution would be to build a collection/array/temp table structure and then work with that.

Similar Messages

  • How to check a value for paramter query

    I am passing a paramter value from my text box to my sql statement and I would like to check if the value is entered into a text box. If you have any idea please share it with me, i have been struggling with this for many days.Code below is how i try to check if the value is entered but I do not know how to check the value in the :VendorName
    thanks
    If Not txtVendorName.Text = "" Then
    Sql = Sql & " AND (Upper(V.VNAMEL) LIKE '%' || Trim(Upper(:VendorName))|| '%') "
    End If

    Sorry guys english is not my first language and i will try to be clear and specific.
    I have a search page where customeres can do searching either using a text box or two dropdowns i have on my page. they have the option of doing search either using a text box or dropdowns or both.Everything seems to work fine but if users does not leave the text box blank. but they leave the text box blank and do searching using the two dropdowns then the page comes up empty and i checked my query and i should get a value. Attacehed my code for you to look at it.
    <pre>
    Sub VendorSearch()
    gvSearch.Visible = True
    Dim MinPDate As String = drPur.SelectedItem.ToString
    Dim MaxMDate As String = drPurM.SelectedItem.ToString
    Dim liThisOne As ListItem
    Dim strState As String = ""
    For Each liThisOne In lstState.Items
    If liThisOne.Selected Then
    strState = strState & "'" & liThisOne.Value & "'" & ","
    End If
    Next
    Dim Sql As String = " SELECT distinct V.VENDOR ""Vendor Id"",R.ADDRNUM,V.VNAMEL ""Vendor Name"",R.AADDR1,R.ACITY,R.VASST1, "
    Sql = Sql & "R.ASTATE State,R.AZIPCODE, to_char(Max(P.DATEPUR),'YYYY/DD/MM') ""Plan Purchased Date"" , "
    Sql = Sql & "TRIM (r.aaddr1 || decode(trim(r.aaddr2),null,'',' - ') || r.aaddr2) Address,"
    Sql = Sql & " substr(decode(trim(r.vasst1),null, 'N/A','000/000-0000?','N/A','000/000-0000','N/A', r.vasst1),1,12) Fax, "
    Sql = Sql & " substr(decode(trim(r.aphone),null, 'N/A','000/000-0000?','N/A', r.aphone),1,12)Phone "
    Sql = Sql & "FROM VENDOR V,VENDADDR R, PLANHOLD P "
    Sql = Sql & "WHERE V.VENDOR = R.VENDOR AND P.VENDOR = R.VENDOR "
    Sql = Sql & " AND (P.DATEPUR >= TO_DATE('1999-01-01','YYYY-MM-DD')) "
    Sql = Sql & "AND P.DATEPUR In ( select Max(P.DATEPUR) from PLANHOLD P where P.vendor = R.VENDOR) "
    'If txtVendorName.Text <> "" Then
    ' Sql = Sql & " AND (Upper(V.VNAMEL) LIKE '%' || Trim(Upper(:VendorName))|| '%') "
    'End If
    If (strState.Length > 0 And lstState.SelectedIndex <> 0) Then
    strState = Left(strState, strState.Length - 1)
    strState = "(" & strState & ")"
    Sql = Sql & "AND R.ASTATE IN " & strState
    End If
    If (drPur.SelectedIndex <> 0 And drPurM.SelectedIndex <> 0) Then
    Sql = Sql & " AND to_number(to_char(p.datepur, 'YYYY')) between " & "'" & MinPDate & "'" & " AND " & "'" & MaxMDate & "'"
    End If
    ' Dim Para As String
    ' SqlDataSource1.SelectParameters.
    If Not txtVendorName.Text = "" Then
    Sql = Sql & " AND (Upper(V.VNAMEL) LIKE '%' || Trim(Upper(:VendorName))|| '%') "
    End If
    'If Not IsDBNull(SqlDataSource1.SelectParameters(":VendorName")).val Then
    ' Sql = Sql & " AND (Upper(V.VNAMEL) LIKE '%' || Trim(Upper(:VendorName))|| '%') "
    'End If
    Sql = Sql & " AND V.VOBSOLET = 'N' "
    Sql = Sql & "GROUP BY V.VENDOR, R.ADDRNUM,V.VNAMEL,R.AADDR1,R.AADDR2,R.ACITY,R.ASTATE, R.AZIPCODE, R.APHONE, R.VASST1, P.DATEPUR "
    Sql = Sql & "ORDER BY V.VENDOR "
    Response.Write("Sql " & "<br/>" & Sql & "<hr/>")
    SqlDataSource1.SelectCommand = Sql
    End Sub
    </pre>

  • How to check the value in Table CDPOS

    Mostly I can't see the following fields value in the table CDPOS,
      (1) CDPOS-VALUE_NEW
      (2) CDPOS-VALUE_OLD
    In fact, it should have values, so how to check the values, is there any special method needed?
    Thanks and best regards.

    Ferry Lianto,
    Thank you very much for your expertise.
    It's helpful to get some contents via FM:CHANGEDOCUMENT_READ_POSITIONS, the problem is, to some kind of DELETION operation, the log in table CDPOS is very simple, I still don't know which contents were deleted even though I found records in table CDPOS.
    Is there any other suggestions?
    Thanks and best regards.

  • How to pass a value to the export parameter for a method (public instance)?

    Hello,
      I am trying ABAP OO newly. How to pass a value to the export parameter for a method (public instance) called in a report? This *export parameter has a reference type of structure.
    Thanks in advance,
    Ranjini

    Hi,
    "class definition
    class lcl... definition.
      public section.
        method m1 imporitng par type ref to data.  "now you can pass any reference to the method, but this way you have to maintain this reference dynamically inside the method (you can't be sure what that reference is really "pointing" at)
    endclass.
    "in program
    data: r_lcl type ref to lcl...
    create object r_lcl.
    call method r_lcl
      exporting
         par    =  "pass any reference variable here
    Regards
    Marcin

  • How to check old value in form personalization.

    Hi All,
    Could anybody please tell me how to check the old value in oracle forms using form personalization if someone is updating to someother value.
    For example.
    My Vendor Site Alternate name is XYZ
    and someone has changed it to ABC, How could i check the old values before or after doing updates.
    I don't want to write trigger for this.
    Thanks & Regards,
    Vishwas

    Pl see if the solution in this thread can help - Re: Capture who changed data using Forms Personalization & changed to what
    If not, pl see old threads that discuss forms personalization
    http://forums.oracle.com/forums/search.jspa?threadID=&q=forms+AND+personalization&objID=c3&dateRange=last90days&userID=&numResults=15
    HTH
    Srini

  • How to check the value of "The Interrupt Status Flag"?

    Hi, thank you for reading this post!
    Invoking Thread.interrupt() sets the value of the Interrupt Status Flag.
    Just wondering if there is a Java method to check the value of this flag? Or is using isInterrupted() or interrupted() the only way to check?
    http://download.oracle.com/javase/tutorial/essential/concurrency/interrupt.html
    Thank you in advance for your help!
    Eric

    Below is the full code. As soon as the Thread.sleep() is taken out in main(), the interrupt is detected in the child thread. But if the sleep() stays, then the child thread goes into an infinite loop. It's not detected the interrupt.
    //ParentInterruptChildThreadCatchedDemo.java
    //Program function: This program demonstrates the parent thread (main()) interrupting a child thread (thread1).
    //Threaded class
    class TryThread extends Thread {
         //fields
         private String threadname;
         private long aWhile;
         //Constructor
         public TryThread(String tname, long delay) {
              threadname = tname;
              aWhile = delay;
         //run() method
         public void run() {
              while(!Thread.interrupted()) {
                   //Do work
              try {
                   System.out.println(Thread.currentThread().getName() + " was just interrupted!");
                   throw new InterruptedException();
              } catch(InterruptedException e) {
                   //System.exit(1);
                   return;
    public class ParentInterruptChildThreadCatchedDemo {
         public static void main(String[] args) {
              Thread thread1 = new TryThread("thread1", 2000L);
              thread1.start();
              try {
                   System.out.println("main() goes to sleep for 10 second.");
                   Thread.sleep(10000);
                   System.out.println("Statement after main() sleep().");
              } catch(InterruptedException e) {
                    e.printStackTrace();
                 //Interrupt thread1
                  int interruptFlag = 5;
                  for(int i=0; i<11; i++) {
                       if(i == interruptFlag) {
                            System.out.println("Condition met, going to interrupt thread1 ...");
                            thread1.interrupt();
                            System.out.println("Thread1 interrupted!");
                  System.out.println("Ending main()");
    /*Output:
    main() goes to sleep for 10 second.
    Statement after main() sleep().
    Condition met, going to interrupt thread1 ...
    Thread1 interrupted!
    Ending main()
    INFINITION LOOP
    */

  • How to check the value from user input in database or not?

    Hello;
    I want to check the value of user input from JtextFiled in my database or not.
    If it is in database, then i will pop up a window to tell us, otherwise, it will tell us it is not in database.
    My problem is my code do not work properly, sometimes, it tell me correct information, sometime it tell wrong information.
    Could anyone help,please.Thanks
    The following code is for check whether the value in database or not, and pop up a window to tell us.
    while( rs.next()) {
                    System.out.println("i am testing");
                    bInt=new Integer(rs.getInt("id"));
                    if(aInt.equals(bInt)){ // If i find the value in data base, set flag to 1.
                  flag=1;  //I set a flag to check whether the id in database or not
                        break;
             System.out.println("falg" + flag);
                if(flag==1){ //?????????????????????
              String remove1 = "DELETE FROM Rental WHERE CustomerID=" + a;
              String remove2 = "DELETE FROM Revenus WHERE CustomerID=" +a;
              String remove3 = "DELETE FROM Customer WHERE id=" +a;
              s.executeUpdate(remove1);
              s.executeUpdate(remove2);
              s.executeUpdate(remove3);
                    JOptionPane.showMessageDialog(null,"you have success delete the value");
              s.close();
             else//???????????????????????????????
                  JOptionPane.showMessageDialog(null,"I could not found the value"); -------------------------------------------------------------------
    My whole program
    import java.sql.*;
    import java.awt.BorderLayout;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JOptionPane;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    public class DeleteC extends JFrame
        public static int index=0;   
        public static ResultSet rs;
        public static Statement s;
        public static Connection c;
        public static  Object cols[][];
        private static JTable table;
        private static JScrollPane scroller;
        private static int flag=0;
        public DeleteC()
            //information of our connection
            //the url of the database: protocol:subprotocol:subname:computer_name:port:database_name
            String strUrl      = "jdbc:oracle:thin:@augur.scms.waikato.ac.nz:1521:teaching";
            //user name and password
            String strUser      = "xbl1";
            String strPass      = "19681978";
            //try to load the driver
            try {
                Class.forName("oracle.jdbc.driver.OracleDriver");
            catch (ClassNotFoundException e) {
                System.out.println( "Cannot load the Oracle driver. Include it in your classpath.");
                System.exit( -1);
            //a null reference to a Connection object
            c = null;
            try {
                //open a connection to the database
                c = DriverManager.getConnection( strUrl, strUser, strPass);
            catch (SQLException e) {
                System.out.println("Cannot connect to the database. Here is the error:");
                e.printStackTrace();
                System.exit( -1);
           //create a statement object to execute sql statements
        public void getData(String a){
            try {
             //create a statement object to execute sql statements
             s = c.createStatement();
                int index=0;
                Integer aInt= Integer.valueOf(a);
                Integer bInt;
                  //our example query
                String strQuery = "select id from customer";
                //execute the query
                ResultSet rs = s.executeQuery( strQuery);
                //while there are rows in the result set
                while( rs.next()) {
                    System.out.println("i am testing");
                    bInt=new Integer(rs.getInt("id"));
                    if(aInt.equals(bInt)){
                  //JOptionPane.showMessageDialog(null,"I found the value"); 
                  flag=1;
                        break;
             System.out.println("falg" + flag);
                if(flag==1){
              String remove1 = "DELETE FROM Rental WHERE CustomerID=" + a;
              String remove2 = "DELETE FROM Revenus WHERE CustomerID=" +a;
              String remove3 = "DELETE FROM Customer WHERE id=" +a;
              s.executeUpdate(remove1);
              s.executeUpdate(remove2);
              s.executeUpdate(remove3);
                    JOptionPane.showMessageDialog(null,"you have success delete the value");
              s.close();
             else
                  JOptionPane.showMessageDialog(null,"I could not found the value");
            catch (SQLException e) {
                 JOptionPane.showMessageDialog(null,"You may enter wrong id");
    My main program for user input from JTextField.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.util.*;
    public class EnterID extends JFrame{
        public JTextField tF1;
        public EnterID enID;
        public String tF1Value;
        private JLabel label1, label2, label3;
        private static JButton button;
        private static ButtonHandler handler;
        private static String aString;
        private static Integer aInteger;
        private static Integer checkV=0;
        public static void main(String args[]){
           EnterID eId= new EnterID();
       public EnterID(){
          handler=new ButtonHandler();
          Container c= getContentPane();
          c.setLayout(new GridLayout(3,1));
          button= new JButton("ok");
          button.addActionListener(handler);
          label1 = new JLabel(" CustomerID, Please");
          label2 = new JLabel("Label2");
          label3 = new JLabel();
          label3.setLayout(new GridLayout(1,1));
          label3.add(button);
          label2.setLayout(new GridLayout(1,1));
          aString = "Enter Id Here";
          tF1 = new JTextField(aString);
          label2.add(tF1);
          c.add(label1);
          c.add(label2);         
          c.add(label3);            
          setSize(150,100);
          setVisible(true);     
       private class ButtonHandler implements ActionListener{
         public void actionPerformed(ActionEvent event){
             tF1Value=tF1.getText();
            //   CheckData cData = new CheckData();
             //  aInteger = Integer.valueOf(tF1Value);      
             if(tF1Value.equals(aString)){
              JOptionPane.showMessageDialog(null,"You didn't type value into box");
              setVisible(false); 
            else {
                DeleteC dC= new DeleteC();
                dC.getData(tF1Value);
                setVisible(false); 
    }

    You may have working code now, but the code you posted is horrible and I'm going to tell you a much much much better approach for the JDBC part. (You should probably isolate your database code from your user interface code as well, but I'm skipping over that structural problem...)
    Do this instead:
        public void getData(String a){
            PreparedStatement p;
            String strQuery = "select count(*) the_count from customer where id = ?";
            try {   
             //create a prepared statement object to execute sql statements, it's better, faster, safer
             p = c.prepareStatement(strQuery);
                // bind the parameter value to the "?"
                p.setInt(1, Integer.parseInt(a) );
                //execute the query
                ResultSet rs = p.executeQuery( );
                // if the query doesn't throw an exception, it will have exactly one row
                rs.next();
                System.out.println("i am testing");
                if (rs.getInt("the_count") > 0 ) {
                // it's there, do what you need to...
             else
                  JOptionPane.showMessageDialog(null,"I could not find the value");
            catch (SQLException e) {
                 // JOptionPane.showMessageDialog(null,"You may enter wrong id");
                 // if you get an exception, something is really wrong, and it's NOT user error
            // always, always, ALWAYS close JDBC resources in a finally block
            finally
                p.close();
        }First, this is simpler and easier to read.
    Second, this retrieves just the needed information, whether or not the id is in the database. Your way will get much much slower as more data goes into the database. My way, if there is an index on the id column, more data doesn;t slow it down very much.
    I've also left some important points in comments.
    No guarantees that there isn't a dumb typo in there; I didn't actually compile it, much less test it. It's at least close though...

  • How i check what value written by Debug.write statement

    Dear All
    In java class file "Debug.write" statement is use to write intermidate result
    e.g
    Debug.write(oadbtransaction, this, "-------- submitForBaselineFlag from VO: " + s13 + " -------------", 3);
    how i check the vaue on server for these statements
    thanks & regards

    The messages should be available in the apache log.
    --Shiv                                                                                                                                                                                                   

  • 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 AM

    This 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');

  • How to pass multiple values to a single parameter in BW report URL

    Hi Experts,
    I am new to EP and learning .... i am stuck at one point where we need to pass multiple parameters to a BW report URL, this is the URL that we launch from BSP.... Suppose i have to pass different multiple values to a single parameter, how to do it....
    i m getting many answers to pass parameters to iviews, reports, but not specific to my case.. can u plz help me....
    Thanks in advance
    Priya Rai

    What is the prolem you are facing if you split the single date param as two parameters say startdate and enddate?
    If you pass as single string then you might have to split the same at reciever end.
    Are you trying any thing specific?

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • How to pass int array as an IN parameter to PLSQL Procedure

    Hi,
    How to pass int array in java to a stored procedure througn jdbc
    and what type of data type I should declare to this IN parameter
    in PLSQL Procedure.
    Thanks,
    Simi

    Hi,
    The best way to do what you want depends on what you want.  Start by describing what you need to do.  It's best to post some sample data (CREATE TABLE and INSERT statments) and what results you want from that sample data.  (See the forum FAQ: https://forums.oracle.com/message/9362002)
    If you have ideas about how to do the job (e.g., populating a temporary table) it can be helpful to include those, too, but distinguish clearly between WHAT you need to do and HOW you might do it.
    As Bencol suggested, a SYS_REFCURSOR might be the best way to pass back the results.
    Since you didn't post your table, or even describe what you wanted to do with it, I'll illustrate using scott.emp, which is probably on your system.
    Say you wanted a procedure that took a DATE as an argument, and returned a some designated columns (empno, ename and hiredate in the example below) for all employees hired on or after the given DATE.  You might write a procedure like this:
    CREATE OR REPLACE PROCEDURE  hired_since
    (   start_date  IN   DATE
    ,   out_data    OUT  SYS_REFCURSOR
    AS
    BEGIN
        OPEN out_data FOR
            SELECT  empno, ename, hiredate
            FROM    scott.emp
            WHERE   hiredate  >= start_date;
    END  hired_since;
    SHOW ERRORS
    You can test it in SQL*Plus like this:
    VARIABLE   c REFCURSOR
    EXEC  hired_since (DATE '1982-01-01', :c);
    PRINT :c
    The output I got from this test was:
         EMPNO ENAME      HIREDATE
          7788 SCOTT      19-APR-87
          7876 ADAMS      23-MAY-87
          7934 MILLER     23-JAN-82

  • How to check the values of view object?

    Hi all,
    I created a new view object by right clicking my application module. Now when I try to retrieve values
    of the attributes of the view object I am getting null pointer exception. How do I check whether the view has
    some values in it or not manually using select statement ? I try to find the view in my database at database navigator
    but it was not there. Kindly help me out in this.
    Thanks,
    Phanindra.
    Edited by: 887737 on Oct 19, 2011 12:53 AM

    Hi,
    Right click on application module(yourAM in model project) and press Run,Then you can confirm whether your ViewObject is working or not.
    Note:
    Generally create viewObject using EO based or Query based how did you create viewObject
    See:
    http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/bc4j/intro/bc_avo.html
    http://www.adftips.com/2010/09/adf-model-creating-view-object-vo.html

  • How to check wrong values in isChangedByClient

    Hi,
    I had two issues with a validation code.
    First let me describe the scenario.
    We need to update the Vendor Master.
    There should one primary contact against one Vendor Number.
    There are multiple Secondary contact against one primary contact.
    There are 4 fields for both primary and secondary contact.
    Primary Contact:
    First Name (Read Only, Mandatory).
    Last Name (Read Only, Mandatrory).
    Mobile Number (Mandatory).
    Telephone (Optional).
    Secondary Contact:
    First Name (Mandatory).
    Last Name (Mandatory).
    Mobile Number (Mandatory).
    Telephone (Optional).
    So, I need to check two validations by Java Regular Expressions,
    Name should be alphabets with ,. and space.
    Telephone Number and Mobile Number would be Numbers only.
    Now, the issue client wants the Sceondary Contacts table rows
    can be modified without selecting them.
    So, I used isChangedByClient.
    That's working fine.
    But the user gives First Name as Kaushik45 in first row of the secondary contact table
    and also types First Name as Subho67 in third row.
    The first wrong value get printed (by wdComponentAPI.getMessageManager) but
    the control goes to the last wrong value.
    This might be solved by using setLeadSelectionAt(i).
    Now, when the user types values wrongly in First Name field for Row 1 and Row 3;
    the user gets stuck in First Row.
    He modifies and then click the update again.
    This time update runs and update the wrong value at row 3.
    So, solution might be storing all wrong values of the isChangedByClient in an array and then comparing one by one.
    Please suggest.
    Regards
    Kaushik Banerjee

    Hi Ilan,
    I am pasting the code below.
    public void onActionconf(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionconf(ServerEvent)
         MessageManager msgmanager=(MessageManager)wdThis.wdGetAPI().getComponent().getMessageManager();
         IPrivateMainView.IP_personNode testNodeP = wdContext.nodeP_person();
              //IPrivateMainView.IS_personNode testNodeS = wdContext.nodeS_person();
              IPrivateMainView.IS_personNode S_personNode = wdContext.nodeS_person();
             IPrivateMainView.IS_personNode spersonNode = wdContext.nodeVendorDetails().nodeS_person();
              IPrivateMainView.IP_personElement testElementP = testNodeP.currentP_personElement();
         if(testNodeP.size()!=0){
              /*If else for tesElementP Namev null value check */          
                        if(testElementP.getNamev()!=null)
                   /*Start of if-else for testElementP Mob Number */          
                                  if(testElementP.getMob_Number()!=null){
                                       String Mob_num = testElementP.getMob_Number();
                                      String regStrforPriMob=  "[0-9]*";
                                       CharSequence chSeqForMob = Mob_num;
                                       Pattern patternForPriMob = Pattern.compile(regStrforPriMob);
                                      Matcher matcherForPriMob = null;
                                       matcherForPriMob = patternForPriMob.matcher(chSeqForMob);
                                       /* Start of matcher if-else*/
                                       if(matcherForPriMob.matches()==true){
                                            if(testElementP.getTel_Number()!=null) {
                                             String tel_num = testElementP.getTel_Number();
                                             String regStrforPriTel = "[0-9]*";
                                             CharSequence chSeqForTel = tel_num;
                                             Pattern patternForPriTel = Pattern.compile(regStrforPriTel);
                                             Matcher matcherForPriTel = null;
                                             matcherForPriTel = patternForPriTel.matcher(chSeqForTel);
                                  wdComponentAPI.getMessageManager().reportSuccess("The Telephone Number of Primary Number is matching");            
                        if(matcherForPriTel.matches()==true){
                        if(S_personNode.size()!=0){
                        //IPrivateMainView.IS_personElement S_personElement = S_personNode.currentS_personElement();
                                          //  for(int i=0;i<wdContext.nodeS_person().size();i++) {
                                                      /*Start of Secondary Contact Mob Number and Tel Number if-else */     
                                                      for(int i=0;i<wdContext.nodeS_person().size();i++){
                                                        if(wdContext.nodeS_person().getS_personElementAt(i).isChangedByClient()==true){
                                                           IPrivateMainView.IS_personElement S_personElement = (IPrivateMainView.IS_personElement)S_personNode.getElementAt(i);
                                                           String fName = wdContext.nodeS_person().getElementAt(i).getAttributeAsText("Namev");
                                                           wdComponentAPI.getMessageManager().reportSuccess("The First Name for the Secondary Contact is :"+fName);                                                                                                                        
                                                           String regStrforSecfName = "[a-zA-Z-øØæÆåÅ,. ]*";
                                                           CharSequence chSeqforSecFname = fName;
                                                           Pattern patternForSecfName = Pattern.compile(regStrforSecfName);
                                                           Matcher matcherForSecfName = null;
                                                           matcherForSecfName =  patternForSecfName.matcher(chSeqforSecFname);
                                                                                                                  //String lName = S_personElement.getName1();
                                                           String lName = wdContext.nodeS_person().getElementAt(i).getAttributeAsText("Name1");
                                                           String regStrforSeclName = "[a-zA-Z-øØæÆåÅ,. ]*";
                                                           CharSequence chSeqForSecLname = lName;
                                                           Pattern patternForSeclName = Pattern.compile(regStrforSeclName);
                                                           Matcher matcherForSeclName = null;
                                                           matcherForSeclName = patternForSeclName.matcher(chSeqForSecLname);
                                                                                                                  //String Mob_NumSec = S_personElement.getMob_Number();
                                                          String Mob_NumSec = wdContext.nodeS_person().getElementAt(i).getAttributeAsText("Mob_Number");
                                                           String regStrforSecMob ="[0-9]*";
                                                           CharSequence chSeqForMobSec = Mob_NumSec;
                                                           Pattern patternForSecMob = Pattern.compile(regStrforSecMob);
                                                           Matcher matcherForSecMob = null;
                                                           matcherForSecMob = patternForSecMob.matcher(chSeqForMobSec);
                                                        if(S_personElement.getMob_Number()!=null&&S_personElement.getNamev()!=null&&S_personElement.getName1()!=null){
                                                           //String fName = S_personElement.getNamev();
                                                                                    /* Start of matcher if-else*/
                                                           if(matcherForSecfName.matches()==true&&matcherForSeclName.matches()==true&&matcherForSecMob.matches()==true){
                                                           /* Start of City if-else */
                                                           if(S_personElement.getTel_Number()!=null){
                                                             String Tel_NumSec = wdContext.nodeS_person().getElementAt(i).getAttributeAsText("Tel_Number");
                                                             String regStrforSecTel = "[0-9]*";
                                                             CharSequence chSeqForTelSec = Tel_NumSec;
                                                             Pattern patternForSecTel = Pattern.compile(regStrforSecTel);
                                                             Matcher matcherForSecTel = null;
                                                             matcherForSecTel = patternForSecTel.matcher(chSeqForTelSec);
                                                           /* Start of matcher if-else */
                                                           if(matcherForSecTel.matches()==true&&matcherForSecfName.matches()==true&&matcherForSeclName.matches()==true&&matcherForSecMob.matches()==true){
                                                 wdComponentAPI.getMessageManager().reportSuccess("The First Name matches the pattern: "+matcherForSecfName.matches());               
                                                                                               if(wdContext.currentCheckboxckElement().getCorrespondence()==true){
             wdComponentAPI.getMessageManager().reportSuccess("Entering the if statement for executing the RFC");
                                                                                              wdThis.wdGetVdapplicationController().updVendorDetails();
                                                                                              wdThis.wdFirePlugToFinal();
                                                                                              //break;
                                                                                              else
                                                                                              {   IWDAttributeInfo atinfo = wdContext.nodeCheckboxck().getNodeInfo().getAttribute("Correspondence");
                                                                                              msgmanager.reportContextAttributeMessage(wdContext.nodeCheckboxck().getCurrentElement(),atinfo,IMessageVdapplication.KEY4,new Object[]{},true);
                                                                                              //wdComponentAPI.getMessageManager().reportException("Kryss av for korrekt informasjon før lagring",true);
                                                                                              } /* End of check box if else*/
                                                           } /* End of Secondary Contact Telephone Number matching */
                                                           else {
                                                                wdComponentAPI.getMessageManager().raiseException("The Secondary Contact Telephone Number is not matching",true);
                                                                } /* End of Secondary Telephone Number if */     
                                                             /* End of matcher if-else*/
                                                             else {
                                                                //wdComponentAPI.getMessageManager.re("The Mobile Number is not in the correct format for Secondary contact",true);
                                                    wdComponentAPI.getMessageManager().reportSuccess("The First Name was : "+wdContext.nodeS_person().getElementAt(i).getAttributeValue("Namev"));
                                                    //Object[] firName = new Object<i>;
                                                   // firName<i> = wdContext.nodeS_person().getElementAt(i).getAttributeValue("Namev");
                                                    wdContext.nodeS_person().setLeadSelection(i);      
    //                                                for(int j=0;j<firName.length;j++)
                                                      /*  try {
                                                                          String fuName = wdContext.nodeS_person().getElementAt(i).getAttributeValue("Namev").toString();
                                                                          wdComponentAPI.getMessageManager().reportSuccess("The Value of fuName: "+fuName);
                                                                                                                                           //String fName = S_personElement.getNamev();
                                                                          String regStrforFuName = "[a-zA-Z-øØæÆåÅ,. ]*";
                                                                          CharSequence chSeqforFuName = fuName;
                                                                          wdComponentAPI.getMessageManager().reportSuccess("The Value of CharSequence "+chSeqforFuName);
                                                                          Pattern patternForSecFuName = Pattern.compile(regStrforFuName);
                                                                          Matcher matcherForSecFuName = null;
                                                                          matcherForSecFuName =  patternForSecFuName.matcher(chSeqforFuName);
                                                                          wdComponentAPI.getMessageManager().reportSuccess("The matcherForSecFuName is "+matcherForSecFuName);
                                                                          if(matcherForSecFuName.matches()==false){
                                                                          wdComponentAPI.getMessageManager().reportException("Error in the First Name",true);
                                                         catch(ArrayIndexOutOfBoundsException ae){
                                                              ae.printStackTrace();
                                                         catch(Exception e){
                                                              e.printStackTrace();
                                                   //String fuName = wdContext.nodeS_person().getElementAt(i).getAttributeValue("Namev");
                                                                wdComponentAPI.getMessageManager().reportException("The First Name, Last Name or Mobile Number is not in the correct format for Secondary contact",true);
                          //     break;
                                                        else {
                                                                                                               wdComponentAPI.getMessageManager().raiseException("First Name, Last Name, Mobile Number is blank",true);
                                               else {
                                                    wdComponentAPI.getMessageManager().raiseException("The Telephone Number of the Primary Contact is in the Correct format",true);
                                            } /* Telephone Number element null*/
                                            //else{}
                        /*Start of Secondary Contact Size if-else */                    
                                  /* End of if-else for Secondary Contact Size */
    //                 else {
    //                      wdComponentAPI.getMessageManager().reportException("The Mobile No of the Primary Contact is not in the correct format",true);                            
                        /* End of matcher if-else for Primary Contact*/
                        else{
                             wdComponentAPI.getMessageManager().reportException("Primary Contact Mobile Nunber is not in the correct format",true);
                   /* if for testElementP Mob Number */
                   else {
                        wdComponentAPI.getMessageManager().reportException("No Primary Contact Mobile Number",true);
              } /* End of If else for tesElementP Namev null value check */     
                        else {
                             wdComponentAPI.getMessageManager().reportException("There is no First Name for Primary Contact",true);          
        }// else if for testNodeP size closed
        else{
             wdComponentAPI.getMessageManager().reportException("There is no element in Primary Contact",true);
        //@@end
    Regards
    Kaushik Banerjee

  • How to Check Characterstic Values  assigned  for a material

    Hi ,
    My requirement is , to  check  each and every material entered in the selection screen  and characterstic values assigned to this,
    I dont need characterstic values  for a material, i have to check whether characterstic values assigned or not , if not i have to give a message..
    I used  CLAF_CLASSIFICATION_OF_OBJECTS FM  for  getting charactersic values
    it is giving NO classification found , but for tghat material classification is existing subsequently characterstic values are also there, i passed material no with leading zeros also.
    i used WMCL_MAT_READ_CHAR_VALUES FM also  , but it is giving  No charcterstic values found for that Material  but characterstic values are assigned for that Material..
    Could u please find out ,where  i am missing

    THIS MATERIAL HAS CLASSIFICATION VIEW  AND CHARACTERSTIC VALUES ALSO MAINTAINED
    DATA : MATNO TYPE AUSP-OBJEK,
          L TYPE I,
    T_CLASS TYPE STANDARD TABLE OF  SCLASS ,
    T_OBJECTDATA TYPE STANDARD TABLE OF  CLOBJDAT.
    MATNO ='631165'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = MATNO
    IMPORTING
       OUTPUT        = MATNO
    "use this function moduel...
    *Retrieve Batch class , characteristic name and values for Material
      CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
        EXPORTING
         class              = 'ZCA2535'
          classtype          =  '023'
         features           = 'X'
          language           = 'E'
          object             =  MATNO      "pass material number with leading zeros..
          objecttable        = 'MARA'  
        TABLES
          t_class            = t_class
          t_objectdata       = t_objectdata
        EXCEPTIONS
          no_classification  = 1
          no_classtypes      = 2
          invalid_class_type = 3
          OTHERS             = 4.
      IF sy-subrc = 0.
    ENDIF.
    BUT IT IS GIVING   NO CLASSIFICATION FOUND

Maybe you are looking for

  • Can I add a NAS via ethernet to the Time Capsule network?

    "I'm a PC," but am sick of spending all my time with Windows/Network conflicts and am getting ready to take the plunge into the Mac world (insert applause here). My router/switch is old, and I want "n" wireless capability, so my plan here is to go wh

  • Can't get emails on my ipad

    Very strange ... One day, out of the blue, my ipad stopped receiving emails in one of the three accounts that I have configured in it. Nothing had changed.  It just said that either the user name or password were wrong. I chanted my password, I updat

  • Unable to create "filename.dmg" (error -60008) {Disk Utility Problem}

    Hi: I've used Disk Utilities awesome capabilities many times, but am now running into my first real problem. I am trying to create a 100 GB new blank disk image, using the "Mac OS Extended (Journaled) option for format, 256-bit AES encryption, a sing

  • MOST VISITED FOLDER all screwed up! Top sites gone; collecting all pages seen...How to fix?

    Top sites have disappeared from MOST VISITED FOLDER and is collecting ALL pages visited. I am having to delete as I surf. Additionally, the top sites just stayed in the MOST VISITED folder after I deleted them from showing up on the Bookmarks Toolbar

  • Edit External Tool error in 1.1.0.21.97

    From the Edit External Tools Wizard, clicking on Display or Next Button to go to Step 2 of the Wizard gives the following stack trace: java.lang.NullPointerException      at oracle.ide.net.URLFileSystemHelper.getPath(URLFileSystemHelper.java:429)