cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a Table of a RFC-Function

Former Member
0 Kudos

Hi,

I wrote a function where I get a picture (in a byte-Array). But I get a defekt Stream from the JCO.

Several time the JCO give not the result but a ?.

Here the ASCII-Code of the orig File:

ÿØÿà JFIF ` ` ÿþ Created by AccuSoft Corp. ÿÀ ° C ! ÿÛ „

ÿÄ

ÿÄ µ } !1A Qa "q 2‘¡ #B±Á RÑð$3br‚

%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦[/code]

And here the result of the JCO:

ÿØÿà JFIF ` ` ÿþ Created by AccuSoft Corp. ÿÀ ° C ! ÿÛ ?

ÿÄ

ÿÄ µ } !1A Qa "q 2??¡ #B±Á RÑð$3br?

%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz?????????????????¢£¤¥¦[/code]

Here the code.

public byte[] getUserPicture(String arg0) throws ResourceException, IOException{

ByteArrayOutputStream out = new ByteArrayOutputStream();

if(getConnectionStatus()){

JCO.Function function = i.getFunction("HR_ESS_WHO_PROG_GET_PICTURE");

JCO.ParameterList importPara = function.getImportParameterList();

importPara.setValue(arg0, "PER_NR");

i.execute(function);

JCO.ParameterList epl = function.getTableParameterList();

JCO.Table exportData1 = epl.getTable("IMAGE_TAB");

for(int i = 0; i < exportData1.getNumRows(); i++){

exportData1.setRow(i);

byte[] bArray = exportData1.getByteArray(0);

if(bArray.length == 1023){

out.write(bArray);

byte[] temp = new byte[1];

temp[0] = 100;

out.write(temp);

}else{

out.write(bArray);

}

}

return out.toByteArray();

}

return null;

}[/code]

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

The size of one line is 1024.

if(bArray.length == 1023){
  out.write(bArray);        
  byte[] temp = new byte[1];        
  temp[0] = 100;        
  out.write(temp);      
}else{        
  out.write(bArray);      
}

In the 27 row the JCO trim the length of the line to 1023 bytes. The last byte is 100.

And for this Problem I add the byte.

Regards

Thomas

Former Member
0 Kudos

Thomas,

Could you comment this wizardy:


if(bArray.length == 1023){
  out.write(bArray);
  byte[] temp = new byte[1];
  temp[0] = 100;
  out.write(temp);
}else{
 out.write(bArray);
}

Why you have to extend 1023 bytes to 1024 bytes (1K)???

Also, I think that the reason is that the latest row contains some noise at the end, and this causes an error. All the rest of content seems to be identical.

VS

Former Member
0 Kudos

HI

GOOD

GO THROUGH THE FOLLOING LINKS,I HOPE THIS WILL HELP YOU TO SOLVE YOUR PROBLEM,

/people/tarun.telang2/blog/2005/10/01/debugging-a-rfc-call-using-jco-api

THANKS

MRUTYUN