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

Former Member
0 Likes
1,014

hi to all,

help me in this issue,

i am having run date &mhnk-ausdt& i want the date after seven days of this date it should be printed in dunning letters how can i do this.

thanks in advance.

kiran kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
979

Hello,

Please check the following code,the requirement is same.

DATA: p_day LIKE sy-datum ,

p_day1(10) TYPE c.

DATA: BEGIN OF i_factory_calendars OCCURS 0.

INCLUDE STRUCTURE vtbfcal.

DATA: END OF i_factory_calendars.

*Current date

p_day = sy-datum.

i_factory_calendars-ident = 'Z3'.

APPEND i_factory_calendars.

DO 5 TIMES.

p_day = p_day + 1.

CALL FUNCTION 'DATE_CONVERT_TO_WORKINGDAY'

EXPORTING

date = p_day

direction = '+'

IMPORTING

workingday = p_day

TABLES

factory_calendars = i_factory_calendars.

ENDDO.

MOVE p_day TO p_day1.

CALL FUNCTION 'CONVERSION_EXIT_D3DAT_OUTPUT'

EXPORTING

input = p_day1

IMPORTING

output = p_day1.

READ TABLE out_par WITH KEY 'L_DATE'.

CHECK sy-subrc = 0.

out_par-value = p_day1.

MODIFY out_par INDEX sy-tabix.

ENDFORM. "extract_date

*calculate date form dunning form.

FORM extract_date1 TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy. "03

DATA: p_day LIKE sy-datum ,

p_day1(10) TYPE c.

DATA: BEGIN OF i_factory_calendars OCCURS 0.

INCLUDE STRUCTURE vtbfcal.

DATA: END OF i_factory_calendars.

*Current date

p_day = sy-datum.

i_factory_calendars-ident = 'Z3'.

APPEND i_factory_calendars.

DO 3 TIMES.

p_day = p_day + 1.

CALL FUNCTION 'DATE_CONVERT_TO_WORKINGDAY'

EXPORTING

date = p_day

direction = '+'

IMPORTING

workingday = p_day

TABLES

factory_calendars = i_factory_calendars.

ENDDO.

MOVE p_day TO p_day1.

CALL FUNCTION 'CONVERSION_EXIT_D3DAT_OUTPUT'

EXPORTING

input = p_day1

IMPORTING

output = p_day1.

READ TABLE out_par WITH KEY 'L_DATE'.

CHECK sy-subrc = 0.

out_par-value = p_day1.

MODIFY out_par INDEX sy-tabix.

Regards,

7 REPLIES 7
Read only

dani_mn
Active Contributor
0 Likes
979

HI,

very simple

<b>date1 = mhnk-ausdt + 7.</b>

Regards,

Read only

Former Member
0 Likes
979

take that into one variable

/: l_date = &mhnk-ausdt&.

/: l_date = l_date + 7.

check out but not sure

Read only

0 Likes
979

hi

it is in scripts, ineed the date in this format 14th sep 2006.

Read only

0 Likes
979

Hi Kiran,

Use DATE MASK to set date format in scripts.

<b>/: SET DATE MASK = 'LD MMM YYYY'

/: &V_DATE&</b>

To tunn off this format,

/: SET DATE MASK = ''

To know more about DATE MASK, just browse this link

http://help.sap.com/saphelp_47x200/helpdata/en/d1/803508454211d189710000e8322d00/frameset.htm

Thanks,

Vinay

Read only

0 Likes
979

Hi Kiran,

v_Date = ur_date + 7.

use 'MONTH_NAMES_GET' FM for getting the month name.

read table with the month(v_date+2(2)).

-Anu.

Read only

Former Member
0 Likes
980

Hello,

Please check the following code,the requirement is same.

DATA: p_day LIKE sy-datum ,

p_day1(10) TYPE c.

DATA: BEGIN OF i_factory_calendars OCCURS 0.

INCLUDE STRUCTURE vtbfcal.

DATA: END OF i_factory_calendars.

*Current date

p_day = sy-datum.

i_factory_calendars-ident = 'Z3'.

APPEND i_factory_calendars.

DO 5 TIMES.

p_day = p_day + 1.

CALL FUNCTION 'DATE_CONVERT_TO_WORKINGDAY'

EXPORTING

date = p_day

direction = '+'

IMPORTING

workingday = p_day

TABLES

factory_calendars = i_factory_calendars.

ENDDO.

MOVE p_day TO p_day1.

CALL FUNCTION 'CONVERSION_EXIT_D3DAT_OUTPUT'

EXPORTING

input = p_day1

IMPORTING

output = p_day1.

READ TABLE out_par WITH KEY 'L_DATE'.

CHECK sy-subrc = 0.

out_par-value = p_day1.

MODIFY out_par INDEX sy-tabix.

ENDFORM. "extract_date

*calculate date form dunning form.

FORM extract_date1 TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy. "03

DATA: p_day LIKE sy-datum ,

p_day1(10) TYPE c.

DATA: BEGIN OF i_factory_calendars OCCURS 0.

INCLUDE STRUCTURE vtbfcal.

DATA: END OF i_factory_calendars.

*Current date

p_day = sy-datum.

i_factory_calendars-ident = 'Z3'.

APPEND i_factory_calendars.

DO 3 TIMES.

p_day = p_day + 1.

CALL FUNCTION 'DATE_CONVERT_TO_WORKINGDAY'

EXPORTING

date = p_day

direction = '+'

IMPORTING

workingday = p_day

TABLES

factory_calendars = i_factory_calendars.

ENDDO.

MOVE p_day TO p_day1.

CALL FUNCTION 'CONVERSION_EXIT_D3DAT_OUTPUT'

EXPORTING

input = p_day1

IMPORTING

output = p_day1.

READ TABLE out_par WITH KEY 'L_DATE'.

CHECK sy-subrc = 0.

out_par-value = p_day1.

MODIFY out_par INDEX sy-tabix.

Regards,

Read only

Former Member
0 Likes
979

tables : mhnk.

data : v_Date like mhnk-ausdt,

it_months like T247 occurs 0 with header line,

v_index like sy-index.

start-of-selection.

v_date = '20060101'.

v_Date = v_date + 7.

CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE =

TABLES

month_names = it_months

  • EXCEPTIONS

  • MONTH_NAMES_NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

v_index = v_date+4(2).

read table it_months index v_index.

write:/ v_Date6(2), 'th', it_months-ktx, v_date0(4).