SAP Webservice Error: Value 00:00:00.0000000-05:00 is not a valid time in accordance with the XML format for ABAP

Webservice Error: Value 00:00:00.0000000-05:00 is not a valid time in accordance with the XML format for ABAP

The issue

I was working on a BAPI_User_Create1 function via C# Dotnet, I kept getting this error

Value 00:00:00.0000000-05:00 is not a valid time in accordance with the XML format for ABAP

In the Webservice runtime logs. The function would not work.

The Cause

The way SAP SOAP Webservice renders DateTime is different from what is received via Dotnet. The function I am calling sets a value for a DateTime field called LTime. Now I was not setting a value for it so that is why you see 00:00:00 in the error. I tried setting an actual time for it but that did not make a difference.

Solution

There are several options for resolving this issue

  1. You can change the DateTime format of the wsdl

<xsd:simpleType name=”date10″>

<xsd:restriction base=”xsd:string”>

<xsd:maxLength value=”10″/>

<xsd:pattern value=”\d\d\d\d-\d\d-\d\d”/>

</xsd:restriction>

</xsd:simpleType>

To match the Dotnet format

  1. You can use a BAPI function CONVERT_DATE_TO_INTERN_FORMAT to convert the DateTime
  2. You can change the specific DateTime attribute in the wsdl to a more friendly format (string)

I chose the last, here is what I did

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

In your Vstudio, open the wsdl file and change

<xsd:element name=”LTIME” type=”tns:time” />
to
<xsd:element name=”LTIME” type=”tns:string” />

In reference.cs

Change this section

public DateTime LTIME {

to

public String LTIME {

change
private DateTime LTIME {

to

private String LTIME {

Recompile your code

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s