Skip to Content
avatar image
Former Member

Need to subtract one day from the date appearing

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

8 Answers

  • avatar image
    Former Member
    Oct 25, 2007 at 03:50 AM

    HI,

    data:dat type sy-datum.

    dat = sy-datum.

    dat = dat - 1.

    write dat.

    you can simply subtract 1.

    rgds,

    bharat.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 03: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 03:51 AM
    /: DEFINE &SALES_ORDER& := &VBDKR-VBELN_VAUF&
    /: INVOICE DATE,, : &VBDKR-FKDAT - 1&
    
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 03:52 AM

    Hi,

    try fm ISU_EDM_DATETO_PREVIOUS

    PS:plz mark helpful answers

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 03: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 04: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 04: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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 25, 2007 at 04: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.

    Add comment
    10|10000 characters needed characters exceeded