Quantcast
Channel: SCN : All Content - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 7030

Convert xsd:dateTime to DDIC timestamp?

$
0
0

Hi all,

 

I have an SOAP --> PI --> RFC synchronous scenario. One node of the request of the SOAP sender is in xsd:dateTime format with milliseconds and time zone. So the payload xml looks like this (simplified)

<Shipment>          <ShipID>0815</ShipID>          <Delivery>                    <DeliveryID>1234</DeliveryID>                    <HandlingUnit>                              <HandlingUnitID>001</HandlingUnitID>                              <Timestamp>2013-04-11T09:11:03.3357248-05:00</Timestamp>                    </HandlingUnit>                    <HandlingUnit>                              <HandlingUnitID>002</HandlingUnitID>                              <Timestamp>2013-04-12T13:11:03.3357248-04:00</Timestamp>                    </HandlingUnit>          </Delivery></Shipment>

 

As I use XSLT mapping to flatten the nested input XML to the RFC input parameters I am not able to use UDF or standard functions like DateTrans.

 

Having said this: What is the most sound way to send xsd:dateTime data to an RFC and use that data as data dictionary timestamp (or timestampl in our case).

 

Side notes:

  • First I tried to just pass the xsd:dateTime as is to the RFC where the RFC expects a data element of type TIMESTAMPL. This resulted in an error on jco stating that it could not convert the xsd:dateTime to a BCD. Error text was "JCO_ERROR_CONVERSION: Number 2013-04-11T09:11:03.3357248-05:00 cannot be encoded as a BCD of length 21 with 7 decimal places"
  • Then I tried to send the xsd:dateTime to the RFC where the RFC expects a data element of type XSDDATETIME_ISO (Char33). This of course worked on PI but how would I go on the ABAP side from there? I ended up, concatenating the xsd:dateTime into a asXML string like so...
    DATA: l_myxml                   TYPE string,         l_timestamp_input   TYPE XSDDATETIME_ISO.
    
    CONCATENATE '<asx:abap version = "1.0" xmlns:asx = '
    '"http://www.sap.com/abapxml">'
    '<asx:values>'
    '<MYTIMESTAMP>'                 <ls_hk>-timestamp
    '</MYTIMESTAMP>'
    '</asx:values>'
    '</asx:abap>'
    INTO l_myxml.

    ...and then using CALL TRANSFORMATION to get the timestamp back like so...
    DATA:l_timestampTYPE xsddatetime_long_z.
    
    CALL TRANSFORMATION id
           SOURCE XML l_myxml       RESULT mytimestamp = l_timestamp.

 

 

There must be any helper class or some sort of standard mechanism to do this, right? I mean, in the end SAP does this somehow when having an xsd:dateTime in your message type and then generating a proxy from that.

 

Any insights on this would really be appreciated.

 

Cheers

 

Jens


Viewing all articles
Browse latest Browse all 7030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>