10-25-2007 4:48 AM
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.
10-25-2007 4:50 AM
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
10-25-2007 4:50 AM
HI,
data:dat type sy-datum.
dat = sy-datum.
dat = dat - 1.
write dat.
you can simply subtract 1.
rgds,
bharat.
10-25-2007 4:51 AM
/: DEFINE &SALES_ORDER& := &VBDKR-VBELN_VAUF&
/: INVOICE DATE,, : &VBDKR-FKDAT - 1&
10-25-2007 4:52 AM
10-25-2007 4:52 AM
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
10-25-2007 5:14 AM
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
10-25-2007 5:25 AM
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
10-25-2007 5:30 AM
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.