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 specification issue

Former Member
0 Likes
303

Hi Experts,

Based on the last rundate, default the current rundate-begda to last rundate and the current rundate-ennda to current date.

Means if last rundate is 02/08/2009, and program is being executed today (02/18/2009) then current payroll rundate on selection screen will default to 02/08/2009 u2013 02/17/2009.

Thanks&Regards

Rahul

1 REPLY 1
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
280

Hello,

You can try this code:

SELECT-OPTIONS:
s_date FOR sy-datum.

INITIALIZATION.

  DATA:
  v_date TYPE datum,
  wa_indx    TYPE indx.

* Get the serial number for the file from DB table INDX
  IMPORT v_date = v_date
  FROM DATABASE indx(xy)
  TO wa_indx
  CLIENT sy-mandt ID 'SDN'.

  IF v_date IS INITIAL.
    s_date-sign = 'I'.
    s_date-option = 'BT'.
    s_date-low = sy-datum - 1.
    s_date-high = sy-datum - 1.
    APPEND s_date.

    v_date = sy-datum.
  ELSE.
    IF v_date = sy-datum.
      s_date-sign = 'I'.
      s_date-option = 'BT'.
      s_date-low = v_date.
      s_date-high = v_date.
      APPEND s_date.
    ELSE.
      s_date-sign = 'I'.
      s_date-option = 'BT'.
      s_date-low = v_date.
      s_date-high = sy-datum - 1.
      APPEND s_date.
    ENDIF.
  ENDIF.

* Export the date & serial number to DB
  EXPORT v_date = v_date
  TO DATABASE indx(xy)
  FROM wa_indx
  CLIENT sy-mandt ID 'SDN'.

Hope this helps.

BR,

Suhas

Edited by: Suhas Saha on Feb 24, 2009 3:18 PM