Hi Guys,
I have a requirement to map fields from IDocs generated by SAP into flat file records using SAP Business Connector 4.6. Using the WmSamples.sample:flatFileParsing.utils. getRecordElements Java service as a model, I’ve created a new Java service, mapIDoc, to process an incoming test case. It’s failing with a java.lang.ClassCastException: com.wm.util.Table error. I’m not sure what I’m doing wrong.
To date, I’ve performed the following steps:
- Generated a DTD for my test IDoc using SAP txn WE60.
- Created a Business Connector record description from the DTD.
- Created a stub service to save the pipeline.
- Routed the test IDoc to my service.
- Modified the stub service to perform the following steps:
a. restore the pipeline
b. recordToDocument –> boundNode.
c. MAP boundNode –> record reference to the IDoc record from step 2.
d. call my mapIDoc Java service. - Traced the flow service.
mapIDoc code so far is:
public static final void mapIDoc( IData pipeline ) throws ServiceException
{
// get a cursor on the pipeline IData object
IDataCursor idcPipeline = pipeline.getCursor();
// initialize variables
IData record = null;
String message = null;
int i = 0;
// get data from pipeline
if (idcPipeline.first(“IDOC_CONTROL_REC_40”))
{
record = (IData) idcPipeline.getValue();
//print a message in the pipeline]
idcPipeline.first();
message = “Retrieved IDOC_CONTROL_REC_40”;
idcPipeline.insertAfter(“message”, message);
// record = (IData) idcPipeline.getValue();
}
// get cursor on record
//IDataCursor idcRecord = record.getCursor();
//idcRecord.destroy();
idcPipeline.destroy();
return;
}
It appears that the statement that’s failing is:
record = (IData) idcPipeline.getValue();
This comes directly out of the WmSamples getRecordElements program. Prior to calling mapIDoc, the pipeline shows, in part:
IDOC_CONTROL_REC_40
IDOC_CONTROL_REC_40[0]
IDOC_DATA_REC_40
IDOC_DATA_REC_40[0]
…
So my questions are:
- Am I going about this the right way?
- Why does the record = (IData) idcPipeline.getValue(); statement fail?
- Is there a model Java service for processing SAP IDocs that I could use?
I apologize for the length of this post and very much appreciate any help you can give me.
– Mike