Notifications
Clear all
Dec 08, 2023 7:04 pm
Tham số khi chạy câu truy vấn trong query manager thường sử dụng định dạng ngày (DD-MM-YYYY) của chứng từ trong hệ thống ERP SAP B1. Tuy nhiên một vài câu truy vấn cần hỗ trợ người dùng chỉ nhập thông tin Year, Month. Sau đây là cách thực hiện
- Tạo UDT: ZZ_PARAM
- Tạo UDF thuộc ZZ_PARAM
- U_Year: numeric
- U_Month: numeric
- Tạo câu truy vấn sau để hiển thị parameter Year, Month khi chạy câu query
1 Reply
Dec 04, 2024 7:23 am
Trường hợp muốn truyền tham số được lấy từ các bảng chuẩn của hệ thống
declare @Fromdate date, @ToDate date select top 1 @FromDate=RefDate from [OJDT] T0 where T0.RefDate=[%0] set @FromDate=[%0] select top 1 @ToDate=RefDate from [OJDT] T0 where T0.RefDate=[%1] set @ToDate=[%1] exec [ZS_QM_Revenue_COGS] @FromDate, @ToDate
hoặc
/**select from OJDT T0 **/ declare @Fromdate as Date /* where */ set @Fromdate = /* T0.RefDate */ [%0] /**select from OJDT T0 **/ declare @Todate as Date /* where */ set @Todate = /* T0.RefDate */ [%1] exec [ZS_QM_Revenue_COGS] @Fromdate, @Todate