on 03-24-2005 6:07 AM
Dear Friends,
I want to use <b>BAPI_SALES_CREATEFROMDAT1</b>. Can anybody tell me that how i pass the table <b>ORDER_HEADER_IN, ORDER_ITEMS_IN, ORDER_PARTNERS and ORDER_SCHEDULES_IN</b> in java program. is there any syntax for this? Write complete syntax for this.
Thanks in advance.
Hi Experts,
I have to append a table(not row) inside the table list. My input paramter consists of table which has one of the feild which is also a table. I am finding issue to append that inner table inside the main table.Please help for resolution.
Thanks in advance.
Sweta Sharma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello I came across a JAVA code which looks almost similar to one above. I was trying to understand the code but I am stuck on the part IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_MATERIAL_GETLIST"); and JCO.Table list = function.getTableParameterList().getTable("MATNRLIST");
Can you please tell where and how BAPI_MATERIAL_GETLIST & MATNRLIST has been created and how can I view it in order to get an understanding how it is getting executed. Any extra infirmation related to this like how how the executions happens would be great. Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Vikas a lot. Actually I am new to SAP world, so I did a search for the tcode for RFC function module and found SE37. Entered "BAPI_MATERIAL_GETLIST" and I was able to see the ABAP code. There were lots of tabs that was there and in the "Tables" tab I was able to see "MATNRLIST" LIKE "BAPIMATLST" where "BAPIMATLST" is a database table(using SM11) for "Material Number and Description". What I want to know is whether "MATNRLIST" is just a name that is entered while creating function module or do we create somewhere in the system using a particular TCODE(which I don't know) and then we use it during the function module creation. Just want little more in detail info regarding the MATNRLIST which you said is a table list.Thanks again.
Does this code solved your pronlem?
If so, please reward the points
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhavin,
I was having the same problem, now I solve, let me share
how to passa Tables as input parameters:
The key is to use JCO.Table. See below, and let me now if this works for you:
JCO.Table inputTable = function.getTableParameterList().getTable("DM_PERNR");
inputTable.appendRow();
inputTable.setValue("0080055", "PERNR");
inputTable.setValue(ENDDA, "ENDDA");
inputTable.setValue(BEGDA, "BEGDA");
Or also:
-
// Get a function template from the repository
IFunctionTemplate ftemplate = repository.getFunctionTemplate("BAPI_SALESORDER_SIMULATE");
// Create a function from the template
JCO.Function function = new JCO.Function(ftemplate);
// Get a client from the pool
JCO.Client client = JCO.getClient(POOL_NAME);
// Fill in input parameters
JCO.Structure orderHeader = function.getImportParameterList().getStructure("ORDER_HEADER_IN");
orderHeader.setValue( "TA", "DOC_TYPE" );
orderHeader.setValue( "0001", "SALES_ORG" );
orderHeader.setValue( "10", "DISTR_CHAN");
orderHeader.setValue( "10", "DIVISION" );
JCO.Table orderPartners = function.getTableParameterList().getTable("ORDER_PARTNERS");
orderPartners.appendRow();
// orderPartners.setValue("0001043543", "PARTN_NUMB" );
orderPartners.setValue("00010453454", "PARTN_NUMB" );
orderPartners.setValue( "AG", "PARTN_ROLE" );
JCO.Table orderItems = function.getTableParameterList().getTable("ORDER_ITEMS_IN");
orderItems.appendRow();
orderItems.setValue("A", "MATERIAL" );
orderItems.setValue( "1000", "REQ_QTY" );
orderItems.appendRow();
orderItems.setValue("B", "MATERIAL" );
orderItems.setValue( "20000", "REQ_QTY" );
orderItems.appendRow();
orderItems.setValue("C", "MATERIAL" );
orderItems.setValue( "5000", "REQ_QTY" );
orderItems.appendRow();
orderItems.setValue("D", "MATERIAL" );
orderItems.setValue( "10000", "REQ_QTY" );
orderItems.appendRow();
orderItems.setValue("E", "MATERIAL" );
orderItems.setValue( "100000", "REQ_QTY" );
// Call the remote system
client.execute(function);
// Print return message
JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
System.out.println("BAPI_SALESORDER_SIMULATE RETURN: " + ret.getString("MESSAGE"));
// Get table containing the orders
JCO.Table sales_orders = function.getTableParameterList().getTable("ORDER_ITEMS_OUT");
// Print results
if (sales_orders.getNumRows() > 0) {
// Loop over all rows
do {
System.out.println("----
");
// Loop over all columns in the current row
for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements(); ) {
JCO.Field field = e.nextField();
System.out.println(field.getName() + ":\t" + field.getString());
}//for
} while(sales_orders.nextRow());
}
else {
System.out.println("No results found");
}//if
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have tried the same code for setting table paramters. In backend, nothing is passing. I dont whether there is a java code problem or back end problem. I could not able to debug due to some authorisation.
Please let me know is there any solution and its very urgent. Below is my code:
public
ArrayList getPricingDetails(String materialNumber,String[] regiondIds){
JCoConnection conn =
null;
ArrayList pricingList =
new ArrayList();
try {
conn = getDefaultJCoConnection();
JCO.Function func = conn.getJCoFunction(
"ZSPM_GET_SORG_PRICE2");
// set the import parameter
func.getImportParameterList().setValue(materialNumber,
"IV_MATNR");
// set the import table
JCO.Table importTable = func.getTableParameterList().getTable(
"IT_REGIONS");
// set the customer number
//importTable.appendRow();
//importTable.setValue(regiondIds[0],"REGION");
if(regiondIds.length > 0) {
for (int i = 0; i < regiondIds.length; i++) {
importTable.appendRow();
//importTable.setRow(i);
importTable.setValue(regiondIds[i],
"REGION");
}
}
log.error(
"reg length: " +importTable.getNumRows());
conn.execute(func);
JCO.Table pricingTable = func.getTableParameterList().getTable(
"ET_SORG_PRICE");
log.error(
"pricingTable size: " +pricingTable.getNumRows());
if (pricingTable.getNumRows() > 0) {
pricingTable.firstRow();
Z_PricingData pricingData;
do {
pricingData =
new Z_PricingData();
pricingData.setRate(pricingTable.getString(
"KBETR"));
pricingData.setRateUnit(pricingTable.getString(
"KONWA"));
pricingData.setValidFromDate(pricingTable.getDate(
"DATAB"));
pricingData.setValidToDate(pricingTable.getDate(
"DATBI"));
pricingData.setMaterialNo(pricingTable.getString(
"MATNR"));
pricingData.setSalesOrganisation(pricingTable.getString(
"VKORG"));
pricingList.add(pricingData);
}
while (pricingTable.nextRow());
}
JCO.Structure returnTable = func.getExportParameterList().getStructure(
"RETURN");
if(returnTable != null) {
log.error(
"msg: " +returnTable.getString("MESSAGE"));
log.error(
"num: " +returnTable.getString("NUMBER"));
}
}
catch (Exception e) {
e.printStackTrace();
log.error(
"Error: " +e);
}
return pricingList;
}
}
Hi, Bhavin,
Please Read my my following weblogs.
/people/perumal.kanthan/blog/2005/03/09/handling-structuretable-transactions-using-bapis-in-web-dynpro-part-i
https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1368. [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
Hope it will solve ur problem..
Regards,
K.Perumal..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can i set the value for fields of the importing table? I have tried to append the row for the importing table following way but it is giving error.
1. ORDER_ITEMS_IN.setString("MATERIAL") = "000000000090502208";
2. ORDER_ITEMS_IN.getString("MATERIAL").setValue = "000000000090502208";
<b>ORDER_ITEMS_IN.appendRow();</b>
But it is giving error that <b>cant resolve the symbol</b> for both the cases. Give me exact way to solve this problem.
Hi,
Have you looked into the Java Connectivity Builder? It will generate the input and output classes that you need. Its available as part of web-as but you do not need web-as to run the code. You will have to add aii_proxy_rt.jar, aii_util_log.jar to your classpath for compile as well as in your servers path at runtime. I havent used JCO directly since I've discovered this tool.
Roger
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhavin,
Maybe you could have a look at the <a href="http://help.sap.com/saphelp_nw04/helpdata/en/35/42e13d82fcfb34e10000000a114084/frameset.htm">JCo documentation</a>. Especially the following links could be very helpful:
http://help.sap.com/saphelp_nw04/helpdata/en/de/e6c9255044b241a9401a3a1b7009a9/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d2/561106b8b3bc449f890cddfdc8d3e2/frameset.htm
Hope that helps,
Vladimir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.