Skip to Content

Need a query between Two dates with tolerance Days

Hi Expert !

I need help on below point:

1.User work only BatchDate (U_Date) ± 7 Days.




vrwoc.png (312.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Sir,

    I have a Date type UDF in Batch table ,at the time of adding the GRPO user fill the retest date (U_Date).

    My question is user re working only U_Date ± 7 Days ,describe below:

    GRPO NO: Grpo Date Batch NO U_Date As per Requirement user working Days on this Batch

    10002 28/11/2016 2016001 28/11/2017 28/11/2017 user create Goods issue ± 7 Days

    How to user restrict GI to user work only 28/11/2017 ± 7 Days

  • IF (:object_type = 'UNE_UDO_STOCKJOURNAL') AND (:transaction_type ='U' OR :transaction_type ='A') THEN
    declare DS_var_PM nvarchar(20);
    (SELECT Count (*)
    LEFT Outer join OIBT t5 ON t5."ItemCode"= t0."U_UNE_ITCD" AND t5."WhsCode" = t0."U_UNE_WHS" AND T5."BatchNum"= t0."U_UNE_BAT1"
    WHERE T5."U_UNE_REDT">= DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND T5."U_UNE_REDT" < CURDATE() AND T0."DocEntry" = :list_of_cols_val_tab_del ) INTO DS_var_PM FROM DUMMY;
    IF :DS_var_PM > 0 THEN
    error := 19;
    error_message := 'Material Batch does not come Retest Mode';
    END IF;
    END IF;

  • Get RSS Feed

1 Answer

  • Nov 28, 2017 at 06:13 AM

    From your question and your comments I can only guess what you require (sorry :)).

    If you are searching for a function which allows you to calculate a date 7 days in the past and a date 7 days in the future, you can use the ADD_DAYS function.

    Following dummy query should explain you how to do it:

    SELECT current_date AS "Current Date", add_days(current_date, -7) AS "Current Date - 7 days", add_days(current_date, 7) AS "Curent Date + 7 days" FROM DUMMY;
    Add comment
    10|10000 characters needed characters exceeded