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: 

Need to subtract one day from the date appearing

Former Member
0 Kudos

Hi, I am modifying a script in such a way that for an output type there is an invoice date appearing. This invoice date should be back dated to 1 date less to the actually date that is appearing currently.

For ex the date is 2007.08.30 it should appear as 2007.08.29.

While debugging I found that it is picking up the data for the date from the structure vbdkr and the field is fkdat. From the following code in the script.

/: DEFINE &SALES_ORDER& := &VBDKR-VBELN_VAUF&

/: INVOICE DATE,, : &VBDKR-FKDAT&

What changes do I need to make the changes in the script or in the driver program?

Can you please suggest?

Thanks.

8 REPLIES 8

Former Member
0 Kudos

Hi,

In driver program, check the location where this text element is printed. Before that call, add this line :

VBDKR-FKDAT = VBDKR-FKDAT - 1.

This will reduce the date by 1 and as the text element is called after this command, it will display desired date.

Hope this helps.

ashish

Former Member
0 Kudos

HI,

data:dat type sy-datum.

dat = sy-datum.

dat = dat - 1.

write dat.

you can simply subtract 1.

rgds,

bharat.

former_member223537
Active Contributor
0 Kudos

/: DEFINE &SALES_ORDER& := &VBDKR-VBELN_VAUF&
/: INVOICE DATE,, : &VBDKR-FKDAT - 1&

Former Member
0 Kudos

Hi,

try fm ISU_EDM_DATETO_PREVIOUS

PS:plz mark helpful answers

Former Member
0 Kudos

Hi,

before displaying date you can subract it by 1 i.e.

VBDKR-FKDAT = VBDKR-FKDAT-1.

either in script or driver program.

Regards,

Raghavendra

harimanjesh_an
Active Participant
0 Kudos

hi dolly,

u can just change ur statement like this......

Before passing the variable FKDAT to form through ur text element,

do like this in ur report program and then pass it to script...

<b>vbdkr-fkdat = vbdkr-fkdat - 1.</b>

or else try like this but i am not sure...

/: DEFINE &SALES_ORDER& := &VBDKR-VBELN_VAUF&

/: INVOICE DATE,, : &VBDKR-FKDAT& - 1

A small program illustrating ur requirement...

DATA : dat LIKE sy-datum.

WRITE : / sy-datum.

dat = sy-datum - 1.

WRITE : / dat.

Output :

25.10.2007

24.10.2007

Reward me if useful....

Harimanjesh AN

Former Member
0 Kudos

Hi Dolly,

You can try this.

vbdkr-fkdat = vbdkr-fkdat - 1. or

/: DEFINE &SALES_ORDER& := &VBDKR-VBELN_VAUF&

/: INVOICE DATE,, : &<b>VBDKR-FKDAT - 1</b>&

Reward if Useful,

Regards,

Chitra

varma_narayana
Active Contributor
0 Kudos

Hi..

You can get this Functionality by Calling a FORM (subroutine) from the Script Layout itself There is no need to change the Print program.

Eg:

In the layout set -> window -> text elements. Write this before displaying invoice date

/: PERFORM F_DATE_SUB IN PROGRAM ZPRG01

/: CHANGING &VBDKR-FKDAT&

/: ENDPERFORM

  • INVOICE DATE,, : &VBDKR-FKDAT&

Create the report program ZPRG01: In the program ZPRG01

FORM F_DATE_SUB TABLES INTAB STRUCTURE ITCSY

OUTTAB STRUCTURE ITCSY.

DATA: L_DATE TYPE D.

READ TABLE OUTTAB INDEX 1.

L_DATE = OUTTAB-VALUE. "you need to convert here

SUBTRACT 1 FROM L_DATE.

OUTTAB-VALUE = L_DATE.

MODIFY OUTTAB INDEX 1.

ENDFORM.

reward if Helpful.