none
RFC Call to get a date from SAP acts funny: received date is always one less then SAP determines RRS feed

  • Question

  • Hi Experts!

    I have a function in sap that can be called via rfc. Purpose of that function is to receive a date and return the next working day from that date regarding the sap callender. In case I supply a working day, the same day will return. If I transmit a saturday, the next monday will be the result most likely... if saturday and sunday are no regular working days in the SAP callender... you know what the function does.

    I can test the function in SAP with transaction SE37. If I enter a working day, then the dame date returns; trying a non working day (e.g. eastern) then the next working day returns. The internal Function used in SAP is mainly  DATE_CHECK_WORKINGDAY.

    If I test it in my Orchestration then I have a funny behaviour. SAP seems to determine the right date but somehow the date - 1 day returns. Example 1: I enter a working day, then the day bevore that day returns; I enter a sunday, then the sunday itself returns (monday - 1 day); I enter the first non-working-day of a bigger working-free-block like in eastern then the last non-working-day returns. In one sentence: the returned date is always 1 less then expected.

    But why is this like that? where in my setup the date will be reduced by one?

    this is my XSD File:

    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns:tns="http://Microsoft.LobServices.Sap/2007/03/Rfc/" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" targetNamespace="http://Microsoft.LobServices.Sap/2007/03/Rfc/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:annotation>
        <xs:appinfo>
          <fileNameHint xmlns="http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd">Rfc</fileNameHint>
        </xs:appinfo>
      </xs:annotation>
      <xs:element name="YDATE_GET_NEXT_WORKINGDAY">
        <xs:annotation>
          <xs:documentation>
            <doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">http://Microsoft.LobServices.Sap/2007/03/Rfc/YDATE_GET_NEXT_WORKINGDAY</doc:action>
            <doc:description xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">The Metadata for this RFC was generated using the RFC SDK.</doc:description>
          </xs:documentation>
          <xs:appinfo>
            <properties xmlns="http://schemas.microsoft.com/BizTalk/2003">
              <property distinguished="true" xpath="/*[local-name()='YDATE_GET_NEXT_WORKINGDAY' and namespace-uri()='http://Microsoft.LobServices.Sap/2007/03/Rfc/']/*[local-name()='I_DATE' and namespace-uri()='http://Microsoft.LobServices.Sap/2007/03/Rfc/']" />
            </properties>
          </xs:appinfo>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="1" name="I_DATE" nillable="true">
              <xs:annotation>
                <xs:documentation>Datum im CHAR-Format</xs:documentation>
              </xs:annotation>
              <xs:simpleType>
                <xs:restriction base="xs:dateTime">
                  <xs:pattern value="(\d\d\d\d-\d\d-\d\d)T(00:00:00)(.*)" />
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="YDATE_GET_NEXT_WORKINGDAYResponse">
        <xs:annotation>
          <xs:documentation>
            <doc:action xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">http://Microsoft.LobServices.Sap/2007/03/Rfc/YDATE_GET_NEXT_WORKINGDAY/response</doc:action>
            <doc:description xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">The Metadata for this RFC was generated using the RFC SDK.</doc:description>
          </xs:documentation>
          <xs:appinfo>
            <properties xmlns="http://schemas.microsoft.com/BizTalk/2003">
              <property distinguished="true" xpath="/*[local-name()='YDATE_GET_NEXT_WORKINGDAYResponse' and namespace-uri()='http://Microsoft.LobServices.Sap/2007/03/Rfc/']/*[local-name()='E_DATE' and namespace-uri()='http://Microsoft.LobServices.Sap/2007/03/Rfc/']" />
            </properties>
          </xs:appinfo>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="1" maxOccurs="1" name="E_DATE" nillable="true">
              <xs:annotation>
                <xs:documentation>Datum im CHAR-Format</xs:documentation>
              </xs:annotation>
              <xs:simpleType>
                <xs:restriction base="xs:dateTime">
                  <xs:pattern value="(\d\d\d\d-\d\d-\d\d)T(00:00:00)(.*)" />
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

     

    Any ideas?

    Best Regards

    Manfred

    Tuesday, June 8, 2010 12:23 PM

Answers

  • I rebuild your solution and it works fine here. If I submit 01.01.2010 I will get 04.01.2010 and if I submit 05.01.2010 I will get 05.01.2010 - all as expected. Even with you XSD it works. So are you sure, you ABAP function really returns the right values?

    Don't see any reason why BizTalk or the SAP adapter should "recalculate" the value.


    If you like my post or consider it as a valid answer, please use the buttons to show me - Oliver

    http://biztalk.hauth.me

    Tuesday, June 8, 2010 1:07 PM

All replies

  • I rebuild your solution and it works fine here. If I submit 01.01.2010 I will get 04.01.2010 and if I submit 05.01.2010 I will get 05.01.2010 - all as expected. Even with you XSD it works. So are you sure, you ABAP function really returns the right values?

    Don't see any reason why BizTalk or the SAP adapter should "recalculate" the value.


    If you like my post or consider it as a valid answer, please use the buttons to show me - Oliver

    http://biztalk.hauth.me

    Tuesday, June 8, 2010 1:07 PM
  • Hi Oliver!

    then it MUST be something I have overseen somewhere... I will have a deep look at anything again knowing now, that it has to be my fault!

    Thanks for your afford!

    Regards

    manfred

    Tuesday, June 8, 2010 2:16 PM