ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problem sending DECIMAL numbers to SAP

Post new topic  Reply to topic Goto page 1, 2  Next
 Problem sending DECIMAL numbers to SAP « View previous topic :: View next topic » 
Author Message
artykito
PostPosted: Wed Jul 14, 2010 2:09 am    Post subject: Problem sending DECIMAL numbers to SAP Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

Hi all,

I want to send to SAP a decimal number, but I'm getting an error. The Wrapper message set has this field defined as xsd:decimal with a 16char length, and SAP is expecting 2 digits at the right side of separation point.

My input is a string like "12345", and I must have a mapping node where transform this to something like "123.45" (the last 2 digits of my input string are the decimal part).

CAST function is not supported by mapping node, so if I try to put the following expression in mapping node...:

Quote:
xs:decimal($source/msg/details/amount)


...the number obtained is "12345.00", and when I send it so SAP, all is OK, BUT this is not the number I must obtain, I need to move the decimal dot two positions to the left side, so I'm trying to create an ESQL function that divide this number, getting:

Code:
-- generateDecimal function code that returns a decimal format number
SET numFinal = amount;
SET numFinal = CAST((numFinal / 100) AS DECIMAL(16,2));
RETURN numFinal;


Where:
amount - is the input (12345) with an integer format
numFinal - is the output number (123.45) with a decimal format

So, the expression I use is:

Quote:
esql:generateDecimal($source/msg/details/amount)


And when I check the output message from the mapping I can see the number as 123.45 format, that's OK...The problem is when I use the SAPRequest node, I'm getting an error.

I captured the input Root message in the SAP Request node and the ExceptionList with a Trace node, and here is it:

Quote:
Root:

