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: 

Display message with input field.

Former Member
0 Kudos

Hi I have one rqquirment in report. when user enter some date then it will check its valid or not with some calculation. if it is invalid then requirment is that it should give two input field with date.

or when he enter invalid date then it should display message with two date input filed.

two input field are FORM date and To date..

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

From what I understand, you basically need date validation. You can simply declare your date parameter as..

parameters: p_date like sy-datum.

The system with automatically do the validation and generate error message accordingly. You wonldn't need any additional code for validation.

PS: Additionally, there is a FM named DATE_CHECK_PLAUSIBILITY which checks if a date is in a valid format for SAP. You can use this in the event AT SELECTION-SCREEN ON <input parameter for date> to check if the date is valid and process your own error handling. However, unless ur requirement is more than what I understood it to be, I suggest you make use of the standard check by declaring your parameter as shown above.

Regards...JM

5 REPLIES 5

former_member404244
Active Contributor
0 Kudos

Hi,

in the event at-selection screen output write the logic..

Please find sample logic ,, try with your requirement and see..



TABLES : mara.

PARAMETERS : p_date LIKE mara-ersda.

SELECT-OPTIONS : s_date FOR mara-ersda.

AT SELECTION-SCREEN OUTPUT.

  IF p_date IS NOT INITIAL.

      LOOP AT SCREEN.

      CASE screen-name.
        WHEN 'S_DATE-LOW'.
          screen-input = 1.
          MODIFY SCREEN.
        WHEN 'S_DATE-HIGH'.
          screen-input = 1.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.
  ELSE.

    LOOP AT SCREEN.

      CASE screen-name.
        WHEN 'S_DATE-LOW'.
          screen-input = 0.
          MODIFY SCREEN.
        WHEN 'S_DATE-HIGH'.
          screen-input = 0.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.

  ENDIF.

Regards,

Nagaraj

0 Kudos

Hi it can not work..

when i enter vbeln number then it will search erdat for corresponding vbeln.

if vbeln < dy-datum.

then following input field should be active

Valid From

Valid To

endif.

Else

Process normally

0 Kudos

Hi,

Nagaraj has given you a small template. Please build on the sample according to your requirement. Use LOOP AT SCREEN logic to enable and disable the I/O fields.

Or best, search the SDN. You will find tons of sample snippets.

Former Member
0 Kudos

Hello,

From what I understand, you basically need date validation. You can simply declare your date parameter as..

parameters: p_date like sy-datum.

The system with automatically do the validation and generate error message accordingly. You wonldn't need any additional code for validation.

PS: Additionally, there is a FM named DATE_CHECK_PLAUSIBILITY which checks if a date is in a valid format for SAP. You can use this in the event AT SELECTION-SCREEN ON <input parameter for date> to check if the date is valid and process your own error handling. However, unless ur requirement is more than what I understood it to be, I suggest you make use of the standard check by declaring your parameter as shown above.

Regards...JM

Former Member
0 Kudos

Hi,

As per my understanding new input fields are not required you can achieve this easily as follows,

AT SELECTION-SCREEN ON pr_edate.

PERFORM validate_date.

FORM validate_date.

In this FORM right your logic

DATA : lw_diff TYPE i.

IF pr_edate IS INITIAL OR pr_sdate IS INITIAL.

MESSAGE text-005 TYPE 'E'. " Valid Date Range is necessary

ELSE.

lw_diff = pr_edate - pr_sdate.

IF lw_diff < 0 OR lw_diff > 30.

MESSAGE text-006 TYPE 'E'.

ENDIF.

ENDIF.

ENDFORM. " F0016_VALIDATE_DATE

Hope it helps you,

Regards,

Abhijit G. Borkar