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: 

alv

Former Member
0 Kudos

in alv can i display dynamic display of months for a given period in the format yyyymm. Also the field should be displayed as jan07-h and it should change correspondingly for the given input.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

use sy-datum and sy-uzeit system fields as a part of internal table.

or take sy-datum in a variable and change its format.....

reward points if useful

3 REPLIES 3

Former Member
0 Kudos

Hi veera,

I dont know about the dymamic display,but probably you can do is use two different internal table and call them according to your condition.

rewards points if helpful.

Regards

Sourabh Verma

Former Member
0 Kudos

hi,

use sy-datum and sy-uzeit system fields as a part of internal table.

or take sy-datum in a variable and change its format.....

reward points if useful

Former Member
0 Kudos

Hi,

please check out the sample program below it might help you

report ztest_tmp.

data: datum1 type sy-datum.

data: uzeit1 type sy-uzeit.

data: datum2 type sy-datum.

data: uzeit2 type sy-uzeit.

data: result type sy-uzeit.

datum1 = sy-datum - 1.

datum2 = sy-datum .

uzeit1 = '140000'.

uzeit2 = sy-uzeit.

call function 'GET_DELTA_TIME_FROM_DT'

exporting

t1 = uzeit1

t2 = uzeit2

d1 = datum1

d2 = datum2

importing

t3 = result.

write:/ result.

check out the following link it might help you for comaprision between dates

http://help.sap.com/saphelp_webas620/helpdata/en/fc/eb3509358411d1829f0000e829fbfe/frameset.htm

PLEASE CHECK OUT THE BELOW PROGRAM IT MIGHT HELP YOU for date difference

REPORT ZDATEDIFF.

DATA: EDAYS LIKE VTBBEWE-ATAGE,

EMONTHS LIKE VTBBEWE-ATAGE,

EYEARS LIKE VTBBEWE-ATAGE.

PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,

TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.

call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

exporting

i_date_from = FROMDATE

i_date_to = TODATE

  • I_FLG_SEPARATE = ' '

IMPORTING

E_DAYS = EDAYS

E_MONTHS = EMONTHS

E_YEARS = EYEARS.

WRITE:/ 'Difference in Days ', EDAYS.

WRITE:/ 'Difference in Months ', EMONTHS.

WRITE:/ 'Difference in Years ', EYEARS.

INITIALIZATION.

FROMDATE = SY-DATUM - 60.

also check out the below program to fine date difference

data: d1 like sy-datum,

d2 like sy-datum.

data: diff type i.

d1 = '20060331'.

d2 = '20060220'.

diff = d1 - d2.

write : / diff .

Also chek these FMs:

'CSCP_PARA1_GET_PERIODS'

HR_99S_INTERVAL_BETWEEN_DATES(Months, Years and days)

COMPUTE_YEARS_BETWEEN_DATES

EHS_CALC_YEARS_BETWEEN_DATES

DAYS_BETWEEN_TWO_DATES

MONTHS_BETWEEN_TWO_DATES

For No of week days between two dates please check out the below program it might help you

report zrich_0003.

data: begin of itab occurs 0,

datum type sy-datum,

end of itab.

data: weekday like dtresr-weekday.

data: number_lines type i.

parameters: p_sdatum type sy-datum,

p_edatum type sy-datum.

itab-datum = p_sdatum.

append itab.

do.

if itab-datum = p_edatum.

exit.

endif.

itab-datum = itab-datum + 1.

call function 'DATE_TO_DAY'

exporting

date = itab-datum

importing

weekday = weekday.

if weekday = 'Sat.'

or weekday = 'Sunday'.

continue.

endif.

append itab.

enddo.

describe table itab lines number_lines.

write:/ 'Number of days between dates is', number_lines

*********please reward points if the information is helpful to you**************