on 10-25-2021 11:28 PM
Good day experts, im new on this, im studying SQL because i have cero to none
Consultor created T0.[U_end_date], T0.[U_end_time], T0.[U_start_time], T0.[U_Startdate] to capture labor time and date form operators.
But operators start to type for example Start Date: 10/09/2021 start time: 11:00 P.M and End Date: 10/09/2021 End time: 02:00 A.M
This is causing negative numbers.
How can i create a Store Procedure to avoid this.
i started figuring this but im not sure if its correct or what im missing
if @object_type = '60'
begin
if @transaction_type in ('A','U')
begin
declare @U_startdate datetime
declare @U_end_date datetime
Select @U_startdate from IGE1.docentry where TransType='60'
Select @U_end_date from IGE1.docentry where TransType='60'
IF @U_startdate+ @U_end_date = -1
Begin
set @error_message ='Wrong End Date'
end
end
end
Hello,
I guess you also have to validate the Time fields, end time should be greater than start time of the Start and End Dates are same.
Regards,
Taseeb Saeed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot for your response, i tried with this, but still cant validate, there is a way different that SAP read date?
Im searching in internet but im new in SQL and stored procedures and its kind of difficult to fin information, i will really appreciate your help!
if @object_type = '60'
begin
if @transaction_type in ('A','U')
begin
declare @U_startdate datetime
declare @U_end_date datetime
declare @U_start_time int
declare @U_end_time int
Select @U_startdate= U_start_time from IGE1 a where a.docentry = @list_of_cols_val_tab_del and a.ItemCode ='Labor'
Select @U_end_date = U_end_date from IGE1 a where a.docentry = @list_of_cols_val_tab_del and a.ItemCode ='Labor'
Select @U_start_time = U_start_time from IGE1 a where a.docentry = @list_of_cols_val_tab_del and a.ItemCode ='Labor'
Select @U_end_time = U_end_time from IGE1 a where a.docentry = @list_of_cols_val_tab_del and a.ItemCode ='Labor'
IF (@U_start_time > @U_end_time and @U_startdate = @U_end_date) or (@U_end_date < @U_startdate)
Begin
set @error_message ='Wrong End Date'
end
end
end
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.