您的位置:首页 > 编程语言 > Java开发

Tips and tricks for the Java connector

2008-12-17 10:41 633 查看
if (window.name != "content")
document.write("
Click here to show toolbars of the Web Online Help System: show toolbars
");

Tips and tricks for the Java connector

How to set and import parameter - Field
How to handle an import parameter - Table
How to handle an import parameter - Structure
How to handle an export parameter - Table
How to handle BAPI return table
Using COMMIT

How to set and import parameter - Field

Give the import parameter SALESDOCUMENT the value "00006973":

JCO.Field SalesDocumentField = jcoFunction.getImportParameterList().getField("SALESDOCUMENT");
SalesDocumentField.setValue("00006973");

How to handle an import parameter - Table

JCO.Table ORDER_PARTNERS = jcoFunction.getTableParameterList().getTable("ORDER_PARTNERS");
ORDER_PARTNERS.appendRow();
ORDER_PARTNERS.setValue("AG","PARTN_ROLE");
ORDER_PARTNERS.setValue("0000001032","PARTN_NUMB");


How to handle an import parameter - Structure

JCO.Structure order_header_inx = jcoFunction.getImportParameterList().getStructure("ORDER_HEADER_INX");
order_header_inx.setValue("I","UPDATEFLAG");
order_header_inx.setValue("X","DOC_TYPE");


How to handle an export parameter - Table

JCO.Table myTable = jcoFunction.getTableParameterList().getTable("STATUSINFO");
for (int i=0; i < myTable.getNumRows(); i++)
myTable.setRow(i);
  // Retrieve the value of the field DOC_DATE 
oDocDate = myTable.getField("DOC_DATE").getValue();

How to handle BAPI return table

Meesage type and message is stored in vector bapiReturn.
Vector bapiReturn;
JCO.Table jcoReturn = jcoFunction.getTableParameterList().getTable("RETURN");
for (int i = 0; i < jcoReturn.getNumRows(); i++)
{ jcoReturn.setRow(i);
String Message = jcoReturn.getField("TYPE").getValue() + " " +
jcoReturn.getField("MESSAGE").getValue();

bapiReturn.setSize(i + 1);
bapiReturn.setElementAt(new String(Message),i );
}


Using COMMIT

try
{ // Get a function template from the repository
IFunctionTemplate ftemplate = mRepository.getFunctionTemplate("BAPI_TRANSACTION_COMMIT");

// Create a function from the template
jcoCommit = new JCO.Function(ftemplate);

if ( jcoCommit == null )
         // Do something..;
}
catch (Exception mException)
{  mException.printStackTrace(); }

   // Execute COMMIT
try
{ sapConnection1.mConnection.execute(jcoCommit);
}
 catch (Exception mException)
{ mException.printStackTrace(); }


var fe = FindFrame("toc", top);
if ((fe != null) && (chmtop.c2wtopf.jstree != null)) {
if (chmtop.c2wtopf.FITEMS[chmtop.c2wtopf.pagenum] != chmtop.c2wtopf.pageid)
chmtop.c2wtopf.jstree.OpenTreeNode("" + chmtop.c2wtopf.pageid);
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: