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: 

Date alignment

Former Member
0 Kudos

Hello,

I am having two dates like 20061010 & 20061112.

I need to show like 10.10-12.11.2006 in Bold in alv display .

How to do this.

8 REPLIES 8

Former Member
0 Kudos

DATA: date1 TYPE d VALUE '19990704',

date2 TYPE sy-datum.

move date1 to date2.

WRITE date2.

Its output will be:04.07.1999

Best Regards,

Vibha

*Please mark all the helpful answers

0 Kudos

Hi,

May be you can try this.

TYPES: begin of date_struct,

year(4) type c,

day(2) type c,

month(2) type c,

end of date_struct.

DATA: var1 type date_struct,

var2 type date_struct.

DATA: date1 type d value '20061010',

date2 type d value '20061112'.

var1 = date1.

var2 = date2.

DATA: str1 type string

concatenate var1.day '.' var1-month '-' var2-day '.' var2-month '.' var2-year into str1.

write: str1. " should display 10.10-12.11.2006

  • now str1 has the string you need.

Regards,

Sesh

Message was edited by: Seshatalpasai Madala

Former Member
0 Kudos

Hi Johnn,

data: date1 type sy-datum,

date2 type sy-datum.

DATA: lws_text TYPE sdydo_text_element.

Var1 = '20061010' .

var2 = '20061112'.

write: var1 to date1,

var2 to date2.

var3 = var1+0(4).

var4 = var2+4(4).

concatenate var3 '-' var4 into lws_text.

lws_text = 10.10-12.11.2006.

For BOlD in ALV.

CALL METHOD o_html->add_text

EXPORTING

text = lws_text

sap_emphasis = 'STRONG'.

hope this helps.

Manish

0 Kudos

Hi ,

A simply was is ;

data : date1 type sy-datum.

WRITE sy-datum DD/MM/YYYY to date1.

you can specify what ever format u want instead of DD/MM/YY in the same place.

0 Kudos

hai manish, please tell me the class & method name claerly.

Former Member
0 Kudos

chk this

REPORT YCHATEST.

DATA: V_DATE1 LIKE SY-DATUM,
      V_DATE2 LIKE SY-DATUM,
      V_DATE(20).

V_DATE1 = SY-DATUM.
V_DATE2 = SY-DATUM + 1.

CONCATENATE V_DATE1+6(2) '.' V_DATE1+4(2) '-' V_DATE2+6(2)
'.' V_DATE2+4(2) '.' V_DATE1+0(4) INTO V_DATE.

WRITE : V_DATE.

In ALV you change the color instead of bold

in the fieldcatalog

<b>wa_fcat-emphasize = 'C410'.</b>

Where C = constant

4 = color code , can be from 1 - 7

1 = Intensified on , can be 0 or 1

0 = Inverse off , can be 0 or 1

Former Member
0 Kudos

Hi,

suppose you have

data: date2(8) value '20061112',

date1(8) value '20061010',

l_var(16).

concatenate date16(2) date14(2) into l_var separated by '.'.

concatenate l_var date2+6(2) into l_var separated by '-'.

concatenate l_var date2+4(2) date2(4) into l_var separated by '.'.

regards,

Dharitree

Former Member
0 Kudos

ld1 = '20061010'.

ld2 = '20061112'.

ly1 = ld1(4).

ly2 = ld2(4).

If ly1 = ly2.

concatenate ld16(2) '.' ld14(2) '-'

ld26(2) '.' ld24(2) '.' ld2(4) into lfinal.

Endif.