SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Как проверить корректность ввода даты?



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Лазарев
Участник
Участник



Joined: 26 Sep 2007
Posts: 22

PostPosted: Tue Oct 30, 2007 10:46 am    Post subject: Как проверить корректность ввода даты? Reply with quote

Каким ФМ проверить корректность ввода даты?
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Tue Oct 30, 2007 5:34 pm    Post subject: Reply with quote

На селекционном экране проверятся автоматом.

В программе можно проверить с использованием 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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.