Skip to Content
0
Former Member
Dec 15, 2006 at 11:40 AM

record not inserting into sap table with connector framework ?

16 Views

here is the code, but record not being inserting into the table ... but same piece of code working fine while updating ... the record ...

try {

interaction = connection.createInteractionEx();

IInteractionSpec interactionSpec = interaction.getInteractionSpec();

String functionName = "Z_XYZ";

interactionSpec.setPropertyValue("Name", functionName);

String writingTable = "MYTABLE";

RecordFactory rf = interaction.getRecordFactory();

MappedRecord importParams = rf.createMappedRecord("input");

importParams.put("ATTR1", "VALUE1");

importParams.put("ATTR2", "VALUE2");

IFunction function = connection.getFunctionsMetaData().getFunction(functionName);

IStructureFactory sf = interaction.retrieveStructureFactory();

IRecordSet table = (IRecordSet) sf.getStructure(function.getParameter(writingTable).getStructure());

table.insertRow();

table.setString("ATNAME", "VALUE");

table.setString("ATWRT", "VALUE");

importParams.put(writingTable, table);

MappedRecord output = (MappedRecord) interaction.execute(interactionSpec, importParams);

} catch (Exception e) {

}

any idea?

than ks

MMK