cancel
Showing results for 
Search instead for 
Did you mean: 

Why is it so difficult to map an xsd:date to an "ABAP" date?

Former Member
0 Kudos

Hi All,

I really wanted to just vent my spleen at how annoying BPM is around handling Date values passed from Java / Web Dynpro front end and mapping them as input into an RFC call.

I've seen many recommendations to use an EJB mapping function but I just can't believe that is the only way.  Presently, I'm using a CAF service in between my BPM and RFC due to other historic reasons but due to changes, I'd like to remove this CAF layer to simplify the build.  However, in doing so I hit the issue with converting dates.  So frustrating!

What am I missing?

Gareth.

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos
have you tried this date-from-dateTime()?
Former Member
0 Kudos

Hi Jun,

I'm pretty sure I've tried everything at least three times but will try again in the morning!

Thanks,

Gareth.

Former Member
0 Kudos

Hi Jun,

As I thought, if I use the date-from-dateTime() function I get the following syntax error:

"Incompatible expression type.
Expected:date
Found:xsd:date"

Unless I'm being completely stupid (possible!) I'm really annoyed and frustrated that what should be a very common mapping in BPM is not straight forward.  I cannot believe there isn't an easy way to pass a Java/XSD type date from BPM directly in to an RFC call.

I think the problem comes from the RFC import defining its own data type for date fields which is of type:
urn:sap-com:document:sap:rfc:functions:date

This is defined as:
<xsd:simpleType name="date">
     <xsd:union xmlns="urn:sap-com:document:sap:rfc:functions" memberTypes="xsd:date genericDate" />
</xsd:simpleType>

I'm very tired at the moment so not thinking clearly but I'm struggling to see an easy way of mapping an xsd:date to the date type shown above.

Any suggestions?

Thanks,

Gareth.

p.s. genericDate is defined as:
<xsd:simpleType name="genericDate">
     <xsd:restriction base="xsd:string">
          <xsd:pattern value="....-..-.." />
     </xsd:restriction>
</xsd:simpleType>

Message was edited by: Gareth Ryan

Former Member
0 Kudos

Hi Ryan,

I am facing similar issue in SAP NW Ehp2 version. It all worked fine in Ehp1 with date fields interpreted as strings in web service.

Let me know if you find a work around for this.

Thanks

Karthik

Former Member
0 Kudos

Hi Karthik,

It is puzzling why this would change from one Ehp to the next...

The type "date" itself is anytype because it contents can be "xsd:date" XOR "genericDate". You should be able to simply 'cast as xsd:date' to get the result you want. i.e it is a cast not a convert or map.

A few help links (from CE 7.2 but shouldn't have changed)

http://help.sap.com/saphelp_nwce72/helpdata/en/c3/fdb196a56b41b38bd7215accabba48/frameset.htm

http://help.sap.com/saphelp_nwce72/helpdata/en/63/9f9ca5bb234502bd7b02c91ac6040a/frameset.htm

regards, Nick

Former Member
0 Kudos

Got it fixed by applying OSS note 1655336.

Thanks for your suggestions.