( ['MQROOT' : 0x12af020]
(0x01000000:Name ):Properties = ( ['MQPROPERTYPARSER' : 0x97b1f00]
(0x03000000:NameValue):MessageSet = 'MyInterface' (CHARACTER)
(0x03000000:NameValue):MessageType = '{http://www.ibm.com/xmlns/prod/websphere/j2ca/sap/contact admin}:contact admin' (CHARACTER)
(0x03000000:NameValue):MessageFormat = NULL
(0x03000000:NameValue):Encoding = 546 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 850 (INTEGER)
(0x03000000:NameValue):Transactional = TRUE (BOOLEAN)
(0x03000000:NameValue):Persistence = FALSE (BOOLEAN)
(0x03000000:NameValue):CreationTime = GMTTIMESTAMP '2010-07-14 09:12:27.020' (GMTTIMESTAMP)
(0x03000000:NameValue):ExpirationTime = -1 (INTEGER)
(0x03000000:NameValue):Priority = 0 (INTEGER)
(0x03000000:NameValue):ReplyIdentifier = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):ReplyProtocol = 'MQ' (CHARACTER)
(0x03000000:NameValue):Topic = NULL
(0x03000000:NameValue):ContentType = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceType = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceToken = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourcePassword = '' (CHARACTER)
(0x03000000:NameValue):IdentitySourceIssuedBy = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedType = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedToken = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedPassword = '' (CHARACTER)
(0x03000000:NameValue):IdentityMappedIssuedBy = '' (CHARACTER)
)
(0x01000000:Name ):MQMD = ( ['MQHMD' : 0x1295d48]
(0x03000000:NameValue):SourceQueue = 'MQIBEDEVIFI100' (CHARACTER)
(0x03000000:NameValue):Transactional = TRUE (BOOLEAN)
(0x03000000:NameValue):Encoding = 546 (INTEGER)
(0x03000000:NameValue):CodedCharSetId = 850 (INTEGER)
(0x03000000:NameValue):Format = ' ' (CHARACTER)
(0x03000000:NameValue):Version = 2 (INTEGER)
(0x03000000:NameValue):Report = 0 (INTEGER)
(0x03000000:NameValue):MsgType = 8 (INTEGER)
(0x03000000:NameValue):Expiry = -1 (INTEGER)
(0x03000000:NameValue):Feedback = 0 (INTEGER)
(0x03000000:NameValue):Priority = 0 (INTEGER)
(0x03000000:NameValue):Persistence = 0 (INTEGER)
(0x03000000:NameValue):MsgId = X'414d51204d4237514d4752202020202072743d4c20002f07' (BLOB)
(0x03000000:NameValue):CorrelId = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):BackoutCount = 0 (INTEGER)
(0x03000000:NameValue):ReplyToQ = ' ' (CHARACTER)
(0x03000000:NameValue):ReplyToQMgr = 'MB7QMGR ' (CHARACTER)
(0x03000000:NameValue):UserIdentifier = 'SYSTEM ' (CHARACTER)
(0x03000000:NameValue):AccountingToken = X'060101120000000000000000000000000000000000000000000000000000000b' (BLOB)
(0x03000000:NameValue):ApplIdentityData = ' ' (CHARACTER)
(0x03000000:NameValue):PutApplType = 11 (INTEGER)
(0x03000000:NameValue):PutApplName = 'I\7.0\bin\DataFlowEngine.exe' (CHARACTER)
(0x03000000:NameValue):PutDate = DATE '2010-07-14' (DATE)
(0x03000000:NameValue):PutTime = GMTTIME '09:12:27.020' (GMTTIME)
(0x03000000:NameValue):ApplOriginData = ' ' (CHARACTER)
(0x03000000:NameValue):GroupId = X'000000000000000000000000000000000000000000000000' (BLOB)
(0x03000000:NameValue):MsgSeqNumber = 1 (INTEGER)
(0x03000000:NameValue):Offset = 0 (INTEGER)
(0x03000000:NameValue):MsgFlags = 0 (INTEGER)
(0x03000000:NameValue):OriginalLength = -1 (INTEGER)
)
(0x01000000:Folder):DataObject = ( ['Dataobject' : 0xd3b978]
(0x01000000:Folder)http://www.ibm.com/xmlns/prod/websphere/j2ca/sap/sapmyinterfacewrapper:SapMyInterfaceWrapper = (
(0x01000000:Folder):SapZFiNomina = (
(0x01000000:Folder ):SapPoDetail = (
(0x03000000:PCDataField):WRBTR = 50.50 (DECIMAL)
(0x03000000:PCDataField):KOSTL = '123456' (CHARACTER)
(0x03000000:PCDataField):PERNR = '00000' (CHARACTER)
)
(0x01000000:Folder ):SapPoDetail = (
(0x03000000:PCDataField):WRBTR = 50.50 (DECIMAL)
(0x03000000:PCDataField):KOSTL = '123456' (CHARACTER)
(0x03000000:PCDataField):PERNR = '00000' (CHARACTER)
)
(0x01000000:Folder ):SapPoDetail = (
(0x03000000:PCDataField):WRBTR = 795.55 (DECIMAL)
(0x03000000:PCDataField):KOSTL = '123456' (CHARACTER)
(0x03000000:PCDataField):PERNR = '00000' (CHARACTER)
)
(0x01000000:Folder ):SapPoDetail = (
(0x03000000:PCDataField):WRBTR = 795.55 (DECIMAL)
(0x03000000:PCDataField):KOSTL = '123456' (CHARACTER)
(0x03000000:PCDataField):PERNR = '00000' (CHARACTER)
)
)
)
)
)

ExceptionList:

( ['MQROOT' : 0x12ac950]
(0x01000000:Name):RecoverableException = (
(0x03000000:NameValue):File = 'F:\build\S000_P\src\DataFlowEngine\ImbDataFlowNode.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 1073 (INTEGER)
(0x03000000:NameValue):Function = 'ImbDataFlowNode::createExceptionList' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmSAPRequestNode' (CHARACTER)
(0x03000000:NameValue):Name = 'contact admin#FCMComposite_1_4' (CHARACTER)
(0x03000000:NameValue):Label = 'MyInterface.SAP Request' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2230 (INTEGER)
(0x03000000:NameValue):Text = 'Node throwing exception' (CHARACTER)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = 'MbErrorHandler.java' (CHARACTER)
(0x03000000:NameValue):Line = 127 (INTEGER)
(0x03000000:NameValue):Function = 'requestData' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 3442 (INTEGER)
(0x03000000:NameValue):Text = 'Caught Throwable' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'SAP Request' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'contact admin.outadapter' (CHARACTER)
)
(0x01000000:Name ):RecoverableException = (
(0x03000000:NameValue):File = 'MbErrorHandler.java' (CHARACTER)
(0x03000000:NameValue):Line = 94 (INTEGER)
(0x03000000:NameValue):Function = 'execute' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPmsgs' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 3514 (INTEGER)
(0x03000000:NameValue):Text = 'throw a RecordNotFoundException' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'InvalidRequestFault' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'BAPI Interface failed to process the request.com.ibm.j2ca.sap.exception.SapBAPIException: ' (CHARACTER)
)
)
)
)
)


