How to retrieve the minimum count of appear for a value in a particular col
Hi i just want to retreive a row that contains a minimum count of appear
in the product-code column
in the product-code column
there are product codes.
but i just want to find a product code that is appeared the least frequently.
please help me.
select * from <your table> where product_code in (select a.product_code from (select product_code,count(*) tmp from emp group by product_code)a where a.tmp=(select min(b.t
mp) from (select product_code,count(*) tmp from emp group by product_code) b));
not tested...
Message was edited by:
Dushyant
Similar Messages
-
How to retrieve the data in texts field for ME23N
hai all,
i need to do some coding for the item texts field for PO, which can be saw under ME23N. i need to retrieve the details in the text. but i have no idea how am i going to get the data from that field, which table is it under for PO?
please advice. thanksHi,
the texts will be stored in STXH table..u need to pass the four values TDOBJECT
TDNAME
TDID
TDSPRAS...U will get the text details
Or
use the FM 'READ_TEXT'.
cehck the below links
http://www.sap-basis-abap.com/sapac002.htm
FM READ_TEXT
reward if helpful.
Regards,
Nagaraj -
To retrieve the Multiple Count of Records for Multiple types
Hi Can some one help me in this:
I have a talbe (MyTable) in which a column(Column 1) will have values as (Value1, Value2 , Value3, Value4 and Value5) for Multiple Records .
I need to write a query which can give me the count of All the existing Records with the values(Value1, Value2 , Value3, Value4 and Value5) by a Single Query.The Resulting Table should have the Columns as :(Value1, Value2 , Value3, Value4 and Value5) with the Corresponding Counts in the Table.
Thanks in Advance,
vijay kumar k.
Plz help me asap as it is very much linked with my Work..Hello
Well, it always helps if you can post a create table statement, some test data, and the result you are expecting....it doesn't take long and you'll be much more likely to get a quick response from someone who has some time in between things that very much related to their work...
create table dt_test_values(col1 varchar2(10))
insert into dt_test_values values('value1')
insert into dt_test_values values('value1')
insert into dt_test_values values('value2')
insert into dt_test_values values('value2')
insert into dt_test_values values('value2')
insert into dt_test_values values('value3')
insert into dt_test_values values('value3')
insert into dt_test_values values('value4')
insert into dt_test_values values('value4')
insert into dt_test_values values('value4')
insert into dt_test_values values('value4')
insert into dt_test_values values('value5')
insert into dt_test_values values('value5')
insert into dt_test_values values('value6')
insert into dt_test_values values('value7')
insert into dt_test_values values('value7')
SQL> SELECT
2 SUM(DECODE(col1,'value1', 1, 0)) value1,
3 SUM(DECODE(col1,'value2', 1, 0)) value2,
4 SUM(DECODE(col1,'value3', 1, 0)) value3,
5 SUM(DECODE(col1,'value4', 1, 0)) value4,
6 SUM(DECODE(col1,'value5', 1, 0)) value5,
7 SUM(DECODE(col1,'value6', 1, 0)) value6,
8 SUM(DECODE(col1,'value7', 1, 0)) value7,
9 SUM(DECODE(col1,'value8', 1, 0)) value8
10 FROM
11 dt_test_values
12 /
VALUE1 VALUE2 VALUE3 VALUE4 VALUE5 VALUE6 VALUE7 VALUE8
2 3 2 4 2 1 2 0HTH
David -
How to retrieve the row in a jtree
hello
how to retrieve the current row of database when i click on a particular node in a jtree.
i had tried it in this way->
ViewObject vv=(panelBinding.getApplicationModule()).findViewObject("BranchMasterView1");
Row r=vv.getCurrentRow();
but it is not working.
actually i have to retrieve the code of a branch after clicking on a particular branch node.
thank youWhen the node is clicked, get the user object from the clicked node. That will be a JUTreeNodeBinding. From that object you can get what you want.
Sascha -
How to retrieve the multiple rows data on PDF form in a web service method using WSDL DataConnection
How to retrieve the multiple rows data on PDF form in a web service method using WSDL DataConnection.
I have a multiple rows on PDF form. All rows have 4 textfields. I want to submit the multiple rows data to a method defiened in webservice.
Unable to retrieve the data in multiple rows within webservice method.Hi Paul,
I'm now able to save the retrieved xml in a hidden text field and create dynamic table, and I'm able to fill this table from the XML, but the problem is that I could not find the correct way to loop on the xml, what I'm trying to say, the table will have number of rows with the data of the first row only, so can you tell me the right way to loop on the xml!
this is my code
TextField1.rawValue=xmlData.document.rawValue;
xfa.datasets.data.loadXML(TextField1.rawValue, true, false);
for(var i=0; i<count; i++)
xfa.form.resolveNode("form1.P1.Table1.Row1["+i+"].Num").rawValue = xfa.datasets.data.record.num.value;
xfa.form.resolveNode("form1.P1.Table1.Row1["+i+"].Name").rawValue = xfa.datasets.data.record.name.value;
Table1.Row1.instanceManager.addInstance(true);
Thanks
Hussam -
Do any of you apple geniuses out there know how to retrieve the answers to your security questions or at least reset them? Apparently its to much for the support team. Can't get an answer out of them...
Reset Security Questions
Frequently asked questions about Apple ID
Manage My Apple ID
Or you can email iTunes Support at iTunes Store Support.
If all else fails:
Go to: Apple Express Lane;
Under Product Categories choose iTunes;
Then choose iTunes Store;
Then choose Account Management;
Press Continue;
Now choose iTunes Store Security and answer the bullet questions, then click Continue;
Sign in with your Apple ID and press Continue;
Under Contact Options fill out the information and advise iTunes that you would like your security/challenge questions reset;
Click Send.
You should get a response within 24 hours by email.
Presently there appears to be problems on Apple's end, so it may be quite some time before they respond.
Another user posted the following:
I got some help from an apple assistant on the phone.
It is kind of round about way to get in
Here is what he said to do and it is working for me...
1) on the device that is asking you for the security questions go to "settings", > "store" > tap the Apple ID and choose view"Apple ID" and sign in.
2) Tap on payment information and add a credit/debit card of your preference then select "done", in the upper right corner
3) sign out and back into iTunes on the device by going to "settings"> "store" > tap the Apple ID and choose "sign-out" > Tap "sign -in" > "use existing Apple ID" and you should be asked to verify your security code for the credit /debit card and NOT the security questions.
4) At this time you can remove the card by going back in to edit the payment info and selecting "none" as the card type then saving the changes by selecting "done". You should now be able to use your iTunes store credit without answering the security questions.
It's working for me ...I just have to put in my 3 digit security pin from the credit card I am using.
Good Luck friends! -
How to retrieve the values from a table if they differ in Unit of Measure
How to retrieve the values from a table if they differ in Unit of Measure?
If no data is read
- Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
If no quanity in result internal table
- There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
- - Remove the CORRESPONDING, so quantity will fill the first field adqntp1. ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
- - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
* Fill the internal table
SELECT msehi adqntp
INTO TABLE internal table
FROM lipso2
WHERE vbeln = wrk_doc1
AND msehi IN ('KL','K15','MT').
* If required move the read quantity in the appropriate column.
LOOP AT internal_table ASSIGNING <fs>.
CASE <fs>-msehi.
WHEN 'K15'.
<fs>-adqnt2 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
WHEN 'MT'.
<fs>-adqnt3 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
ENDCASE.
ENDLOOP.
- You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
Regards,
Raymond -
How to Retrieve the Selected Values from selectOrderShuttle using ADF 11g
Hi Every One,
Does anyone has idea how to retrieve the selected Items using shuttle and Order of the items using 'SelectOrderShuttle' component ?
Thanksshuttle's valuechangeevent would fire when you shuttle items back and forth.
public void selectOrderShuttle1_valueChangeListener(ValueChangeEvent valueChangeEvent) {
ArrayList list = new ArrayList(Arrays.asList(valueChangeEvent.getNewValue()));
if (list != null){
for (int i=0; i<list.size(); i++) {
int l = list.size()-1;
val = list.get(l).toString(); //returns , delimited string
if (val != null){
val = val.replaceAll("[\\[\\]]", "");
StringTokenizer st = new StringTokenizer (val, ",");
int nto = st.countTokens ();
for (int j = 0; j < nto; j++)
String token = st.nextToken ();
.......... -
How to retrieve the vendor number during creation of Purchase Order?
Dear SAP experts,
For our Purchase Orders, during PO creation (t-code ME21 or ME21N) we want to achieve the following:-
1) default the delivery address to our plant A address if the vendor is local and
2) default the delivery address to our plant B address if the vendor is foreign.
At the moment, we are trying to use the user exit enhancement "MMDA0001" to achieve the above.
The problem is how to retrieve the vendor number from the screen so we could pass the vendor number to ZXM06U32 to check the ktokk field in LFA1 table in the whether the vendor is foreign or local.
Thank you in advance.
Regards,
Alexu can do one thing, create 2 partner function, like 1 for local, and second for import vendor.
or make 2 batch n activate vendor batch and make mandatory field from SPRO.
then goto SHD0, and do one by one step. first time take 1st requirement and second time take second . like that make two variant .
i dont know how much it will be helpful. bt i want to suggest smth like that only.
or, go for ABAPER help
thanks
nisha -
My music files etc were all located on my old laptop which was stolen. I have just plugged my iphone in to my new computer and it has deleted all my files. Has anybody got any ideas on how to retrieve the files?
WINDOWS?
Connect the iPod to your PC. If iTunes starts syncing (ie erasing) your music automatically, hit the X in the upper right hand corner of iTunes display, to the left of the search box, to stop it.
In Control Panel, Portable Media Devices, double-click your iPod.
In the Tools menu -> Options, in the View Tab, check "Show hidden files and folders."
Navigate to the Music folder. On my 'pod, the full path is
Portable Media Devices\NAME of IPOD (F:)\iPod_Control\Music
Select all the music folders, and drag and drop them into a folder on your hard drive, or directly into iTunes.
And you're done! The iPod music folder structure is strange and inexplicable, but once you move your files into iTunes you can set it to automatically organize your folder by artist and album to clean that up. (To do this, in iTunes Edit menu, choose Preferences and in the Advanced tab, check "Keep iTunes Music Folder organized."
might be out of date worth a try -
How to retrieve the data from SAP-BAPI by using VB Code
Hi ,
I am new to BAPI.
V have created an application in Visual Basic with the following fields
EmpNo , EmpName, Addr1, Addr2, City and Phone (Only for Test)
We have written the code for SAVING the data into SAP. Already we have
constructed a table with the respective fields in SAP.
For that we ourself created our own BAPI Structure / Function Group /
Function Module/ Business Object - RELEASED related elements.
1)Established the connection successfully.
2)Stored the data into SAP Successfully and v r in need of
3)HOW TO RETRIEVE THE DATA FROM SAP (USING GETLIST.....GETDETAIL....)
Following is the code :
'BAPI Structure : ZBAPIEMP
'Function Group : ZBAPIEMP
'Function Module : ZBAPI_EMP_CREATEFROMDATA
'Business Object : ZBAPIEMP
'Function Module : ZBAPI_EMP_GETLIST
Dim bapictrl As Object
Dim oconnection As Object
Dim boEmp As Object
Dim oZEmp_Header As Object
Dim oImpStruct As Object
Dim oExpStruct As Object
Dim oreturn As Object
Dim x As String
Private Sub Form_Load()
Set bapictrl = CreateObject("SAP.BAPI.1")
Set oconnection = bapictrl.Connection
oconnection.logon
Set boEmp = bapictrl.GetSAPObject("ZBAPIEMP")
Set oZEmp_Header = bapictrl.DimAs(boEmp, "CreateFromData", "EmployeeHeader")
Set oImpStruct = bapictrl.DimAs(boEmp, "GetList", "EmployeeDispStruct")
End Sub
Private Sub cmdSave_Click()
oZEmp_Header.Value("EMPNO") = txtEmpNo.Text
oZEmp_Header.Value("EMPNAME") = txtEmpName.Text
oZEmp_Header.Value("ADDR1") = txtAddr1.Text
oZEmp_Header.Value("ADDR2") = txtAddr2.Text
oZEmp_Header.Value("CITY") = txtCity.Text
oZEmp_Header.Value("PHONE") = txtPhone.Text
boEmp.CreateFromData EmployeeHeader:=oZEmp_Header, Return:=oreturn
x = oreturn.Value("Message")
If x = "" Then
MsgBox "Transaction Completed!..."
Else
MsgBox x
End If
End Sub
Private Sub cmdView_Click()
End Sub
COULD ANYBODY GUIDE ME, HOW TO RETRIEVE THE DATA FROM BAPI, FOR THE WRITTEN CODE.I didn't seen any other answers but here's how it's been done previously in our organization for a custom BAPI. In this example, we give material and language to return the part description. It's not specific to your project but may give you ideas..
-Tim
Option Compare Database
Dim SAPLOGIN As Boolean
Dim FunctionCtrl As Object
Dim SapConnection As Object
Sub SAPLOGOUT()
On Error GoTo LogoutFehler
SapConnection.logoff
SAPLOGIN = False
Exit Sub
LogoutFehler:
If Err.Number = 91 Then
Exit Sub
Else
MsgBox Err.Description, vbCritical, "Fehler-Nr." & CStr(Err.Number) & " bei SAP-Logout"
End If
End Sub
Function SAPLOG() As Boolean
'Verbindungsobjekt setzen (Property von FunctionCtrl)
Set FunctionCtrl = CreateObject("SAP.Functions")
Set SapConnection = FunctionCtrl.Connection
'Logon mit Initialwerten
SapConnection.Client = "010"
SapConnection.Language = "EN"
SapConnection.System = "PR1"
SapConnection.SystemNumber = "00"
'SapConnection.Password = ""
SapConnection.GroupName = "PR1"
SapConnection.HostName = "168.9.25.120"
SapConnection.MessageServer = "168.9.25.120"
If SapConnection.Logon(0, False) <> True Then 'Logon mit Dialog
Set SapConnection = Nothing
DoCmd.Hourglass False
MsgBox "No connection to SAP R/3 !"
SAPLOGIN = False
SAPLOG = False
Exit Function
End If
SAPLOG = True
End Function
Function MatDescr(MatNr As String)
Dim func1 As Object
Dim row As Object, X As Integer, ErsteNr As String
Dim DatensatzZähler As Long
Dim RowField(1 To 50, 0 To 1) As String, RowLine As Long
If Not SAPLOGIN Then
If Not SAPLOG() Then
MsgBox "No connection to SAP !", 16
SAPLOGOUT
Exit Function
End If
End If
' Instanziieren des Function-Objektes
Set func1 = FunctionCtrl.Add("Z_BAPI_READ_MAKT")
' Export-Paramter definieren
func1.exports("MATNR") = MatNr
func1.exports("SPRAS") = "EN"
DoEvents
If Not func1.call Then
If func1.exception <> "" Then
MsgBox "Communication Error with RFC " & func1.exception
End If
DoCmd.Hourglass False
SAPLOGOUT
Exit Function
Else
MatDescr = func1.imports("MAKTX")
End If
If MatDescr = "" Then
MatDescr = "PART NO. NOT FOUND"
End If
End Function -
How to retrieve the java object in a proxy service in osb -- Plz help
Hi all,
I have a singleton java class which runs whenever the weblogic server gets started and store the output in its object. I need to access this java object from a proxy service in osb.
We tried using java call out and retrieved that object but we couldn't know how to parse that object into XML.
We are not sure of using the java call out in osb to solve this purpose because whenever we use a java callout, that particular java code will run which is not the case of singleton class.
So kindly help us how to retrieve the java object which holds the output without running the java code every time because its already run and holding the output in its object.
Regards
Prabhuhere the doc http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html#wp1106656
but I guess you are already at the stage of getting a POJO in a first Java Callout and passing the POJO to a second Java Callout, which should then return it to OSB as a XMLObject.
My recommendation is to write a Java function which returns a XMLObject and uses a XMLCursor to populate it with the values of the POJO.
An XMLObject returned to the OSB is automatically transformed in a "XML" variable (which in reality is represented as a XMLObject in the Pipeline context)
Here some code sample:
http://www.javamonamour.org/2010/09/how-to-create-xmlobject-using-xmlcursor.html -
How to get the row Count of a ResultSet
How to get the row Count of a ResultSet
Hi
I'v tried rennie1's way ,but I only get zero,my code is:
rs.executeQuery("select count(*) from t_test");
if (rs.next()) int rowCount=rs.getInt(1);
I also tried barni's way ,but the method rs.last() and rs.beforeFirst() throw a same Exception
I tried another way,the code is:
while rs.next(){
// Do nothing ,just move the cursour to the last row
int rowCount=rs.getRow()
However,the rowCount still equal zero
Any help would be greatly apprecite!
note:
I get connection by DataSource's JNDI name from client, the Server is Weblogic Server 6, the DBMS is Oracle. -
HELP! How te retrieve the last row in MYSQL database using Servlet!
Hi ,
I am new servlets. I am trying to retireve the last row id inserted using the servlet.
Could someone show me a working sample code on how to retrieve the last record inserted?
Thanks
MY CODE
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class demo_gr extends HttpServlet {
//***** Servlet access to data base
public void doPost (HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
String url = "jdbc:mysql://sql2.njit.edu/ki3_proj";
String param1 = req.getParameter("param1");
PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
String semail, sfname, slname, rfname, rlname, remail, message;
int cardType;
sfname = req.getParameter("sfname");
slname = req.getParameter("slname");
rfname = req.getParameter("rfname");
rlname = req.getParameter("rlname");
semail = req.getParameter("semail");
remail = req.getParameter("remail");
message = req.getParameter("message");
//cardType = req.getParameter("cardType");
cardType = Integer.parseInt(req.getParameter("cardType"));
out.println(" param1 " + param1 + "\n");
String query = "SELECT * FROM greeting_db "
+ "WHERE id =" + param1 + "";
String query2 ="INSERT INTO greeting_db (sfname, slname ,semail , rfname , rlname , remail , message , cardType ,sentdate ,vieweddate) values('";
query2 = query2 + sfname +"','"+ slname + "','"+ semail + "','"+ rfname + "','"+ rlname + "','"+ remail + "','"+ message + "','"+ cardType + "',NOW(),NOW())";
//out.println(" query2 " + query2 + "\n");
if (semail.equals("") || sfname.equals("") ||
slname.equals("") || rfname.equals("") ||
rlname.equals("") || remail.equals("") ||
message.equals(""))
out.println("<h3> Please Click the back button and fill in <b>all</b> fields</h3>");
out.close();
return;
String title = "Your Card Has Been Sent";
out.println("<BODY>\n" +
"<H1 ALIGN=CENTER>" + title + "</H1>\n" );
out.println("\n" +
"\n" +
" From " + sfname + ", " + slname + "\n <br> To "
+ rfname + ", " + rlname + "\n <br>Receiver Email " + remail + "\n<br> Your Message "
+ message + "\n<br> <br> :");
if (cardType ==1)
out.println("<IMG SRC=/WEB-INF/images/bentley.jpg>");
else if(cardType ==2) {
out.println("<IMG SRC=/WEB-INF/images/Bugatti.jpg>");
else if(cardType ==3) {
out.println(" <IMG SRC=/WEB-INF/images/castle.jpg>");
else if(cardType ==4) {
out.println(" <IMG SRC=/WEB-INF/images/motocross.jpg>");
else if(cardType ==5) {
out.println(" <IMG SRC=/WEB-INF/images/Mustang.jpg>");
else if(cardType ==6) {
out.println("<IMG SRC=/WEB-INF/images/Mustang.jpg>");
out.println("</BODY></HTML>");
try {
Class.forName ("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection
( url, "*****", "******" );
Statement stmt = con.createStatement ();
stmt.execute (query2);
//String query3 = "SELECT LAST_INSERT_ID()";
//ResultSet rs = stmt.executeQuery (query3);
//int questionID = rs.getInt(1);
System.out.println("Total rows:"+questionID);
stmt.close();
con.close();
} // end try
catch (SQLException ex) {
//PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
while (ex != null) {
out.println ("SQL Exception: " + ex.getMessage ());
ex = ex.getNextException ();
} // end while
} // end catch SQLException
catch (java.lang.Exception ex) {
//PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
out.println ("Exception: " + ex.getMessage ());
} // end doGet
private void printResultSet ( HttpServletResponse resp, ResultSet rs )
throws SQLException {
try {
PrintWriter out = resp.getWriter();
out.println("<html>");
out.println("<head><title>jbs jdbc/mysql servlet</title></head>");
out.println("<body>");
out.println("<center><font color=AA0000>");
out.println("<table border='1'>");
int numCols = rs.getMetaData().getColumnCount ();
while ( rs.next() ) {
out.println("<tr>");
for (int i=1; i<=numCols; i++) {
out.print("<td>" + rs.getString(i) + "</td>" );
} // end for
out.println("</tr>");
} // end while
out.println("</table>");
out.println("</font></center>");
out.println("</body>");
out.println("</html>");
out.close();
} // end try
catch ( IOException except) {
} // end catch
} // end returnHTML
} // end jbsJDBCServletI dont know what table names and fields you have but
say you have a table called XYZ which has a primary
key field called keyID.
So in order to get the last row inserted, you could
do something like
Select *
from XYZ
where keyID = (Select MAX(keyID) from XYZ);
Good Luckwhat gubloo said is correct ...But this is all in MS SQL Server I don't know the syntax and key words in MYSQL
This works fine if the emp_id is incremental and of type integer
Query:
select *
from employee e, (select max(emp_id) as emp_id from employee) z
where e.emp_id = z.emp_id
or
select top 1 * from employee order by emp_id descUday -
How to retrieve the Conversation ID in ABAP
Does anyone know how to retrieve a conversation ID in ABAP?
You can retrieve the reference ID from SXMSPMAST but how do you retrieve the conversation ID?
Table names? FM?
ABAP not Java or UDF
All suggestions welcome.
Regards,
NayAs I said in my question, I am not asking for how to retrieve the conversation ID in a UDF. Please read my question....
I am asking, given a specific message ID, how can I retrieve the conversation id for that message ID on the ABAP stack - e.g. with a function module, what table names etc.
thanks, Nay
Maybe you are looking for
-
I have photoshop elements 13, It did open up till I had to un install it and re install it, now it is says I need windows 7 or later and I do have windows 7. Can you please help me?
-
After my system rebooted and I opened my emails in outlook, when I clicked on a hyperlink, it brought me no where. I did not get an error message. I went back in and set Firefox to my default program with all extensions and protocols for Firefox. How
-
Im trying to use cd sharing but cannot access the disc.Please Help!
Im trying to put cds on my new mba using sharing via a pc. I have installed all the necessary software and I can sucsessfully connect the two computers but when I click on the cd icon on my mba it says ' the operation cant be completed as the origina
-
Hi, Just a short question about sorting. In one of our tables, there are entries for a column that have names starting With and without capital letters. Now, is there a way to force the sort to not care whether or not the first word is Capitalized
-
Using expand appearance option
Hi, I am new to Illustrator CC ( I last used it on an iMac way back in 1994 - OS.9 as it was then). I work almost exclusively in Photoshop & Muse but I am trying to work through an Illustrator tutorial about creating buttons. Here are the instruction