Application Development and Automation 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: 
Read only

Date alignment

Former Member
0 Likes
912

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
Read only

Former Member
0 Likes
863

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

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
863

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

Read only

Former Member
0 Likes
863

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

Read only

0 Likes
863

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.

Read only

0 Likes
863

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

Read only

Former Member
0 Likes
863

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

Read only

Former Member
0 Likes
863

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

Read only

Former Member
0 Likes
863

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.