‎2007 May 18 6:12 AM
Hai,
Is there any function module which checks the datatype sy-datum.
I have the value 20070418 in a variable . I want to check it is of the datatype
sy-datum.
urgent.
Regards,
Rakesh.
‎2007 May 18 6:17 AM
hi rakesh,
can you please explain in more detail about your requirement.
If you just want to check if the variable has the same date as today then you can use
if variable_name = sy-datum.
***do something.
endif.
Regards,
Atish
‎2007 May 18 6:17 AM
Hi,
Look at the function module
<b>DATE_CHECK_PLAUSIBILITY</b>, Check to see if a date is in a valid format for SAP or not
Regards
Sudheer
‎2007 May 18 6:19 AM
hi,
Adding to sudheer, try this.
DATA: v_date TYPE sydatum.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = v_date
EXCEPTIONS
plausibility_check_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: / 'INvalid date'.
ELSE.
WRITE: / 'Correct date'.
ENDIF.
Regards
Reshma
‎2007 May 18 6:37 AM
you can try with this function module . just give your field dataelement as input in ROLL_NAME , so that you will gives all data like Domain , lenth , all texts ,etc
<u><b>DD_DTEL_GET</b></u>
Girish
‎2007 May 18 6:44 AM
hi Rakesh,
DATE_CHECK_PLAUSIBILITY - Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
PARAMETER P_DATE TYPE SYDATUM.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
date = P_DATE
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
v_subrc = sy-subrc.
if v_subrc = '1'.
write : 'PLAUSIBILITY_CHECK_FAILED'.
elseif v_subrc = '2'.
write : 'OTHERS'.
‎2007 May 18 7:28 AM
Hi Rakesh,
You can use SAP's standard function module in SE37 transaction '<b><i>DD_DTEL_GET'</i></b>.
Just pass the name of dataelement of the variable you are using in your program.The function module, will give you the details about its type as SY-DATUM in your case.
DATA: LS_DD04L_WA_A TYPE DD04L,
LS_DD04L_WA_N TYPE DD04L,
LS_DD01L_WA TYPE DD01L.
CALL FUNCTION 'DD_DTEL_GET'
EXPORTING
GET_STATE = 'MXX'
LANGU = '*'
PRID = 0
WITHTEXT = 'X'
ROLL_NAME = 'Z_DATA_ELEMENT'
IMPORTING
DD04L_WA_A = LS_DD04L_WA_A
DD04L_WA_N = LS_DD04L_WA_N
DD01L_WA = LS_DD01L_WA
EXCEPTIONS
ILLEGAL_VALUE = 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.In the export parameter DD04L_WA_A-DATATYPE you will get the name of datatype. Also in the same struture you can get the name of domain/dataelements etc.
This sort out your query.
PS If the answer solves your query, plz close the thread by rewarding each reply.
Regards
Sapna Modi
‎2007 May 18 7:32 AM
just declare it as type DATUM.
parameter : p_date type DATUM.
no need to do anything else.
Regards
Gopi
‎2007 May 18 8:49 AM
Hi,
Use the following FM:
<b>DATE_CHECK_PLAUSIBILITY</b> Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
Hope this helps.
Reward if helpful.
Regards,
Sipra