on 08-27-2008 7:34 PM
Hello Guys,
I just got through the hurdle of receving IDOCS.
Now I want to read the IDOC. Especially the fields in the segments.
I am using sapjco 2.1.8
here is the sample code with which I am able to read the fields in the control record.....
For example how do I READ field VBELN in the segmen E1EDL20?????
controlRecord = function.getTableParameterList().getTable( 0 );
dataRecord = function.getTableParameterList().getTable( 1 );
if( controlRecord.getNumRows() >= 1 ) {
this.writeLogMessage( "TABNAM - " + controlRecord.getString( 0 ) );
this.writeLogMessage( "IDOCTYP - " + controlRecord.getString( 9 ) );
this.writeLogMessage( "MESTYP - " + controlRecord.getString( 11 ) );
System.out.println("MESTYP - " + controlRecord.getString( 11 ) );
while( controlRecord.nextRow() ) {
this.writeLogMessage( "TABNAM - " + controlRecord.getString( 0 ) );
this.writeLogMessage( "IDOCTYP - " + controlRecord.getString( 9 ) );
this.writeLogMessage( "MESTYP - " + controlRecord.getString( 11 ) );
}
}
if( dataRecord.getNumRows() >= 1 ) {
this.writeLogMessage( "SEGNAM - " + dataRecord.getString( 0 ) );
idocDataFile = dataRecord.getString( 0 ) + ".txt";
try {
dataOut = new PrintWriter( new FileWriter( idocDataFile ), true );
dataOut.println( dataRecord.getString( 6 ) );
System.out.println(dataRecord.getString( 6 ));
dataOut.flush();
dataOut.close();
} catch( Exception ex ) {
ex.printStackTrace();
}
while( dataRecord.nextRow() ) {
this.writeLogMessage( "SEGNAM - " + dataRecord.getString( 0 ) );
idocDataFile = dataRecord.getString( 0 ) + ".txt";
try {
dataOut = new PrintWriter( new FileWriter( idocDataFile ), true );
dataOut.println( dataRecord.getString( 6 ) );
dataOut.flush();
dataOut.close();
} catch( Exception ex ) {
ex.printStackTrace();
}
Hi shivkumar
You can go through this example given on this link
or else you can do one thing
I would suggest you to get with an ABAP programmer and sit down..debug the code, using
an idoc with a populated header text segment as you've described
above.
It's the only way that you can find out what is or isn't happening. Good
luck.
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.