on 05-09-2007 5:24 PM
Hi All,
I want to create an application in JSP DynPage which should access data from R/3. Please provide some link or tutorial how to start.
Regards
Nikhil Bansal
Hi ,
Here is What you do .
1.Write this code in a DynPage to get the Data
here i am calling a BAPI from Sales Module as Example.
public DefaultTableViewModel getData(String USER, String PWD,String R3ip) {
com.sap.mw.jco.IRepository repository;
JCO.Pool pool = JCO.getClientPoolManager().getPool("R3");
if (pool == null) {
//JCO.removeClientPool("R3");
JCO.addClientPool(
"R3",
10,
"285",
USER,
PWD,
"EN",
"R3ip",
"00");
}
repository = JCO.createRepository("TTL", "R3");
JCO.Client client = null;
// Get a function template from the repository
IFunctionTemplate ftemplate =
repository.getFunctionTemplate("BAPI_SALESORDER_GETSTATUS");
// Create a function from the template
JCO.Function function = ftemplate.getFunction();
client = JCO.getClient("R3");
JCO.ParameterList input = function.getImportParameterList();
input.setValue("0053100700", "SALESDOCUMENT");
client.execute(function);
JCO.Table sales_orders =
function.getTableParameterList().getTable("STATUSINFO");
//*********************
Vector row = new Vector();
Vector tbl = new Vector();
Vector colNames = new Vector();
// Loop over all rows
do {
// Loop over all columns in the current row
for (JCO.FieldIterator e = sales_orders.fields();
e.hasMoreElements();
) {
JCO.Field field = e.nextField();
row.add(field.getString());
//System.out.println(field.getName() + ":t" + field.getString());
} //for
tbl.add(row);
} while (sales_orders.nextRow());
sales_orders = null;
sales_orders =
function.getTableParameterList().getTable("STATUSINFO");
sales_orders.nextRow();
for (JCO.FieldIterator e = sales_orders.fields();
e.hasMoreElements();
) {
JCO.Field field = e.nextField();
colNames.add(field.getName().toString());
}
DefaultTableViewModel dtvModel =
new DefaultTableViewModel(tbl, colNames);
JCO.releaseClient(client);
//**********************
return dtvModel;
}
2. Create a Bean to Store the Data
import com.sapportals.htmlb.table.DefaultTableViewModel;
public class DataBean implements Serializable {
public DefaultTableViewModel model;
public DefaultTableViewModel getModel() {
return model;
}
public void setModel(DefaultTableViewModel model) {
this.model = model;
}
}
3. Use this Bean in JSP
<%@ taglib uri="tagLib" prefix="hbj" %>
<jsp:useBean
id="myBean"
scope="session"
class="DataBean"
/>
<hbj:content
id="myContext">
<hbj:page
title="PageTitle">
<hbj:form
id="myFormId">
<hbj:tableView
id="MessageTable"
model="myBean.model"
design="ALTERNATING"
headerVisible="true"
footerVisible="true"
fillUpEmptyRows="true"
navigationMode="BYLINE"
selectionMode="SINGLESELECT"
headerText="Inbox"
visibleFirstRow="1"
width="500">
</hbj:tableView>
</hbj:form>
</hbj:page>
</hbj:content>
4. Call the getData method in DynPage doInitialization() Method.
Here save the data in the Bean and save the bean in Session.
Thats the Complete Solution For you.
if u need further inputs do write back.
Regards
Rajendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil,
These are all very useful links,
http://help.sap.com/saphelp_nw04/helpdata/en/95/cfa441cd47a209e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2e/d2a441cd47a209e10000000a155106/content.htm
http://devnetmedia.sap.com/html/submitted_docs/htmlbManuals/HTMLB-TableView-01.html
http://help.sap.com/saphelp_nw04/helpdata/en/df/a36a3badc1b315e10000000a114084/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/19/4554426dd13555e10000000a1550b0/frameset.htm
Regards,
<b>Ramganesan K </b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil
There is a tutorial in the link mentioned by me
Here is some more links
https://wiki.sdn.sap.com/wiki/display/EP/Connectivity
regards
kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil,
You can refer to these documents.
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a83ec690-0201-0010-14ac-bd1d75e24a7d">Simplified Queries of SAP Tables from Java</a>
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2ea1d990-0201-0010-6cb3-b4722ee85d9e">Introduction to the EP Perspective within SAP NetWeaver Developer Studio</a>
Regards
Sid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil
Please go through this link
http://help.sap.com/saphelp_nw2004s/helpdata/en/44/471ce3617b14bce10000000a155369/frameset.htm
regards
kalyan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.