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

Problems with Date Type in Table View

Hello.

Following problem:

I have to make a Table View with some data. One Colum is Type of Date!

Now I used Table View Iterators to change the backgroundcolor of some cells.

Sample:

WHEN 4.

DATA: col4_text TYPE REF TO CL_HTMLB_TEXTVIEW.

CREATE OBJECT col4_text.

col4_text->text = M_ROWREF->DATE1.

If mod_vari = 1.

p_style = 'cellDesign:POSITIVE'.

ENDIF.

-

-


But now I have the problem that this columm´s date is not formated: 20050112 but I want it this way: 01.12.2005.

How can I handle this problem? newbie

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2005 at 02:11 PM

    Thank you...

    I thought the same but i thought that there might be a 'simple' solution.

    but without using iterators the date is in "normal" format!

    how is this possible?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      With the Iterator the control is given back to you the developer. Without an Iterator the ABAP/BSP is controlled by the System and it knows the field is a date type and displays it according to the User/System settings for date display.

      And that is the "simple" solution! 😊

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2005 at 02:06 PM

    This one throw me for a loop as well coming from a non SAP background but here's a nice little code sample that you will find to be quite useful all the world over 😊

    data: lt_date type string,
          lt_tmp type string,
          lt_sep type string.
    
    lt_sep = '.'
    
    * You already have your date but for the example not
    * so this is why I use the lt_date
    lt_date = '20050112'.
    
    CONCATENATE
      lt_date+4(2)
      lt_date+6(2)
      lt_date+0(4)
    INTO lt_tmp SEPARATED BY lt_sep.
    
    * Now you can give lt_tmp to your output of your cell
    

    For the cell output you can double check the various weblogs on the subject "Iterator".

    You can play around with the lines after CONCATENATE to put the date in the format you want.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2005 at 02:42 PM

    Thanks....

    so I have to control the date format for each user? (DE,UK,EN)

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2005 at 03:05 PM

    It is working!!!! Thank You!

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Great to hear Marcus, as Max pointed out there are ABAP functions for it as well what we did was simnply build a method to give us the date in different formats and in some cases we use our own formats and in others we use SAP's.

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.