JAVA code for fetching a single row from a table in SAP
Hi All
Can anybody please tell me how to implement the "Select Single" query in JAVA while accessing SAP
Our requirement is to fetch the Sales Document number(VBELN) by passing the Purchase Order Number(BSTKD) from any of the tables containing these two fields like VBKD.
Thanks in Advance
Sree Ramya
Hi Vijay/Rich/Ravi
I am already using this FM RFC_READ_TABLE. In this FM, we have a parameter called <b>DATA</b> in <b>TABLES</b> list. The length of the record of this table DATA is 512 charaters, whereas the length of the record of the table <b>VBKD</b>(the table which i am trying to fetch) is 586 characters. As a result of which, an exception is being thrown stating that "The record does not fit into the table <b>DATA</b>".
Plz clarify this.
Thanks,
Sree Ramya.
Similar Messages
-
ADF: How to get the attributes' values of one single row from a table?
Currently I have a table with 3 attributes, suppose A,B and C respectively. And I've added an selectionListener to this table. That means when I select one single row of this table, I wish to get the respective value of A, B and C for that particular row. How do I achieve this?
suppose the method is like:
public void selectionRow(SelectionEvent se) { //se is the mouse selection event
.......??? //what should I do to get the values of A\B\C for one single row?
Edited by: user12635428 on Mar 23, 2010 1:40 AMHi
Assuming you are using Jdev 11g.
Try with this
public void selectionRow(SelectionEvent se) {
String val = getManagedBeanValue("bindings.AttributeName.inputValue");
public static Object getManagedBeanValue(String beanName) {
StringBuffer buff = new StringBuffer("#{");
buff.append(beanName);
buff.append("}");
return resolveExpression(buff.toString());
public static Object resolveExpression(String expression) {
FacesContext facesContext = getFacesContext();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp =
elFactory.createValueExpression(elContext, expression,
Object.class);
return valueExp.getValue(elContext);
Vikram -
Best Practice for Extracting a Single Value from Oracle Table
I'm using Oracle Database 11g Release 11.2.0.3.0.
I'd like to know the best practice for doing something like this in a PL/SQL block:
DECLARE
v_student_id student.student_id%TYPE;
BEGIN
SELECT student_id
INTO v_student_id
FROM student
WHERE last_name = 'Smith'
AND ROWNUM = 1;
END;
Of course, the problem here is that when there is no hit, the NO_DATA_FOUND exception is raised, which halts execution. So what if I want to continue in spite of the exception?
Yes, I could create a nested block with EXCEPTION section, etc., but that seems clunky for what seems to be a very simple task.
I've also seen this handled like this:
DECLARE
v_student_id student.student_id%TYPE;
CURSOR c_student_id IS
SELECT student_id
FROM student
WHERE last_name = 'Smith'
AND ROWNUM = 1;
BEGIN
OPEN c_student_id;
FETCH c_student_id INTO v_student_id;
IF c_student_id%NOTFOUND THEN
DBMS_OUTPUT.PUT_LINE('not found');
ELSE
(do stuff)
END IF;
CLOSE c_student_id;
END;
But this still seems like killing an ant with a sledge hammer.
What's the best way?
Thanks for any help you can give.
WayneDo not design in order to avoid exceptions. Do not code in order to avoid exceptions.
Exceptions are good. Damn good. As it allows you to catch an unexpected process branch, where execution did not go as planned and coded.
Trying to avoid exceptions is just plain bloody stupid.
As for you specific problem. When the SQL fails to find a row and a value to return, what then? This is unexpected - if you did not want a value, you would not have coded the SQL to find a value. So the SQL not finding a value is an exception to what you intend with your code. And you need to decide what to do with that exception.
How to implement it. The #1 rule in software engineering - modularisation.
E.g.
create or replace function FindSomething( name varchar2 ) return foo.col1%type is
id foo.col1%type;
begin
select col1 into id from foo where col2 = upper(name);
return( id );
exception when NOT_FOUND then
return( null );
end;
And that is your problem. Modularisation. You are not considering it.
And not the only problem mind you. Seems like your keyboard has a stuck capslock key. Writing code in all uppercase is just as bloody silly as trying to avoid exceptions. -
Outputting Results in a single row from a Table
Afternoon folks,
I have a scenario in hand and I was hoping to get some pointers. I could write a PL/SQL program and all would be fine. I was hoping if there was a way to do it in SQL and not have to create a whole new sub-program for this. I already have a PL/SQL program that populates a table. I want to use that data now and output it in a certain manner.
Any help is greatly appreciated and this is not something I need to solve by tonight. :)
Script to create table and insert records into it:
drop table FLIGHT_ROUTES;
CREATE TABLE FLIGHT_ROUTES
(FLIGHT_NO VARCHAR2(7),
ROUTE_ID NUMBER,
DAY_OF_OPERATION NUMBER,
ORIGIN VARCHAR2(3),
DESTINATION VARCHAR2(3),
STOPVER VARCHAR2(3),
ROUTE_TYPE VARCHAR2(1)
REM INSERTING into FLIGHT_ROUTES
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,1,'SFO','LAX',null,'D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-1001',1,2,'SFO','LAX',null,'R'); -- Record 2
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,1,'SFO','JFK',null,'D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,2,'SFO','JFK','ORD','D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-2001',2,3,'SFO','JFK','DEN','R'); -- Record 5
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,1,'LAX','JFK','YYZ','D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,2,'LAX','JFK','YYC','D');
Insert into FLIGHT_ROUTES (FLIGHT_NO,ROUTE_ID,DAY_OF_OPERATION,ORIGIN,DESTINATION,STOPVER,ROUTE_TYPE) values ('UX-3001',3,3,'LAX','JFK','YUL','D');What I would like to do is output the results by Flight Number, Origin1, Destination1, Origin2, Destination 2 and Origin 3, Destination 3. The maxium number combinations per Flight is 3. The other condition is that the listing should only show the Origin and Destinations and Stopover if it's a Day time Flight. If its a Red Eye, then don't show that option. So, Record 2 would be completely omitted here as it's a Red Eye flight and Record 5 would be omitted for Origin/Destination/Stopover 3 for flight UX-2001.
Flight_No Origin1 Destination1 Stopover 1 Origin2 Destination2 Stopver2 Origin3 Destination3 Stopover3
============================================================================================================================================================
UX-1001 SFO LAX
UX-2001 SFO JFK SFO JFK ORD
UX-3001 LAX JFK YYZ LAX JFK YYC LAX JFK YULEdited by: Roxyrollers on Sep 9, 2011 3:59 PM
Edited by: Roxyrollers on Sep 9, 2011 3:59 PM
Edited by: Roxyrollers on Sep 9, 2011 4:00 PMHi,
Assuming that day_of_operation is what determines whether a row is 1, 2 or 3:
WITH got_r_num AS
SELECT f.*
, ROW_NUMBER () OVER ( PARTITION BY flight_no
ORDER BY day_of_operation
) AS r_num
FROM flight_routes f
WHERE route_type != 'R'
SELECT flight_no || ',' ||
MAX (CASE WHEN r_num = 1 THEN origin END) || ',' || -- Origin 1
MAX (CASE WHEN r_num = 1 THEN destination END) || ',' || -- Destination 1
MAX (CASE WHEN r_num = 1 THEN stopver END) || ',' || -- Stopover 1
MAX (CASE WHEN r_num = 2 THEN origin END) || ',' || -- Origin 2
MAX (CASE WHEN r_num = 2 THEN destination END) || ',' || -- Destination 2
MAX (CASE WHEN r_num = 2 THEN stopver END) || ',' || -- Stopover 2
MAX (CASE WHEN r_num = 3 THEN origin END) || ',' || -- Origin 3
MAX (CASE WHEN r_num = 3 THEN destination END) || ',' || -- Destination 3
MAX (CASE WHEN r_num = 3 THEN stopver END) AS csv_text -- Stopover 3
FROM got_r_num
GROUP BY flight_no
ORDER BY flight_no
;Output:
CSV_TEXT
UX-1001,SFO,LAX,,,,,,,
UX-2001,SFO,JFK,,SFO,JFK,ORD,,,
UX-3001,LAX,JFK,YYZ,LAX,JFK,YYC,LAX,JFK,YULThis does not assume that origin1 is always on the same row with day_of_operation=1. Origin1 will be from the row with the lowest day_of_operation, not counting red-eyes. Likewise, origin2 will be from the row with the 2nd lowest day_of_operation, whether that value is 2 or not.
If your data is such that the row with day_of_operation=n will necessarily be the nth lowest one, not counting red-eyes, then you don't need the sub-query got_r_num; just use your real table (with the condition WHERE route_type != 'R'), and use day_of_operation where I used r_num. (This is what Solomon's solution, which I just saw, does.)
Edited by: Frank Kulash on Sep 9, 2011 4:47 PM
Edited by: Frank Kulash on Sep 9, 2011 4:53 PM -
Retrieve a single row from Oracle function
Hi!
I have an Oracle function created as follow:
CREATE OR REPLACE FUNCTION user_data(userId IN users.user_id%TYPE)
RETURN users%ROWTYPE AS
userData users%ROWTYPE;
BEGIN
SELECT * INTO userData
FROM users
WHERE user_id = userId;
RETURN userData;
END user_data;
This function returns a single row from 'users' table.
I tried to retrieve that single row by mean of:
CallableStatement statement = connection
prepareCall("{ call ? := get_data(?) }");
statement.*registerOutParameter(1, OracleTypes.OTHER)*;
statement.setInt(2, 103);
statement.execute();
ResultSet rs = (ResultSet) statement.getObject(1);*
String value = rs.getString(2);
System.out.println(value);
But this code doesn't work.
I tried other OracleTypes, also. (I don't know what OracleType I receive when the Oracle function return a ROWTYPE.)
Can somebody tell me how to retrieve that single row?
What is the type of out parameter (registerOutParameter()) when the Oracle function return a ROWTYPE?
Notes: No cursor can be added. No database change is allowed.
Thank you in advance.
[Adrián E. Córdoba]
Edited by: aecordoba on Mar 18, 2011 3:58 PMaecordoba wrote:
I beg your pardon for my bad English. (It isn't my original language.)
It's not a language problem. It's that you didn't provide any details about what went wrong.
That just is my problem:
I know the retrieved result is not a result set: It's a single row.Doesn't matter if it's a single row. You have a ResultSet object. You have to call ResultSet's next() method to get to the first row, even if it's the only row.
1- Which is the Oracle type I receive in Java when the Oracle function returns a ROWTYPE?I don't know.
2- How can I get each column value when I receive a single row in Java?The same way as when there are multiple rows: For each row, call ResultSet.next() to advance to the next row, then call the appropriate ResultSet.getXxx() methods to get each column's value. Again: If you have a ResultSet, you must call next() to get to the first row, even if there is only one row. "First row out of 1 total row" is no different than "first row out of 100 total rows."
EDIT: Okay, I didn't notice before that you're using a CallableStatement with "out" parameters. I've never used one of those before, so I'm not familiar with the details. I really don't know if casting to a ResultSet is appropriate here. Do you actually have documentation that says you can do that, or are you just guessing and trying to find something that works.
Edited by: jverd on Mar 18, 2011 11:26 AM -
Adobe form from webdynpro : Getting a single row in the table
Hello,
I have a scenario in which I have to create a adobeform from webdynpro application.
I have created the form and have the context designed in place.
I am facing a problem in the table I have in my adobeform.
I am adding rows to this table dynamically using a button using "addInstance"
Now on the webdynpro side , when I try to read this table I get a single row from this table.
This row is always the first row of that table.
I checked the following things from blog /people/juergen.hauser2/blog/2006/09/12/avoiding-common-mistakes-when-using-tables-on-sap-interactive-forms , i.e. :
Cardinality of the node.
Tick on the option "Repeat Row for Each Data Item".
But still no success.
With deadlines to catch I had to post this question after trying a lot.Please help.Hello Otto,
I had found this link before and used the same solution , but unfortunately is taking a long time.
Now what I am doing is :
1. I append 10 rows into the table then bind it to the node
2. Then on the adobe form I have removed the check on "Add row for each line item" because of which it shows only 1 row
on the form.
Now I add rows dynamically, but this puts a limit on the number of rows can be added to the table i.e. 10.
But this again has added problems like while displaying the form or modifying I hav to handle it seperately and cannot use the same form as it is.( as I have removed the tick for "Add row for each line item" ).
Thanks,
Omkar Mirvankar -
Deleting single row from Special Price for Business Partners
Hi Experts,
How would I go about about deleting a single row from Special Prices for Business Partners across all BPs when for most of my BPs this is the only special price they have. I have tried using Copy Discounts function but once you are down to 0 rows the record has effectively gone from the table so there is nothing to copy.
Hopefully I won't have to go thorugh 5000 records and delete each one idividually.
Thanks
JonHi Jon,
You may try a tool called B1TCH:
/people/community.user/blog/2007/08/19/get-your-kicks-with-di-commander
Thanks,
Gordon -
Fetching more than one row from a table after selecting one value from the dropdown
Hi Experts,
How can we fetch more than one row from a table after selecting one value from the dropdown.
The scenario is that I have some entries in the dropdown like below
A B C
11256 VID 911256
11256 VID 811256
11256 SONY 11256
The 'B' values are there in the dropdown. I have removed the duplicate entries from the dropdown so now the dropdownlist has only two values.for eg- 'VID' and'SONY'. So now, after selecting 'VID' from the dropdown I should get all the 'C' values. After this the "C' values are to be passed to other methods to fetch some data from other tables.
Request your help on this.
Thanks,
Preeetam Narkhede.Hi Preetam!
I hope I understand your request proberly, since this is more about Java and less about WebDynpro, but if I'm wrong, just follow up on this.
Supposed you have some collection of your original table data stored in variable "origin". Populate a Hashtable using the values from column "B" (let's assume it's Strings) as keys and an ArrayList of whatever "C" is (let's assume String instances, too) as value (there's a lot of ways to iterate over whatever your datasource is, and since we do not know what your datasource is, maybe you'll have to follow another approach to get b and c vaues,but the principle should remain the same):
// Declare a private variable for your Data at the appropriate place in your code
private Hashtable temp = new Hashtable<String, ArrayList<String>>();
// Then, in the method you use to retrieve backend data and populate the dropdown,
// populate the Hashtable, too
Iterator<TableData> a = origin.iterator();
while (a.hasNext()) {
TableData current = a.next();
String b = current.getB();
String c = current.getC();
ArrayList<String> values = this.temp.get(b);
if (values == null) {
values = new ArrayList<String>();
values.add(c);
this.temp.put(b, values);
So after this, you'll have a Hashtable with the B values als keys and collections of C values of this particular B as value:
VID --> (911256, 811256)
SONY --> (11256)
Use
temp.keySet()
to populate your dropdown.
After the user selects an entry from the dropdown (let's say stored in variable selectedB), you will be able to retrieve the collection of c's from your Hashtable
// In the metod you handle the selection event with, get the c value collection
//and use it to select from your other table
ArrayList<String> selectedCs = this.temp.get(selectedB);
// now iterate over the selectedCs items and use each of these
//to continue retrieving whatever data you need...
for (String oneC : selectedCs) {
// Select Data from backend using oneC in the where-Clause or whatever...
Hope that helps
Michael -
Easy Question:Select many rows from a table and execute BAPI for these rows
Hi Experts,
I have created one WD project. The WD project fetches some records of backend using BAPI and displays in a table. I have to select some rows from the table and then execute BAPI for selected rows.
How I can select multiple records from the table and then execute another BAPI for selected rows.
Regards,
GaryHi,
In the Node which you binded to the table create one more attribute of type boolean.
For example your node is as below:
//Table Node
TableNode
> Att1
> Att2
> isSelected(boolean) - Newly created attribute for this requirement.
//Result Node contains the elements selected in TableNode
ResultNode
>Att1
>Att2
Now in the table create one more Column with Checkbox as tablecell editor. Now bind this boolean attribute to that check box.
Now in the code you can get the selected rows by user as below:
for(int i=0;i<TableNode().size();i++)
if(wdContext.nodeTableNode().getTableNodeElementAt(i).getIsSelected()==true)
IPrivateTestView.IResultNode element=wdContext.createResultNodeElement();
element.setAtt1(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt1());
element.setAtt2(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt2());
wdContext.nodeResultNode().addElement(element);
Regards,
Charan -
How to convert these java codes (for a feedback) to javabean?
Can anyone please help me to convert these java codes (for feedback) to javabean using the MVC Model-View-Controller pattern design?
<%
//instantiate variables
Connection con = null;
Statement stmt = null;
Statement stmt2 = null;
ResultSet rs = null;
String queryString;
int newInBoxMsg = 0;
int newSentMsg = 0;
int newSavedMsg = 0;
int newTrashCanMsg = 0;
String currentUserID = 1+"";
String adminID = 1+""; //change this ID to your adminID in the db
try
//Load the JDBC driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
//Get the connection getConnection("access driver", "userID", "password")
con = DriverManager.getConnection("jdbc:odbc:FREN_DB","","");
stmt = con.createStatement();
//sql statements: create, update, query
Calendar cl = Calendar.getInstance();
%>
<%
if(request.getMethod()=="POST"){
int y = stmt.executeUpdate("INSERT into Feedback(`whom`, `msg`, `date`)"
+" values ('"+currentUserID+"', '"+request.getParameter("date")+"', '"
request.getParameter("msg")"')");
int x = stmt.executeUpdate("INSERT into MailBox(`whom`, `who`, `mailheader`, `mailbody`, `date`)"
+" values ('"+adminID+"', '"+currentUserID+"', 'Feedback', 'We have received your feedback and we will respond to you as soon as possible', '"+request.getParameter("date")+"')");
out.println("Feedback Sent!");
else {
%>
<form name="compose" method="POST" action="Feedback.jsp">
<input name="date" type="hidden" value="<% out.println(cl.get(cl.DAY_OF_MONTH)+"/"+cl.get(cl.MONTH)+"/"+cl.get(cl.YEAR)); %>" maxlength="20">
<p>Your Feedback</p>
<p>
<textarea name="msg" cols="50" rows="10"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<%
}catch(Exception e) {
System.out.println(e);
%>Okay, first suggestion is to never create database connections in JSP/Servlet. SInce you mentioned MVC, JSP is the View, and a servlet can be the controller to process requests and redirect accordingly.
This piece of code should be in a class invoked from the model layer (business logic components) preferably with some abstraction. Maybe you should search around for DAO pattern. That might give you an idea. -
Code for fetching delivery date
Dear friends,
Please help in the code for fetching the delivery date & planned date of delivery for the materials upon entering the Sales Order Number.
Thanks,
NishuHi,
READ LIPS table with the Sales order and get the delivery number and with the delivery number go to LIKP table and get lFDAT (delivery date)and WADAT(planned Delivery date).
select vbeln
from lips
into l_vbeln
where vgbel = salesorder
and vgpos = salesorderitem.
if sy-subrc = 0.
select wadat
lfdat
into (d1 , d2)
from likp
where vbeln = l_vbeln.
endif.
Regards
vijay -
I Need Java code for following Algorithm
* I Need Java code for following algorithm. Kindly any one help.
1. Read the contents (ideas and its corresponding scores) from two files named as 'a' and 'b'.
2. Stored the file 'a' contents in array a[].
3. Stored the file 'b' contents in array b[].
4. compare both files like
if(a.equals(b[j])
Writing the common idea and add the score from file 'a' and 'b'.
else
write the uncommon idea and its score..
For example :
Form Agents.txt
action,65
architecture,85
eco-,15
essay,30
form,85
form,85
link,40
tangent,25
Form Agents1.txt
Black holes,69
essay,78
Herewith i have above mentioned two files named as Form Agents and Form Agents1.
Form Agents has eight fields
Form Agents1 has two fields
--> 'essay' is common in two files, so store the idea 'essay' and add the score from Form Agents score is '30' and Form Agents1 has 78 (essay 108).
Finally it stores idea in another file with uncommon fields also.
Please help us.We have tried with following code.
But we cant add the scores.
For Example:
Form Agents.txt --> has "essay,30"
Form Agents1.txt --> has "essay,78"
Result is: essay,108
Finally it stores idea in another file with uncommon fields also.
So Any one pls correct the following code.
try
DataOutputStream o1=new DataOutputStream(new
FileOutputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
World\\Project\\Material\\art\\System Agents\\Form Agents\\CandidateResponses\\Form
Agents.txt"));
//Reading the contents of the files
BufferedReader br= new BufferedReader(new InputStreamReader(new
FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
World\\Project\\Material\\art\\System Agents\\Form Agents\\Ideological\\Form
Agents.txt")));
BufferedReader br1= new BufferedReader(new InputStreamReader(new
FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
World\\Project\\Material\\art\\System Agents\\Form Agents\\Related\\Form
Agents.txt")));
while((s=br.readLine())!=null)
s1+=s+"\n";
while((s2=br1.readLine())!=null)
s3+=s2+"\n";
int numTokens = 0;
StringTokenizer st = new StringTokenizer(s1);
String[] a = new String[10000];
String[] br_n=new String[10000];
int i=0;
while (st.hasMoreTokens())
s2 = st.nextToken();
a=s2.substring(0,s2.length()-3);
s6=s2.substring(s2.length()-2);
br_n[i]=s6;
i++;
numTokens++;
int numTokens1 = 0;
StringTokenizer st1 = new StringTokenizer (s3);
String[] b = new String[10000];
String[] br1_n=new String[1000];
int j=0;
while (st1.hasMoreTokens())
s4 = st1.nextToken();
b[j]=s4.substring(0,s4.length()-3);
s7=s4.substring(s4.length()-2);
br1_n[j]=s7;
j++;
numTokens1++;
int x=0;
for(int m=0;m<a.length;m++)
for(int n=0;n<b.length;n++)
if(a[m].equalsIgnoreCase(b[n])){
int sc=Integer.parseInt(br_n[m]);
int sc1=Integer.parseInt(br1_n[n]);
int score=sc+sc1;
o.writeBytes(a[m]+","+score+"\n");
break;
else
o.writeBytes(a[m]+","+br_n[m]+"\n");
break;
}catch(Exception e){} -
Provide the java code for the following scenario.
Hi Experts,
I have tried with all the combinations for this scenario. As per my understanding i require java code for the following scenario
so that it becomes easy........
I require a Message mapping for this Logic.
In the Source there are 4 fields and, the Target side, the fields should appear like this.
Source Structure- File
Record
|-> Header
Order_No
Date
|-> Item
Mat_No
Quantity
Target Structure-IDoc
IDoc
|-> Header
|-> Segment
Delivery_Order_No
Recv_Date
|-> Item
|-> Segment
Delivery_Order_No
Material_Num
Recv_Quantity.
The Logic is for every Order number an IDOC is generated.And if the Material num matches then the quantity should be added. and important note is that the material numbers are different for every order number. That means if a material number is 2 in the order number A. Then the material number can never be 2 in any of the order numbers.Here is the following with an example for the above scenario.
For example:-
we have
Source Structure- File
Order-no Date Mat_No Quantity
1 01/02/2011 A 10
1 01/02/2011 B 15
1 01/02/2011 A 10
2 01/02/2011 C 10
2 01/02/2011 C 10
3 01/02/2011 D 20
3 01/02/2011 D 10
3 01/02/2011 E 25
Target Structure-IDoc
Delivery_Order_No Recv_Date Material_Num Recv_Quantity
1 01/02/2011 A 20
1 01/02/2011 B 15
2 01/02/2011 C 20
3 01/02/2011 D 30
3 01/02/2011 E 25
So for this example total of 5-Idocs created. That means for this example if Order_No is 1 When the Mat_No is A the quantity gets added. For this Scenario 1 IDoc with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) is generated by adding the quantity field in the Target Side. Similarly if Order_No is 1 when the Mat_No is B then separate IDoc is generated with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) in the Target Side. Similarly, if Order_No is 2 when the Mat_No is C, an IDoc is generated with four Fields 2 in Header(Delivery_Order_No, Recv_Date) and 2 in Item(Material_Num, Recv_Quantity) by adding the quantity field in the Target Side. ike wise the process goes on upto 3.Kindly do the needy..
Kindly provide the java code.
Thanq very much in advance..what i have understood from ur example is that u want to generate an idoc for unique combination of Order-no and Mat_No
if yes then chk the below mapping..
change the context of Order_No, Date, Mat_No and Quantity to Record (right click-> context)
1)
Order-no
----------------------concat[;]---sort----splitbyvalue(valuechanged)-----collapse context---IDoc
Mat_No
2)
Order-no
--------concat[;]---sort----splitbyvalue(value changed)---collapse context---UDF1--splitbyvalue(each value)--Delivery_Order_No
Mat_No
3)
Order-no
-----------concat[;]---sortbykey----------------------- \
Mat_No / \
Date--------------- / \
----------------------------------------------------------FormatByExample-----collapsecontext---splitbyvalue(each value)----Recv_Date
Order-no /
-----------concat[;]---sort----splitbyvalue(value changed)
Mat_No
4)
Order-no
--------concat[;]---sort----splitbyvalue(value changed)---collapse context-UDF2--splitbyvalue(each value)--Material_Num
Mat_No
5)
Order-no
-----------concat[;]---sortbykey
Mat_No /
Quantity --------------- /
----------------------------------------------------------FormatByExample-----SUM(under statistic)----Recv_Quantity
Order-no
-----------concat[;]---sort----splitbyvalue(value changed)
Mat_No
UDF1:
String [] temp= a.split(";");
return temp[0];
UDF2:
String [] temp= a.split(";");
return temp[1]; -
Hi,
Here are the steps to reproduce the problem with the examplesWebApp application
bundled with wlserver6.0(sp2):
Product: Weblogic server 6.0 (sp2)
Browser: IE 5.0
1. Add index.jsp as the welcome file in WEB-INF/web.xml
2. Create index.jsp as below:
<%
response.sendRedirect("index.html");
return;
%>
<html>
<head>
<title>Index JSP file</title>
</head>
<body>
<font color="red">This is index.jsp file </font>
</body>
</html>
3. Create index.html as below:
<html>
<head>
<title>Index HTML file</title>
</head>
<body>
<font color="red">This is index.html file </font>
</body>
</html>
4. Run the examples server and make sure examplesWebApp is deployed on the examples
server using the console
5. Access the URL http://localhost:7001/examplesWebApp
The page will display a compilation error as below:
C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
unreachable statement
out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
^
and a look at the generated java code for index.jsp (_index.java) will reveal
the erroneous code snippet below in the jsp service method:
try { // error page try block
//[ /index.jsp; Line: 1]
response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
return; //[ /index.jsp; Line: 3]
out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
} catch (Exception __ee) {
while (out != null && out != _originalOut) out = pageContext.popBody();
pageContext.handlePageException(__ee);
The above web application works fine in Tomcat 3.2.X environment. The Weblogic
server 6.0 servlet engine should not generate the "out.println()" corresponding
to the html section of index.jsp. The moment it sees the "return", it should stop
processing further.
Can someone from Weblogic support team please verify this and let me know when
this bug will be fixed?
One interesting thing I noticed was when we last tried weblogic 6.0 at its beta
stage, it worked fine after we put in a special patch jar file called "redirectfix.jar"
we received from weblogic team but somehow it got re-introduced by the time it
was released!!
We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0. Our
product has a lot of pages with such conditional {response.sendRdirect("page.jsp");return;}
blocks. We would really appreciate a faster response form weblogic team.
Thanks in advance.
sam...
Sam Palanisamy
Senior Software Engineer
Manage.com
2345 N. First Street First Floor
San Jose CA 95131
Why should it stop when it sees a return? Is that in the spec?
Peace,
Cameron Purdy
Tangosol Inc.
<< Tangosol Server: How Weblogic applications are customized >>
<< Download now from http://www.tangosol.com/download.jsp >>
"Sam Palanisamy" <[email protected]> wrote in message
news:[email protected]...
>
> Hi,
>
> Here are the steps to reproduce the problem with the examplesWebApp
application
> bundled with wlserver6.0(sp2):
>
> Product: Weblogic server 6.0 (sp2)
> Browser: IE 5.0
>
> 1. Add index.jsp as the welcome file in WEB-INF/web.xml
>
> 2. Create index.jsp as below:
> <%
> response.sendRedirect("index.html");
> return;
> %>
> <html>
> <head>
> <title>Index JSP file</title>
> </head>
> <body>
> <font color="red">This is index.jsp file </font>
> </body>
> </html>
>
> 3. Create index.html as below:
> <html>
> <head>
> <title>Index HTML file</title>
> </head>
> <body>
> <font color="red">This is index.html file </font>
> </body>
> </html>
>
> 4. Run the examples server and make sure examplesWebApp is deployed on the
examples
> server using the console
>
> 5. Access the URL http://localhost:7001/examplesWebApp
>
> The page will display a compilation error as below:
>
C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_
war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
> unreachable statement
> out.print("\r\n<html>\r\n<head>\r\n<title>Simple
html</title>\r\n</head>\r\n<body>\r\n<font
> color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
> ^
>
> and a look at the generated java code for index.jsp (_index.java) will
reveal
> the erroneous code snippet below in the jsp service method:
>
> try { // error page try block
>
> //[ /index.jsp; Line: 1]
> response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
> return; //[ /index.jsp; Line: 3]
> out.print("\r\n<html>\r\n<head>\r\n<title>Simple
html</title>\r\n</head>\r\n<body>\r\n<font
> color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
> } catch (Exception __ee) {
> while (out != null && out != _originalOut) out =
pageContext.popBody();
> pageContext.handlePageException(__ee);
> }
>
> The above web application works fine in Tomcat 3.2.X environment. The
Weblogic
> server 6.0 servlet engine should not generate the "out.println()"
corresponding
> to the html section of index.jsp. The moment it sees the "return", it
should stop
> processing further.
>
> Can someone from Weblogic support team please verify this and let me know
when
> this bug will be fixed?
>
> One interesting thing I noticed was when we last tried weblogic 6.0 at its
beta
> stage, it worked fine after we put in a special patch jar file called
"redirectfix.jar"
> we received from weblogic team but somehow it got re-introduced by the
time it
> was released!!
>
> We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0.
Our
> product has a lot of pages with such conditional
{response.sendRdirect("page.jsp");return;}
> blocks. We would really appreciate a faster response form weblogic team.
>
> Thanks in advance.
> sam...
> Sam Palanisamy
> Senior Software Engineer
> Manage.com
> 2345 N. First Street First Floor
> San Jose CA 95131
>
>
-
How to fetch rows from a table like search engines do?
Is it possible to fetch rows from a table like Google does? I want to fetch row number 20-40 after the select has ordered the rows.
Pseudo code: select * from log where rownum > 20 and rownum < 40 order by date;
Rownum doesn't work with ordering so I tried:
select * from log where (select * from log order by date) and rownum <20;
But that still doesn't do what I want. I get the "top 20" rows but I can't get rows 20-40.
My real table has 70000 rows and I want to select 69000-70000 so I really need a SQL do fetch only the rows I need.
Any help would be very appreciated!
Best regards,
Christer NordvikSELECT alias_for_rownum, column_names
FROM (SELECT ROWNUM AS alias_for_rownum, column_names
FROM (SELECT column_names
FROM table_name
ORDER BY columns_to_order_by)
WHERE ROWNUM <= last_row_you_want)
WHERE alias_for_rownum >= first_row_you_want
Example:
-- (This example uses the Oracle dept demo table.
SET AUTOTRACE ON EXPLAIN
SELECT rn, deptno, dname, loc
FROM (SELECT ROWNUM AS rn, deptno, dname, loc
FROM (SELECT deptno, dname, loc
FROM dept
ORDER BY deptno)
WHERE ROWNUM <= 3)
WHERE rn >= 2
RN DEPTNO DNAME LOC
2 20 RESEARCH DALLAS
3 30 SALES CHICAGO
Maybe you are looking for
-
I have had my ipad retina for two and a half weeks but since the week end every time i connect to the wifi network it joins then disapears as soon as i open safari for example or just disappears at intermittent intervals....i have my iphone 4s connec
-
ITunes Won't Save - Error (-50)
HELP!! My iTunes has suddenly decided to not save the library file. According to the error message, an unknown error has occurred. The number given after this information is (-50). Does anyone know what is going on?
-
Sharing folders with Samba in Mavericks
Hi, I've spent the whole afternoon trying to access some shared folders of my MacBook Pro from a machine running Ubuntu 12.04 using samba. is it possible? I read AFP is deprecated and SMB2 is going to be the standard protocol. I also read SMB2 is get
-
I received the following message when trying to register for FaceTime on my MacBook Air: the server encountered an error processing your registration on FaceTime. How do I fix that? My son uses my apple id on his iPod and iPad. I should still be able
-
Measurement of Respiratory Signals through oximeter
heHi, This is Madhusudhanan Natarajan from Anjalai Ammal Mahalingam Engg College, Kovilvenni. I would like to ask some queries related to the DAQ products.Actually, We are going to upgrade the research work of oximeter in sleep monitoring system. For