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

report

Former Member
0 Likes
366

Could you please tell me the logic to validate the date.? it should tell us in what quarter the date falls into..

if the from date is in I quarter it should restric the user to enter the to date from the I quarter itself.. respectively for the other quarters..

Please..

1 ACCEPTED SOLUTION
Read only

graghavendra_sharma
Contributor
0 Likes
352

hello Nalina,

check this out.

DATA: w_last_date TYPE d, w_q_flag(3), w_quarter TYPE string.

SELECT-OPTIONS: s_date FOR w_last_date OBLIGATORY.

AT SELECTION-SCREEN ON s_date.
  IF s_date-low+0(4) <> s_date-high+0(4).
    MESSAGE e000(vz) WITH text-e01.
  ENDIF.

  IF s_date-low+4(2) <= '3'.
    CONCATENATE s_date-low+0(4) '03' '31' INTO w_last_date.
    w_q_flag = '1st'.
  ELSEIF s_date-low+4(2) <= '6'.
    CONCATENATE s_date-low+0(4) '06' '30' INTO w_last_date.
    w_q_flag = '2nd'.
  ELSEIF s_date-low+4(2) <= '9'.
    CONCATENATE s_date-low+0(4) '09' '30' INTO w_last_date.
    w_q_flag = '3rd'.
  ELSE.
    CONCATENATE s_date-low+0(4) '12' '31' INTO w_last_date.
    w_q_flag = '4th'.
  ENDIF.

  IF s_date-high > w_last_date.
    MESSAGE e000(vz) WITH text-e02 w_last_date.
  ENDIF

if it works, please reward if it is helpful

3 REPLIES 3
Read only

Former Member
0 Likes
352

Hi,

I guess there is no standard FM or report for your requirement. you can do it manually, capture the month from your from date based on the month number pass the quarter value in to some variable v_from_quarter. Do the same process for the TO date also and capture into v_to_quarter. Later check the v_from_quarter and v_to_quarter in the at selection-screen variant, if both same then give message.

Rgds,

Bujji

Read only

dhruv_shah3
Active Contributor
0 Likes
352

Hi,

Pls refer to [;

[;

HTH,

Regards,

Dhruv Shah

Read only

graghavendra_sharma
Contributor
0 Likes
353

hello Nalina,

check this out.

DATA: w_last_date TYPE d, w_q_flag(3), w_quarter TYPE string.

SELECT-OPTIONS: s_date FOR w_last_date OBLIGATORY.

AT SELECTION-SCREEN ON s_date.
  IF s_date-low+0(4) <> s_date-high+0(4).
    MESSAGE e000(vz) WITH text-e01.
  ENDIF.

  IF s_date-low+4(2) <= '3'.
    CONCATENATE s_date-low+0(4) '03' '31' INTO w_last_date.
    w_q_flag = '1st'.
  ELSEIF s_date-low+4(2) <= '6'.
    CONCATENATE s_date-low+0(4) '06' '30' INTO w_last_date.
    w_q_flag = '2nd'.
  ELSEIF s_date-low+4(2) <= '9'.
    CONCATENATE s_date-low+0(4) '09' '30' INTO w_last_date.
    w_q_flag = '3rd'.
  ELSE.
    CONCATENATE s_date-low+0(4) '12' '31' INTO w_last_date.
    w_q_flag = '4th'.
  ENDIF.

  IF s_date-high > w_last_date.
    MESSAGE e000(vz) WITH text-e02 w_last_date.
  ENDIF

if it works, please reward if it is helpful