cancel
Showing results for 
Search instead for 
Did you mean: 

Data type RAW imported to ABAP from Java

Former Member
0 Kudos

Hello,

I'm using a UDF to call a Function Module (FM). The FM has several imports all of them work as expected except for the ABAP RAW data type. When I send the message id it is converting the data.

My Java code in my UDF:

public String Create_ZTOR_Rec(String MsgID,String MsgDate,String MsgTime,String PONum,Container container){
String content = "";
MappingTrace importanttrace;
importanttrace = container.getTrace();
// filling the string with our RFC-XML (with values)
String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:Z_UDF_CREATE_ZTOR_REC xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\">";
m = m + "<I_MESSAGEID>" + MsgID + "</I_MESSAGEID>";
m = m + "<I_EBELN>" + PONum + "</I_EBELN>";
m = m + "<I_ERDAT>" + MsgDate + "</I_ERDAT>";
m = m + "<I_UZEIT>" + MsgTime + "</I_UZEIT>";
m = m + "</ns0:Z_UDF_CREATE_ZTOR_REC>";
RfcAccessor accessor = null;
ByteArrayOutputStream out = null;
try
{
// 1. Determine a channel (Business system, Communication channel)
Channel channel = LookupService.getChannel("XI","GeneratedReceiverChannel_RFC");
// 2. Get a RFC accessor for a channel.
accessor = LookupService.getRfcAccessor(channel);

...etc

My FM (Z_UDF_CREATE_ZTOR_REC) imports the field I_MESSAGEID as SYSUUID which is data type RAW with a length of 16.

Does anyone know what I need to do to get the correct data to be imported into the FM?

Thanks,

Matt

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

The solution required using a JCo connection instead of the input stream. The real problem is that Message ID is of type ISO-7 while everything else was UTF-8.

Thanks,

Matt

Former Member
0 Kudos

I used SYSUUID_C as you suggested but the 32 digit message id was translated into this:

㴐庴၎縴፝㓓

Any ideas?

Thanks,

Matt

Former Member
0 Kudos

HI,

Use type TYPE SXMSGUID,

It works as written in sap help http://help.sap.com/saphelp_nw70/helpdata/EN/a7/3b2a2d45a34a23b75e3b18745c63bc/frameset.htm

Thanks,

Tuhin

Former Member
0 Kudos

So the problem appears when the data is imported by the RFC. The RFC takes the message id sent by the UDF that looks like:

49774B3347BD13F4E10000000A5060AC

and converts it to this:

E3DF3C0F8DC1140E3CD40E43135D34D3

What would cause this and how can I get the correct message id?

Thanks,

Matt

Former Member
0 Kudos

HI,

use domain SYSUUID_C in sap system to create data type.

Thanks,

Tuhin