How to retrieve the data from a jsp page for print?
i have a dynamic jsp file which will get the data at runtime.I have a print button in the jsp.When i chick the print button it should capture the data from the jsp and print it as LANDSCAPE mode. Now i am using Java Api for this
Following code is a working sample which prints some data in LANDSCAPE mode..This is working fine....How can i modify this to get the data from a jsp?....I am using weblogic workshop for development
package Awtjava;
//working example
import java.awt.*;
import java.awt.print.*;
public class testPrint implements Printable {
private static String s[];
private static Font f;
private static int nLines;
public static void main (String arg[]){
s = new String[10];
f = new Font("Arial", Font.PLAIN, 11);
int i;
s[0] = "This is a printer test";
for (i=1; i<10; i++){
s[i] = "The next line";
nLines = 10;
testPrint.printa();
public static void printa(){
System.out.println("public static void printa () ");
PrinterJob pj=PrinterJob.getPrinterJob();
Book b = new Book();;
PageFormat pf = new PageFormat();
pf = pj.defaultPage(pf);
b.append(new testPrint(), pf, 2);
pj.setPageable (b);
try{
if (pj.printDialog()){
pj.print();
catch (Exception e) { System.out.println ("Error"); }
public int print (Graphics g1, PageFormat pf, int n){
System.out.println("public int print");
int x,y,i,fa,fh;
FontMetrics fm;
Graphics2D g = (Graphics2D) g1;
pf.setOrientation(PageFormat.LANDSCAPE);
fm = g.getFontMetrics (f);
fa = fm.getMaxAscent();
fh = fm.getHeight();
x = (int)pf.getImageableX();
y = (int)pf.getImageableY() + fa;
g.setFont (f);
g.setColor(Color.black);
if (n==1){
for (i=0; i<10; i++){
g.drawString (s, x, y);
y += fh;
return PAGE_EXISTS;
else {
for (i=10;i<10; i++){
g.drawString (s[i], x, y);
y += fh;
return PAGE_EXISTS;
Hope you will reply soon...
Thanks in advance
Maria
Hey, I got a doubt that who will call the print method in the same program and what about the g.drawString() it is showing any output effect. Finally how the variable n will get initializing to 0 and 1 for two times respectively. Can u please elaborate on this...
Similar Messages
-
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 capture the data from a JSP form
Hi
I have a JSP form, My task is to capture the data from a JSP and submit to Data Base. for example I have the field like
Enter Table name to be created in data base: The table name is to be captured by a servlet and by that table name, table should be created in the data base.
Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????
Edited by: Reddy_Prasad on ?? ?????, ???? ?:?? ???????Get the entered value from the jsp into servlet using request.getParameter("enteredTableName"). it will return the String,pass this table name to execute query using JDBC connection and statement objects.
-cheers Ram -
How to retrieve the data from Website and Upload it in SAP table?
Dear ABAPers,
I want to retrieve the data from website and upload the same in SAP Database Table is that possible.Please help me.It is very Urgent.
Thanks & Regards,
Ashok.Dear Abhishek,
Thanks for your reply.But my requirement is not met.
If i execute the program it should retrieve the data from particular website.
Thanks & Regards,
Ashok. -
How to retrieve the data from SAP database.
Hi Pals,
How to retrieve data from SAP R/3 System to my third party software. I will make my query little bit more clear. There is a list of assets entered and stored in the SAP system. For example 3 mobile phones.
1) Mobile 1- Nokia
2) Mobile 2 - Samsung
3) Mobile 3 u2013 Sony
Now think I do not know what all assets is there. I have to retrieve the data and get it on my third party software. Just display the list of assets. Lets say SAP XI is also there. Now how will I map it and get the details.
Please give me step by step method.
N.B: Just to read the data from SAP database.
Please make the flow clear step by step.
Thanking you
AKHi,
You can use RFC or ABAP Proxy to make synchronous call with SAP.
Under RFC or ABAP Proxy Program you can get the data from SAP tables. Direct access to SAP Database is not preferrable even if its possible.
The better way to go for RFC or PROXY.
You will send the request from Third party system and the it will be as input parameters from RFC/ Proxy it will response based on it.
This got it all..
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5474f19e-0701-0010-4eaa-97c4f78dbf9b
/people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
/people/stefan.grube/blog/2006/09/21/using-the-soap-inbound-channel-of-the-integration-engine
/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit - File to RFC
HTTP to RFC - A Starter Kit
/people/community.user/blog/2006/12/12/http-to-rfc--a-starter-kit
Refer
Thanks
Swarup
Edited by: Swarup Sawant on Jun 4, 2008 9:32 AM -
How to retrieve the data from the RT card after the host rebooted??
Thank you for your answer!
how to design my application to retrieve the data that was collected on RT Series hardware while the host PC was not in communication with the embedded LabVIEW RT application.I rember correctly, that may be one of the more challenging varieties to pull this stunt off.
First, you are going to have to make sure you have enough memory to buffer the data while the host if doing something else.
If you have enough memory you may want explicitly work up a comm scheem between the host and PC (probaly using VI server) that will let the host know there is data avaiailable and it should get it.
So, doe sit seem like we may be getting closer?
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
How to retrieve the data from UME?
Hi All,
I have a problem with retriving data from UME.Here my problem is I have logged a pirticular user that user coming from sales-organization. I got that user But How to retrive the pirticular sales-org from UME.
Please help me for this .
Thanks
Nageswara.Hi All,
I have a problem with retriving data from UME.Here my problem is I have logged a pirticular user that user coming from sales-organization. I got that user But How to retrive the pirticular sales-org from UME.
Please help me for this .
Thanks
Nageswara. -
How to retrieve the data from MDM hierarchy table using MDM Java API
Hi,
I had a hierarchy table in MDM. This table had some column say x. I want to retrieve the values of this x column and need to show them in a drop down using MDM Java API.
Can anyone help me to solve this?
Regards
VallabhaneniHi,
Here is your code...
TableId Hier_TId = repository_schema.getTableId(<hierarchy table id>);
java.util.List list = new ArrayList();
ResultDefinition Supporting_result_dfn = null;
FieldProperties[] Hier_Field_props =rep_schema.getTableSchema(Hier_TId).getFields();
LookupFieldProperties lookup_field = null;
TableSchema lookupTableSchema = null;
FieldId[] lookupFieldIDs = null;
for (int i = 0, j = Hier_Field_props.length; i < j; i++) {
if (Hier_Field_props<i>.isLookup()) {
lookup_field = (LookupFieldProperties) Hier_Field_props<i>;
lookupTableSchema =repository_schema.getTableSchema(lookup_field.getLookupTableId());
lookupFieldIDs = lookupTableSchema.getFieldIds();
Supporting_result_dfn = new ResultDefinition(lookup_field.getLookupTableId());
Supporting_result_dfn.setSelectFields(lookupFieldIDs);
list.add(Supporting_result_dfn);
com.sap.mdm.search.Search hier_search =new com.sap.mdm.search.Search(Hier_TId);
ResultDefinition Hier_Resultdfn = new ResultDefinition(Hier_TId);
Hier_Resultdfn.setSelectFields(rep_schema.getTableSchema(Hier_TId).getDisplayFieldIds());
ResultDefinition[] supportingResultDefinitions =
(ResultDefinition[])list.toArray(new ResultDefinition [ list.size() ]);
RetrieveLimitedHierTreeCommand retrieve_Hier_tree_cmd =
new RetrieveLimitedHierTreeCommand(conn_acc);
retrieve_Hier_tree_cmd.setResultDefinition(Hier_Resultdfn);
retrieve_Hier_tree_cmd.setSession(Auth_User_session_cmd.getSession());
retrieve_Hier_tree_cmd.setSearch(hier_search);
retrieve_Hier_tree_cmd.setSupportingResultDefinitions(supportingResultDefinitions);
try {
retrieve_Hier_tree_cmd.execute();
} catch (CommandException e5) {
// TODO Auto-generated catch block
e5.printStackTrace();
HierNode Hier_Node = retrieve_Hier_tree_cmd.getTree();
print(Hier_Node,1);
//method print()
static private void print(HierNode node, int level) {
if (!node.isRoot()) {
for (int i = 0, j = level; i < j; i++) {
System.out.print("\t");
System.out.println(node.getDisplayValue());
HierNode[] children = node.getChildren();
if (children != null) {
level++;
for (int i = 0, j = children.length; i < j; i++) {
print(children<i>, level);
//end method print()
Best regards,
Arun prabhu S
Edited by: Arun Prabhu Sivakumar on Jul 7, 2008 12:19 PM -
How to retrieve the data from the data base,-- its urgent!
public class UserInfo extends GenericServlet
public void service(ServletRequest req,ServletResponse res)throws ServletException,IOException
res.setContentType("text/html");
PrintWriter out=res.getWriter();
Connection con=null;
PreparedStatement pst=null;
ResultSet rs=null;
try{
con=DriverManager.getConnection("jdbc:mysql://localhost/userdetails","mysql","xxxx");
pst=con.prepareStatement("select * from user_info where ufn=? and uln=? and ueid=? and uname=? and upass=? and urd=? and uage=? and sem=?; ");
rs=pst.executeQuery();
if (rs.next())
{out.println("first name"+rs.getString(1)+"Last name"+rs.getString(2)+"email ID"+rs.getString(3)+"Login name"+rs.getString(4)+"password: masked <br>Registration Date "+rs.getString(7)+"Users age"+rs.getString(8)+"Employed or not if yes 1 and for No 0"+rs.getString(6) );
return ;
catch(Exception e){out.println(e);}
finally{try{con.close();}catch(Exception e){out.println(e);}}
exception : is http method not found ......
please help me1) When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. It makes it much easier to read.
2) I don't know what you are saying is not found. More information would be helpful.
3) You had better think of binding some parameters to your PreparedStatement/.
4) Please close your ResultSets and Statements as well as your Connections. -
How to retrieve the data from 3 tables
lifnr,land1,banks,bankl,bvtyp,bankn,bkont,banka,ort01,swift from LFA1,LFBK,BNKA................
please anybody can tell immediately.........Hi Ramesh,
DATA:BEGIN OF itab OCCURS 0,
lifnr LIKE lfa1-lifnr,
land1 LIKE lfa1-land1,
banks LIKE lfbk-banks,
bankl LIKE lfbk-bankl,
bvtyp LIKE lfbk-bvtyp,
bankn LIKE lfbk-bankn,
bkont LIKE lfbk-bkont,
END OF itab.
DATA:BEGIN OF itab2 OCCURS 0,
banka LIKE bnka-banka,
ort01 LIKE bnka-ort01,
swift LIKE bnka-swift,
END OF itab2.
SELECT alifnr aland1 bbanks bbankl bbvtyp bbankn b~bkont INTO TABLE itab
FROM ( lfa1 AS a INNER JOIN lfbk AS b ON blifnr = alifnr ).
select banka ort01 swift from BNKA
into table itab2
for all entries in itab
where banks = itab-banks
and bankl = itab-bankl.
Regards
- Gopi -
How to retrieve the data from database table to the screens
Hi all,
I have created a transaction to save the costing details..but if the material code already exists then it should get the header and details of that material code onto the table cotrol of the screen..i'm getiing them into my itab but only the last record of that is visible for n times as there are n records...can anyone help me in this?Dear anil ,
Please give condtion in u r code on line item wise so its taking all records correctly.
Regards ,
Nikhil narkhede. -
How to retrive the data from structure
Hi Guru's,
I have an doubt in how to retrieve the data from the standard structure or view .i want to retrieve the data from std structure name is (IOOPCOMP) in that structure i want to fetch the field DENMNG ,MENGE,EINHEIT how do i write select query to print the value . if any one can have any example structure related program give me its very helpful for me.
with regards,
senHello Senthil
The solution for your problem is trivial. Checking the Where-Used-List for structure IOOPCOMP (on release 4.6c) there is neither a function module nor a class using this structure (or fields of it).
However, the structure is used in the following list of programs:
PPIO_ENTRY
PPIOA000
PPIOB000
PPIOC000
PPIOD000
PPIOE000
PPIOF000
PPIOG000
PPIOH000
PPIOI000
PPIOK000
PPIOM000
PPIOO000
PPIOQ000
PPIOR000
PPIOS000
PPIOT000
PPIOW000
PPKALKFI
PPPIA000
PPPID000
PPPIG000
PPPIH000
PPPII000
PPPIK000
PPPIM000
PPPIO000
PPPIQ000
PPPIR000
PPPIT000
PPPIW000
RCCLORD
SAPDBIOC
SAPLCOWORK240
SELECT_OPERATION
If you know judging from your business context which program is the right one you are half-way on the home stretch.
Regards
Uwe -
How to retrieve multiple data from table and represent it in jsp page
Hi
The below JavaScript code is used to add row in the table when I want to add multiple row data into table for single entry no field.
<html> function addRow()
i++;
var newRow = document.all("tblGrid").insertRow();
var oCell = newRow.insertCell();
oCell.innerHTML = "<input name='srno"+i+"' type='text' id='srno"+i+"' size=10>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='itmcd"+i+"' type='text' id='itmcd"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='itmnm"+i+"' type='text' id='itmnm"+i+"' size='15'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='indentqty"+i+"' type='text' id='indentqty"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='uom"+i+"' type='text' id='uom"+i+"' size='10'><input type='hidden' name='mcode"+i+"'id='mcode"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='packqty"+i+"' type='text' id='packqty"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='packuom"+i+"' type='text' id='packuom"+i+"' size='10'><input type='hidden' name='pack"+i+"' id='pack"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='rate"+i+"' type='text' id='rate"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='dor"+i+"' type='text' id='dor"+i+"' size='0' onClick='"+putdate(this.name)+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='bccode"+i+"' type='text' id='bccode"+i+"' size='10'></td><input type='hidden' name='bcc"+i+"' id='bcc"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='cccode"+i+"' type='text' id='cccode"+i+"' size='10'></td><input type='hidden' name='ccc"+i+"' id='ccc"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='remark2"+i+"' type='text' id='remark2"+i+"' size='20'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input type='button' value='Delete' onclick='removeRow(this);' />";
// oCell = newRow.insertCell();
// oCell.innerHTML = "<input type='button' value='Clear' onclick='clearRow(this);' />";
}<html> Then this data are send to the next Servlet for adding into two table.
My header portion data are added into one table which added only one row in table. while footer section data are added into the no of rows in another table dependent on No. of
Rows added into jsp page.
Here is an code for that logic.
<html>
ArrayList<String> mucode = new ArrayList<String>();
ArrayList<Integer> serials = new ArrayList<Integer>();
ArrayList<Integer> apxrate = new ArrayList<Integer>();
ArrayList<Integer> srname = new ArrayList<Integer>();
ArrayList<String> itcode = new ArrayList<String>();
ArrayList<String> itname = new ArrayList<String>();
ArrayList<Integer> iqnty = new ArrayList<Integer>();
ArrayList<String> iuom = new ArrayList<String>();
ArrayList<Integer> pqnty = new ArrayList<Integer>();
ArrayList<String> puom1 = new ArrayList<String>();
ArrayList<Integer> arate = new ArrayList<Integer>();
ArrayList<String> rdate = new ArrayList<String>();
ArrayList<String> bcs = new ArrayList<String>();
ArrayList<String> ccs = new ArrayList<String>();
ArrayList<String> remarkss = new ArrayList<String>();
//ArrayList<Integer> qtyrecs = new ArrayList<Integer>();
//ArrayList<String> dors = new ArrayList<String>();
//ArrayList<String> remarks = new ArrayList<String>();
String entryn = request.getParameter("entryno");
String rows = request.getParameter("rows");
out.println(rows);
//String Entryno = request.getParameter("entryno");
// out.println(Entryno);
int entryno = 0,reqqty = 0,srno = 0,deprequest = 0,rowcount = 0;
if(!Entryno.equals("")){
entryno = Integer.valueOf(Entryno);
if(!rows.equals("")){
rowcount = Integer.valueOf(rows);
for(int i=1;i<=rowcount;i++){
if(request.getParameter("srno"+i)!=null){
serials.add(Integer.valueOf(request.getParameter("srno"+i).trim()));
out.println(serials.size());
for(int i=1;i<=rowcount;i++){
if(request.getParameter("srno"+i)!=null){
srname.add(Integer.valueOf(request.getParameter("srno"+i).trim()));
out.println(srname.get(0));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("itmcd"+i)!=null){
itcode.add(request.getParameter("itmcd"+i).trim());
} //out.println(itcode.get(i));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("itmnm"+i)!=null){
itname.add(request.getParameter("itmnm"+i).trim());
}//out.println(itname.get(i));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("indentqty"+i)!=null){
iqnty.add(Integer.valueOf(request.getParameter("indentqty"+i).trim()));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("uom"+i)!=null){
iuom.add(request.getParameter("uom"+i).trim());
}//out.println(iuom.get(i));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("mcode"+i)!=null){
mucode.add(request.getParameter("mcode"+i).trim());
for(int i=1;i<=rowcount;i++){
if(request.getParameter("packqty"+i).equals("")){
pqnty.add(0);
}else
pqnty.add(Integer.valueOf(request.getParameter("packqty"+i).trim()));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("pack"+i)!=null){
puom1.add(request.getParameter("pack"+i).trim());
}else
puom1.add("");
for(int i=1;i<=rowcount;i++){
if(request.getParameter("rate"+i).equals("")){
arate.add(0);
}else
arate.add(Integer.valueOf(request.getParameter("rate"+i).trim()));
/* for(int i=1;i<=rowcount;i++){
if(request.getParameter("rate"+i)!=null){
arate.add(Integer.valueOf(request.getParameter("rate"+i).trim()));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("dor"+i)!=null){
try{
rdate.add(dashdate.format(slashdate.parse(request.getParameter("dor"+i).trim())));
}catch(ParseException p){p.printStackTrace();}
}else
{ rdate.add("");}
for(int i=1;i<=rowcount;i++){
if(request.getParameter("bcc"+i)!=null){
bcs.add(request.getParameter("bcc"+i).trim());
}out.println(bcs.get(0));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("ccc"+i)!=null){
ccs.add(request.getParameter("ccc"+i).trim());
}out.println(ccs.get(0));
for(int i=1;i<=rowcount;i++){
out.println("remark2");
if(request.getParameter("remark2"+i)!=null){
remarkss.add(request.getParameter("remark2"+i).trim());
}out.println(remarkss.get(0));
ArrayList<String> Idate = new ArrayList<String>();
for(int i=1;i<=rowcount;i++){
if(request.getParameter("dateindent"+i)!=null){
try{
Idate.add(dashdate.format(dashdate.parse(request.getParameter("dateindent"+i).trim())));
}catch(ParseException p){p.printStackTrace();}
String Rdate = dashdate.format(new java.util.Date());
String tdate = dashdate.format(new java.util.Date());
// String Indentdate = dashdate.format(new java.util.Date());
// String ApprovedT1 = dashdate.format(new java.util.Date());
// String ApprovedT2 = dashdate.format(new java.util.Date());
// String ApprovedT1=" ";
//String ApprovedT2="";*/
String ApprovedT1= dashdate.format(new java.util.Date());
out.println (ApprovedT1);
String ApprovedT2=dashdate.format(new java.util.Date());
out.println(ApprovedT2);
String Indentdate=(dashdate.format(slashdate.parse(request.getParameter("dateindent").trim())));
out.println(Indentdate);
String Cocode ="BML001";
out.println(Cocode);
String Deptcode = request.getParameter("dept1");
out.println(Deptcode);
String Empcode = request.getParameter("emp");
out.println(Empcode);
String Refno =request.getParameter("rtype");
out.println(Refno);
String Divcode = request.getParameter("todiv1");
out.println(Divcode);
String Usercode = "CIRIUS";
String Whcode = request.getParameter("stor");
out.println(Whcode);
// String Itemgroupcode = request.getParameter("");
String Itemgroupcode ="120000";
out.println(Itemgroupcode);
String Supplytypecode = request.getParameter("stype");
out.println(Supplytypecode);
String Delcode = request.getParameter("deliverycode");
out.println(Delcode);
String Itemclass="WS";
out.println(Itemclass);
// String Itemclass = request.getParameter("iclass");
// out.println(Itemclass);
String unitcode = request.getParameter("uni");
out.println(unitcode);
String Todivcode = request.getParameter("todiv1");
out.println(Todivcode);
String Appxrate = request.getParameter("rate");
out.println(Appxrate);
String Srno = request.getParameter("srno");
out.println(Srno);
/* String Indqty = request.getParameter("indentqty");
out.println(Indqty);*/
String Itemcode = request.getParameter("itmcd");
out.println(Itemcode);
String Othersp = request.getParameter("remark1");
out.println(Othersp);
String Reqdt = request.getParameter("dor");
out.println(Reqdt);
String Munitcode = request.getParameter("mcode");
out.println(Munitcode);
String Packqty = request.getParameter("packqty");
out.println(Packqty);
String Packuom = request.getParameter("pack");
out.println(Packuom);
String Remark2 = request.getParameter("remark2");
out.println(Remark2);
String BC = request.getParameter("bcc");
out.println(BC);
String CC = request.getParameter("ccc");
out.println(CC);
try{
st=connection.createStatement();
connection.setAutoCommit(false);
String sql="INSERT INTO PTXNINDHDR(COCODE,DEPTCODE,EMPCODE,APPROVEDT1,APPROVEDT2,INDDT,ENTRYNO,REFNO,REMARKS,DIVCODE,USERCODE,WHCODE,ITEMGROUPCODE,SUPTYPECODE,DELCODE,UNITCODE,TODIVCODE,ITEMCLASS)VALUES('"+Cocode+"','"+Deptcode+"','"+Empcode+"','"+ApprovedT1+"','"+ApprovedT2+"','"+Indentdate+"',"+Entryno+",'"+Refno+"','"+Othersp+"','"+Divcode+"','"+Usercode+"','"+Whcode+"','"+Itemgroupcode+"','"+Supplytypecode+"','"+Delcode+"','"+unitcode+"','"+Todivcode+"','"+Itemclass+"')";
out.println(sql);
st.addBatch(sql);
for(int i=0;i<serials.size();i++){
out.println("Inside the Statement");
String query3="test query for u";
out.println(query3);
String queryx="Insert into PTXNINDDTL(APXRATE,ENTRYNO,BRKNO,INDQTY,ITEMCODE,OTHERSPFCS,MUNITCODE,PACKQTY,PACKUOM,REMARKS,DIMSUBGRPCODE,DIMCODE,REQDT)VALUES("+arate.get(i)+","+entryno+","+srname.get(i)+","+iqnty.get(i)+","+itcode.get(i)+",'"+Othersp+"','"+mucode.get(i)+"',"+pqnty.get(i)+",'"+puom1.get(i)+"','"+remarkss.get(i)+"','"+bcs.get(i)+"','"+ccs.get(i)+"','"+rdate.get(i)+"')";
out.println(queryx);
st.addBatch(queryx);
int[] result=st.executeBatch();
connection.commit();
for(int k=0;k<result.length;k++)
out.println("rows updated by "+(k+1)+"insert sta:"+result[k]+"");
catch(BatchUpdateException bue)
out.println("error1;"+bue+"");
catch(SQLException sql)
out.println("error2;"+sql+"");
catch(Exception l)
out.println("error3;"+l+"");
</html>
Now I looking for to retrieve this footer section data available in multiple rows from footer table and present it in jsp page .
I am finding difficulties in how to show this multiple row data for dynamic no of rows .i.e. variable no. of rows.
I have able to show the data in Header portions of page in this ways
here i am adding the part of code which shows the data from header part of table i.e from Header table
<html>
<h2 align="center"><b>Indent Preparation</b></h2>
<div align="left">
<table width="849" border="0" cellspacing="3" cellpadding="3" align="center">
<tr>
<td ><div align="left"><b>Indent No.</b></div></td>
<td ><label>
<input name="indentno" type="text" id="indentno" size="15" value="" /><input type="hidden" name="no" id="no">
</label></td>
<td ><div align="center"><strong>Indent Date</strong></div></td>
<td ><label>
<div align="center">
<input name="dateindent" type="text" id="dateindent"value="<%=date1%>"/><input type="hidden" name="no" id="no">
</div>
</label></td>
<td> </td>
<td><div align="right"><strong>Entry No.</strong></div></td>
<%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
<td><input type="text" value="<%=hdrcode.get(3)%>" size="10"></td>
<%}else{%>
<td><input type="text" name="entryno" id="entryno" value="<%=entryNo%>"/></td>
<%}%>
<div align="right"></div>
</tr>
<tr>
<td><b>Division</b></td>
<%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
<td><input type="text" value="<%=hdrdetails.get(9)%>" size="20"</td>
<td><input type="hidden" name="div1" id="div1" value='<%=hdrcode.get(10)%>'></td>
<%}else{%>
<td><input type="text" name="div" id="div" /></td>
<td><input type="hidden" name="div1" id="div1" /> </td>
<%}%>
<td> </td>
<td> </td>
<td><div align="right"><strong>Unit</strong></div></td>
<%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
<td><input type="text" value="<%=hdrdetails.get(14)%>" size="20"</td>
<td><input type="hidden" name="uni" id="uni" value='<%=hdrcode.get(12)%>'></td>
<%}else{%>
<td><input type="text" name="unit" id="unit" /></td>
<td><input type="hidden" name="uni" id="uni" /> </td>
<%}%>
</tr>
<tr>
</html>
Any suggestion on any above works is highly appreciated.
Thanks and regards
harshalToo much code. It's also not well intented nor formatted. I don't see a question either or it got lost in that heap of unformatted code.
I will only answer the question in the thread's subject:
How to retrieve multiple data from table and represent it in jsp pageTo retrieve, make use of HttpServletRequest#getParameterValues() and/or #getParameter().
To display, make use of JSTL's c:forEach. -
How to send the data from jsp page to excel ???
hi all,
i want to send the data from my jsp form to excel sheet. any one can help me ??Hope this sample code might help :
StringBuffer data = new StringBuffer();
OutputStream ostream = response.getOutputStream();
response.setContentType("application/vnd.ms-excel");
response.setHeader( "Content-Disposition",
"attachment; filename=sample.xls" );
ostream.write(data.toString().getBytes());
ostream.flush();
Try it out.
Swathi -
How to retrieve name4 data from backend for display on View Ship-to Address
Hi Everyone,
I need your advise / help:
I added name4 in shiptodetails1.jsp for new ship-to address when ordering. This name4 can be entered, saved to backend and display before submit rder. but when dispaly the created order, the name4 data is not shown on View Ship-to party Address page. Seems address.getName4() is not enough, I need to modify some method to retrieve the data from backend address object. Can anyone guide me what and how to enhance forretrieving name4 data from backend, so it can display on View Ship-to Address?
Any advises / suggestions?
Thanks, JinHi Jin,
I hope you already found the solution but here some more detail.
I am working on ISA with ECC so I do not have an access to CRM system.
As you are facing problem to retrieve data from back-end while displaying it on order status page you can debug code of class DetailStrategyR3.class.
There is a method fillDocument this method call RFC BAPI_ISAORDER_GETDETAILEDLIST. This RFC actually read Order related data from backend and fill the SalesDocument object. Method fillDocument also call other methods like fillShipTo.
During debug in NWDS you can see address data and check the values of Address object. If Name3 or Name4 and nickName contains no value then you can't get it on JSP page because it is not coming from the RFC.
So I suggest you should first check DetailStrategyR3.class as it is preparing Document for display purpose. When you open any order on orderstatusdetail page this class comes in Action and prepare SalesDocumet with all necessary information including Ship to Address of that order. So If here you do not get value in Name3, Name4 or Nickname then you have to do some custom development
Check Below code while debug in NWDS.
//fill ship-to information on header and item level
fillShipTo(document,
partnerTable,
getDetailedList.getTableParameterList().getTable(
"ORDER_ADDRESS_OUT"),
connection);
ShipToData shipTo = document.getHeaderData().getShipToData();
orderHeader.setShipToData(shipTo);
Check shipTo object in "Variable" window while debugging. Here you will get address object and can see all the variable value like FirstName, LastName, Name1, NAme2, Name3...NickName etc..... If no value in Name3, Name4 then you will not get on Page.
I hope this will help you to understand why Name3-Name4-Nickname does not have a Value though you have provided while creating an order.
Thanks and Regards.
eCommerce Developer
Maybe you are looking for
-
Dynamic mandatory field error message is not getting displayed in webui
Hi, In Appointment if the importance is HIGH i made Location as mandatory.For this i enhanced BT126H_APPT/ApptDetails. In the get_p_location() method of BTACTIVITYYH i have written the code. Now the problem is Error message for this dynamic mandatory
-
XStep conditional formatting. Can it be determined at run time ?
Does anyone know of a way to put conditional formatting into an XStep generated table output. For example, this is what we are trying to do: - At some point after an order is generated and released, materials are issued to it. - We have created a fun
-
What will I solve this problem?
-
I am using video files (flv or smf-animation) in my captivate projects - when I publish the project as a swf-file the videos are not really integrated into the file but are delivered as an extra file - I dont know how to change this - I like to have
-
Application Approval Request Permissions
I'm trying to setup a Security Role that allows our Service Desk to approve application requests. From what I've read, all I need is Application Read and Approve. When I apply those permissions in RBA Viewer, it shows that the user should be able to