I tried to do this transformation in a lot of differents ways but I'm always getting this error. I can't do the transformation completely in the Mapping node because I don't have enough predefined functions for divide or move the decimal dot, so I always tried with ESQL functions I developed...

As a curiosity, as I said before, if I put in Mapping node the expression, I don't receive the error:

Quote:
xs:decimal($source/msg/details/amount)


It's very weird... I can't understand why all it's okay when I send 12345.00 and when I try to send 123.45, I get an error.

Also, I tried to put the following expression in Mapping node and it doesn't work:

Quote:
xs:decimal(12345.00)


Any ideas of how to manage the decimal digits?

Thanks in advance!
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jul 14, 2010 3:18 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

This looks a little bit suspicious to me. Looking through your SAP example I see amounts like 50.70 etc but you keep on using 12345 and 123.45 whereas this sequence of digits seems to be a String like "12345" and allocated to a costing field (KOSTL) or cost center. Are you sure you are not trying to pass the wrong field there? This would be consistent with the exception telling you that it is expecting a field of type CHARACTER?

The other trick with SAP is to always make sure you populate correctly the UnitOfValue field corresponding to your numeric field. Otherwise you might have surprises... and unexpected results.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
artykito
PostPosted: Wed Jul 14, 2010 3:43 am    Post subject: Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

No, my amounts are "50.50" and those...but I used 12345 and 123.45 like an example.

My KOSTL was 123456 only for test. This is not what I are speaking about.

The unit of value is filled in another record (header) I am sending too (I cut the real message with only the information necessary). The SAP field is WAERS.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jul 14, 2010 4:19 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

artykito wrote:
No, my amounts are "50.50" and those...but I used 12345 and 123.45 like an example.

My KOSTL was 123456 only for test. This is not what I are speaking about.

The unit of value is filled in another record (header) I am sending too (I cut the real message with only the information necessary). The SAP field is WAERS.

That's where you might be going wrong. Typically the Unit of Value field is always on the same record as the amount. Verify with the SAP team.
It could be that in this case it has the same value than that of the header, but if you do not populate that value you are asking for trouble.

Are you sure that SAP is expecting a numeric type double and not a CHAR type entry and the BAPI internals take care of the right conversion?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
artykito
PostPosted: Wed Jul 14, 2010 4:35 am    Post subject: Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

In SAP the field WRBTR is of CURR type, so they need the amount there and I send the WAERS (unit of this currency) in a header record, so do you think this is a problem?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jul 14, 2010 3:20 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

artykito wrote:
In SAP the field WRBTR is of CURR type, so they need the amount there and I send the WAERS (unit of this currency) in a header record, so do you think this is a problem?

Only SAP DDIC can tell you where the UOM for the field is. It may be the header record, it most probably is on the same record. You may also have to populate the corresponding UOM field before you populate the amount field.


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Amitha
PostPosted: Wed Jul 14, 2010 8:44 pm    Post subject: Reply with quote

Voyager

Joined: 20 Nov 2009
Posts: 80
Location: Newyork

I remember we had similar issue when we were calling SAP with decimal values. we had to change the decimal format on the user ID we were using to connect to SAP. Please check with SAP basis team the accepted decimal format for the user id you are using.
Back to top
View user's profile Send private message Send e-mail
artykito
PostPosted: Wed Jul 14, 2010 11:04 pm    Post subject: Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

I was trying to send the message modified manually before send it to SAP and I could know the format where SAP doesn't return an error is when I send something like:

<WRBTR>5055</WRBTR>

And I can see in the message returned, the number is 5055.00, but as I said, I don't want that...

All the formats I was sending, returns me an error, for example I tried with these formats:

