Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Date format - ABAP to XML

Former Member
0 Kudos

Dear Users,

We are currently facing an issue with the date formats in XML.

We have a system (.Net), which has a webservice that we are calling for information from SAP. We created a Proxy class in SAP from the WSDL file and have attempted to use the method that gets us required information based on the Timestamp passed from SAP. However, the timestamp that the INPUT structure uses has a data element XSDDATETIME_Z.

All we can send from SAP is a simple TIMESTAMP, but the .Net system doesn't accept it since it wants the timestamp in XML format i.e. <dd-mm-yyyy>T<hh:mm:ss>Z. SAP documentation says that the field should automatically do conversion from ABAP to XML format, but that doesn't happen. We don't want to build a string from Timestamp in the XML format and send it out since we might surely miss out on the different cases involved.

Can anyone please suggest a way for us to send the date out in the required XML format?

Many thanks!

1 ACCEPTED SOLUTION

former_member213275
Contributor
0 Kudos

HI,

Refer this link below.

[http://help.sap.com/abapdocu_702/en/abenabap_xslt_asxml_schema.htm]

Srikanth

5 REPLIES 5

former_member213275
Contributor
0 Kudos

HI,

Refer this link below.

[http://help.sap.com/abapdocu_702/en/abenabap_xslt_asxml_schema.htm]

Srikanth

0 Kudos

Thanks for your reply Srikanth.

I am basically looking for a way to do it. I had been through the link, but I am not very sure how I actually do the transformation.

Any pointers on the method of approach would be helpful.

0 Kudos

HI,

May be you can check this link. Hope this would be helpful.

[http://www.sap-press.de/download/dateien/1112/076_leseprobe.pdf]

Srikanth.

0 Kudos

Hi Vijay,

Look at the below sample code and it works fine, i guess there is something wrong in your code or conversion, post the actual code if you are still not able figure it out with the below example.


DATA: l_xml_string TYPE string,
      l_dat_time TYPE xsddatetime_z.

CALL FUNCTION 'CACS_DATE_GET_TIMESTAMP'
 EXPORTING
   I_DATE                         = sy-datum
   I_TIME                         = sy-uzeit
 IMPORTING
   E_TIMESTAMP                    = l_dat_time
 EXCEPTIONS
   DATE_NOT_FILLED_BUT_TIME       = 1
   DATE_HAS_NO_VALID_FORMAT       = 2
   OTHERS                         = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL TRANSFORMATION id
  SOURCE root = l_dat_time
  RESULT XML l_xml_string.

IF sy-subrc EQ 0.
 write: l_xml_string.
ENDIF.

Regards,

Chen

LeonvNiekerk
Explorer
0 Kudos

You could try class CL_GDT_CONVERSION