Notifications
Clear all

Query Manager - Cách nhập tham số theo dạng Year, Month thay vì Date

2 Posts
1 Users
0 Reactions
452 Views
admin
Posts: 488
Admin
Topic starter
(@admin)
Knight3
Joined: 3 years ago

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

 

Reply
1 Reply
admin
Posts: 488
Admin
Topic starter
(@admin)
Knight3
Joined: 3 years ago

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
Reply
Share:
x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security