View previous topic :: View next topic
Author
Message
Лазарев Участник Joined: 26 Sep 2007 Posts: 22
Posted: Tue Oct 30, 2007 10:46 am Post subject: Как проверить корректность ввода даты?
Каким ФМ проверить корректность ввода даты?
Back to top
admin Администратор Joined: 01 Sep 2007 Posts: 1640
Posted: Tue Oct 30, 2007 5:34 pm Post subject:
На селекционном экране проверятся автоматом.
В программе можно проверить с использованием FM
CONV_EXIT_LDATE_OUTPUT_LANGU - Konvertierungsexit f_r ein internes Datum (JJJJMMTT) OUTPUT
CONVERSION_EXIT_IDATE_INPUT - External date INPUT conversion exit (e.g. 01JAN1994)
CONVERSION_EXIT_IDATE_OUTPUT - External date OUTPUT conversion exit (e.g. 01JAN1994)
CONVERSION_EXIT_LDATE_OUTPUT - Internal date OUTPUT conversion exit (e.g. YYYYMMDD)
CONVERSION_EXIT_SDATE_INPUT - External date (e.g. 01.JAN.1994) INPUT conversion exit
CONVERSION_EXIT_SDATE_OUTPUT - Internal date OUTPUT conversion exit (e.g. YYYYMMDD)
CONVERT_DATE_TO_EXTERNAL - Conversion: Internal to external date (like screen conversion)
CONVERT_DATE_TO_INTERNAL - Conversion: External to internal date (like screen conversion)
CONVERSION_EXIT_DATEX_INPUT
CONVERSION_EXIT_DATEX_OUTPUT
CONVERT_DATE_TO_EXTERNAL Conversion: Internal to external date (like screen conversion)
CONVERT_DATE_TO_INTERNAL Conversion: Internal to external date (like screen conversion)
Code:
CALL FUNCTION 'CONVERT_DATE_INPUT'
EXPORTING
input = f_value
plausibility_check = 'X'
IMPORTING
output = sl_datum
EXCEPTIONS
plausibility_check_failed = 1
wrong_format_in_input = 2
OTHERS = 3.
CALL FUNCTION 'CONVERT_TIME_INPUT'
EXPORTING
input = f_value
plausibility_check = 'X'
IMPORTING
output = sl_uzeit
EXCEPTIONS
plausibility_check_failed = 1
wrong_format_in_input = 2
OTHERS = 3.
Code:
PARAMETERS : P_DATE LIKE SY-DATUM.
START-OF-SELECTION.
end-of-selection.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = P_DATE
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <0>CHECK_DATE
EXPORTING
ID_DATE =
* EXCEPTIONS
* DATE_INVALID = 1
* others = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.