Skip to Content
author's profile photo Former Member
Former Member

Simple transformation formatting

Dear Expert,

I would like to know how can I format my transformation result using simple transformation. I have an attribute that is supposed to display a date in the format YYYYMMDD. However, the default format is YYYY-MM-DD. How can I change this behavior in simple transformation? Thanks!

Regards,

Alex

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

10 Answers

  • Posted on May 28, 2014 at 06:57 AM

    Hey Alex,

    do you have a solution already? I have the same problem, the format of the date in the XML-File is "20140101" and I can´t transform it with Simple Transformation to the ABAP Type DATS which waits for "2014-01-01" or "2014.01.01".

    the Transformation looks like this in the moment:

    ...

    <DATE tt:value-ref="DATE"/>

    ...

    The ABAP type of the field DATE is DATS. And the XML looks at this part like this:

    <DATE>20131201</DATE>

    Regards,

    Christoph

    Add a comment
    10|10000 characters needed characters exceeded

    • Thanks Jerry !!

      I think that will work for me, I will test it later, but this looks like the solution I searched for 😊

      I have not tested it yet, but I think, it will only work for the output of the XML file, or? If it should work for both (output/input of xml <=> itab), with same Transformation, the method "GET_NEW_DATE" should be extended a bit 😊

      But this sould be possible without problems.

      best regards,

      Christoph

  • author's profile photo Former Member
    Former Member
    Posted on Jul 06, 2009 at 10:45 AM

    hi

    you may use EDITMASK.

    FOLLOW the link http://www.sap-basis-abap.com/sapab015.htm

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 06, 2009 at 10:45 AM

    HI ,

    you split (keyword) the variable at '-' and collect iinto three different variable and make the required format.

    Thanks

    Shambhu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 06, 2009 at 10:46 AM

    HI ,

    you split (keyword) the variable at '-' and collect iinto three different variable and make the required format.

    Thanks

    Shambhu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 06, 2009 at 10:46 AM

    hi,

    you can use concatenate in that case :

    CONCATENATE: zdate+6(02)

    '-'

    zdate+4(02)

    '-'

    zdate(04) INTO date.

    hope this will surely help you!!!

    Thanks & Regards,

    Punit Raval.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 06, 2009 at 10:48 AM

    USE EDIT-MASK command in your program.

    EDIT-MASK 'YYYYMMDD'.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 06, 2009 at 10:52 AM

    Hi,

    data: gv_chars TYPE char100.
    
    gv_chars = '2009-07-06'.
    
    replace all occurrences of substring '-' in gv_chars with ''.

    Hope this helps.

    Regards,

    Anand Patil

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 06, 2009 at 12:21 PM

    use edit-mask a EDIT-MASK - 'YYYYMMDD'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 07, 2009 at 01:42 AM

    Dear Experts,

    Thanks for all the previous input. However, I think my title is not clear enough. "Simple transformation" is a SAP terminology that help developer to export / transform data in XML. The above suggestion cannot be applied in simple transformation.

    I am looking for way to apply date format in the XSLT used in simple transformation. Thanks!

    Regards,

    Alex

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 28, 2014 at 08:45 AM

    Hello Alex,

    in the simple transformation an external ABAP class could be used to do date format manually. See my solution in this document: http://scn.sap.com/docs/DOC-56211

    Best regards,

    Jerry

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.