<WRBTR>50.55</WRBTR>
<WRBTR>50,55</WRBTR>

I don't know if SAP itself tries to put the ".00" always, and when I send 50.50 want to add it too and that because it fails...I really don't know what's happening.

Amitha wrote:
we had to change the decimal format on the user ID we were using to connect to SAP. Please check with SAP basis team the accepted decimal format for the user id you are using.


Hey Amitha, where can we check this format? We were checking in the SAP main menu > System > prefixed values > proper data (or something like that because our SAP is not in English).

Here I could check the format how the user will see the numeric decimal fields, and its like "123.456,00" but if I try to send 50,50 as I said before, it fails too.

Can you tell me where can I check that? Because in the messageSet I can't see a pattern with the format accepted for this field.
Back to top
View user's profile Send private message
Gaya3
PostPosted: Thu Jul 15, 2010 5:25 am    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

if you are dealing with SAP, it is always good to talk with the SAP ABAP Developer to understand about their schema.

they can tell you more information on this aspects, so you can update the ESQL or Java in MB accordingly.

Here we can give you a lot of inputs, what to do, what not to do, however this may be different from how SAP developers are thinking.

just for an eg: SAP sends negative values as like this 20- [instead of -20], i agree and we know that -20 is globally known and agreed, but its just the other way how SAP handles, again its a developers choice i suspect.
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
Amitha
PostPosted: Thu Jul 15, 2010 6:27 am    Post subject: Reply with quote

Voyager

Joined: 20 Nov 2009
Posts: 80
Location: Newyork

Quote:
Can you tell me where can I check that? Because in the messageSet I can't see a pattern with the format accepted for this field.



If the user ID is not an system user, you can login to SAP GUI and edit it in System->user profiile->home data-> default tab. Here you can change the accepted decimal and date format for the current user.

If the user ID is an system user, which is the case most of the times, you cannot login to SAP GUI. so you have to ask SAP BASIS(administrators) to got to transaction SU01 or SU03, not exactly sure of the transaction to edit the properties of the user profile.

Also, ask ABAP developers to test the RFC function manually from SAP LOGON with your data.
Back to top
View user's profile Send private message Send e-mail
artykito
PostPosted: Fri Jul 16, 2010 1:52 am    Post subject: Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

I tried what you said Amitha, but I change the decimal notation in the user profile, and I receive the same error.

The ABAP developer told me he when he is doing the unit tests in SAP he must enter the values with format "123,45". If he try with "123.45" he can't execute the RFC because of the invalid format.

When I try to put the format with "," I receive this error: Unsupported conversion in getBigDecimal

I understand this is not the correct format to use. So, I try with "." but you have the error I receive in the first post.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jul 16, 2010 2:06 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

I wonder if the issue is for do with the format of the values.

I know that some locales use a comma as a separator ( 1,000,000 )
Others don't.
Perhaps this applies here?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
artykito
PostPosted: Fri Jul 16, 2010 4:31 am    Post subject: Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

I think is a bug...search JR31614 in this link: http://www-01.ibm.com/support/docview.wss?uid=swg27017302

"The adapter incorrectly handles decimal values in BAPI. This has been fixed."

IBM told it was fixed but I have the problem in WMBv7... Another team check my error and they have it too
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 16, 2010 5:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

artykito wrote:
I think is a bug...search JR31614 in this link: http://www-01.ibm.com/support/docview.wss?uid=swg27017302

"The adapter incorrectly handles decimal values in BAPI. This has been fixed."

IBM told it was fixed but I have the problem in WMBv7... Another team check my error and they have it too

Open a PMR!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Amitha
PostPosted: Fri Jul 16, 2010 6:36 am    Post subject: Reply with quote

Voyager

Joined: 20 Nov 2009
Posts: 80
Location: Newyork

Quote:
The ABAP developer told me he when he is doing the unit tests in SAP he must enter the values with format "123,45". If he try with "123.45" he can't execute the RFC because of the invalid format.


The RFC function is not able to handle 123.45.


Quote:
When I try to put the format with "," I receive this error: Unsupported conversion in getBigDecimal


Can you provide more description of the error, and what is the decimal format on the user profile when you receive this error?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problem sending DECIMAL numbers to SAP
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.