Creating a conditional query for alert
Hope someone can help with this, I am trying get an SQL query to work in an alert that returns a sales quotation number based on UDF's in the record. The basic query is:
SELECT DocNum, CardCode, CardName
FROM OQUT
WHERE (U_PLApr = 'I') AND (CANCELED = 'N') AND (DocStatus = 'O')
AND
IF (U_CableCk = 'Y') AND (U_CAApr = 'C') AND
IF (U_Electrical = 'Y') AND (U_ELApr = 'C') AND so on...
In this example, if U_cableck = 'N' I want to ignore that part, and check U_Electricalck = 'Y' and U_elapr='C'.
To put it more simply, if the first condition is Y, then check to see if the second is 'C'. If all cases are true, then return the data fields.
There are about 8 conditions within the OQUT record like this. I could write a large number of selects with AND and OR statements to cover all possible combinations, but am looking for a better way.
I have tried writing case statements into my query, but nothing is working.
Any help is much appreciated
Suda, tried the query this way:
SELECT docnum, CardCode, Cardname from OQUT where U_PLApr = 'I' and canceled = 'N' and docstatus = 'O' and ((U_cableck = 'Y') and (U_CAApr = 'C')) and ((U_electricalck='Y') and (U_ELApr='C'))
If U_cableck <> Y, or U_electricalck <> Y, the query returns no results, when it should show results. Only when all the vales are Y and C does the query give results. Which is not always the case.
The possible data here is:
U_Cableck U_CAApr U_Electrical U_ELApr Should have Result
Y C Y C Yes
Y I Y I No
Y C N I Yes
Y I N I No
N I Y C Yes
N I Y I No
N I N I No
Y and N represent Yes and No - whether or not the user needs to approve
C and I represent Complete and Incomplete - the user changes incomplete to complete if they are Yes in the first UDF.
Hope this helps it make sense, may not be possble to test the data this way. Thanks
Similar Messages
-
Query for Alert on production order to be released
Dear all users and experts,
I need a query for getting an alert on production orders to be released (from planned status to release status) by whether reading the release date of production orders created from 'order recommendation window' or by reading the due date of production order and substract the lead time(days) of the item from its due date or by any means you know best.
Thanks and best regards,
Farhan SufiHi Gordon and Joseph,
Thanks to both of you for giving me queries.
Gordon, I made 3 production orders for testing from MRP order recommendation window from which 2 production orders has release date of today 9th July, 2010 (due date 12th July monday) and the 3rd one has release date of after weekend i.e. 12th July 2010 (due date is 13th July). release dates are calculated by MRP acording to the items' lead time and due date.
Gordon, when I applied your query It gave me msg 'no data was found as a result of this selection criteria' Can you explain what your query will give me in result?
where as Joseph, when I applied your query on alert, it gave me all 3 production orders as an alert to be released. I was expecting it will give me alert for 2 production order for today as their release date in MRP is today(9th July, 2010) and the alert for 3rd production order should come on 12th July and not today.
what I understood your query is displaying all production orders which have status 'planned' regardless of their release date.is it?
Joseph can you edit this query in such a way that It should consider the release date (calculated from due date and lead time in MRP order recommendation window) and display only those production orders which should be released today and exclude those which have release date in future. so that I can get alert for only those production orders which should be released today.
I hope good response from both of you
Thanks and best regards,
Farhan -
Creating an SQL Query for Project Custom Fields Values
Hello:
I'm currently trying to create an SQL Query to show all of the server's Project Custom Fields Values, along with the modification date.
So far, I've managed to display correctly all of the data for all of the Projects' text value Custom Fields (those not based on a LookUp Table) with this query:
SELECT
MSP_PROJECTS.PROJ_NAME,
MSP_CUSTOM_FIELDS.MD_PROP_NAME,
MSP_PROJ_CUSTOM_FIELD_VALUES.CODE_VALUE,
MSP_PROJ_CUSTOM_FIELD_VALUES.TEXT_VALUE,
MSP_PROJ_CUSTOM_FIELD_VALUES.MOD_DATE
FROM
MSP_PROJ_CUSTOM_FIELD_VALUES
INNER JOIN
MSP_CUSTOM_FIELDS
ON MSP_CUSTOM_FIELDS.MD_PROP_UID = MSP_PROJ_CUSTOM_FIELD_VALUES.MD_PROP_UID
INNER JOIN
MSP_PROJECTS
ON MSP_PROJECTS.PROJ_UID = MSP_PROJ_CUSTOM_FIELD_VALUES.PROJ_UID
WHERE
MSP_PROJ_CUSTOM_FIELD_VALUES.CODE_VALUE IS NULL
ORDER BY
MSP_PROJ_CUSTOM_FIELD_VALUES.PROJ_UID,
MSP_PROJ_CUSTOM_FIELD_VALUES.MD_PROP_UID
However, when I try a new Query to obtain the actual values for the Projects Custom Fields that do use a LookUp Table, I can't seem to find what table in the model I'm supposed to link to the MSP_PROJ_CUSTOM_FIELD_VALUES.CODE_VALUE field (the TEXT_VALUE
field has NULL value when CODE_VALUE field isn't NULL)
Any suggestions on how to obtain the actual Projects' custom fields values instead of the Code Value, for Metadata that do use a LookUp Table?
Also, I'm able to run this query only in the Published Database, since the MSP_CUSTOM_FIELDS table is empy in the Draft Database. Why is that?
Awaiting your kind reply,
Sebastián Armas PMO Project ManagerHi Sebastián, rather than directly accessing the database it would be better to use the PSI to get this data. Take a look at the ProjTool sample in the SDK whcih gets this data.
Best regards,
Brian.
Blog |
Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
Project Server TechCenter |
Project Developer Center |
Project Server Help | Project Product Page -
How to Create Specific SAP Query for Sales BOM
Dear All Salute !!
How I can create a SAP Query which provide information from the Sales Order-Line Item, this specific material is having any BOM or not?
Suppose, user want Input,
Sales Order No., Product Category, Duration of Sales Order Release.
want Output,
Sales Order No., Customer No., Customer Description, Sales Order Line Item, Material No., Material Description, Delivery Date, Quantity, Sales Order release Date
Users requirement is, List of All Line Items for which BOM is yet to be Uploaded in the System.
Please provide complete detail with Table & field by using SAP Query.
Rgds
Srivastav
+91-9973504950If I am correct, in table KDST, you can see the details of Sales BOM with sale order. Since right now, I dont have access to SAP, I am unable to confirm this. You have to consider this table and develop on your own logic with the help of ABAPer.
thanks
G. Lakshmipathi -
How to create STO Condition record for a condition Type ?
I am doing config for STO.
in MEK1 , it is asking for Vendor, but in my case I am doing STO by using delivery VL01 and receipt by MIGO.
I want to know abt- How to create Condition Record for STO so that STO order will have Moving Average Price f Material.
Sorry I m new to MM so pls help.Solved
-
Hi,
Wondering if someone could please help me out with query required for Alert.
Alert to notify user of any Sales Order entry added for items belonging to Item group code "171".
The resulted Alert needs to give the alerted user the ability to drill down into listed orders.
I appreaciate any help given.
thks
KellyHi,Guys
Generally, you can use the SP named by SBO_SP_TransactionNotification,
for example
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER proc SBO_SP_TransactionNotification
@object_type nvarchar(25), -- SBO Object Type
@transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error int -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
-- ADD YOUR CODE HERE
declare @bbb nvarchar(200)
declare @aaa int
if @object_type='17'--sale order
begin
if ((@transaction_type='A') or ( @transaction_type='U'))
begin
select @aaa=count(itemcode) from rdr1 where docentry =@list_of_cols_val_tab_del and itemcode not in (select itemcode from oitm where itmsgrpcod = '171')
if @aaa>0
begin
set @error=1
set @error_message='Item group should belong in 171'
end
end
end
select @error, @error_message
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
also you can use some approval procedures.
Please try it
Best regards
Eric Wang -
FM or BAPI for creating/deleting condition records for an output type
Hi all,
what is the FM or BAPI for creating and deleting the condition records for a Z(custom) output type.You can use trasaction SXDA_TOOLS.....
object type BUS3003
program type BINP
program/method RM06IBI0
but the fields must be sequentially written in the txt, with every space inclusive.... -
Query for Alert - Document saved as Draft
Hi,
I have no idea how a query is written to activate the alert. My requirement is in 2005B PL 27. I have give an alert to a particular user when a GRPO is saved as Draft. Is that possible? If yes, what is the query that does the same?
Regards
SudattSorry Object Code for GRPO is 20,It is corrected in query.
SELECT T0.DocEntry,T0.DocDate,T0.CardName, T0.DocTotal FROM ODRF T0
WHERE DateDiff(dd, T0.DocDate,GETDATE()) = 0 AND T0.ObjType = 20
Edited by: Jeyakanthan A on May 26, 2009 12:41 PM -
Need Help To Create a Single Query For it
I am Making an Oracle Report
Which Include 4 Formulae Columns,Each of Them Represent
1) Qty_inWarehouse(Whose Location_code=1)
2) Value_inWarehouse(cost_price*qty)
3) Qty_inlocation(This will Populate Based On Used Entered Value,Means the user will enter a particular Location,Location_code is other than 1)
4) Value_inlocaiton
Now All these Values are Coming From Inv_stores Tables.If I use Formula for each Column Then I have to Select This
Table 4 Times(inv_stores)
The Structure Of Inv_stores Table is
location_code Varcha2(3), pk
Department_Code Varchar2(2), pk
Product_code Varchar2(15), pk
Qty_instock Number(6)
I have Written Query Like This
In This Query i Have Directly used Location_code as '1' and Another Location as '22' (Which is of One Showroom) and Tried By Testing With Department No.'10'.It is Selecting Cost Price from inv_product Table.
Now This inv_product is Product MAster Table.Each Product is uniquely identified by Department_code and
Product_code in this table.
Now in this Query i Want The Value per department Wise....
Select A.department_code,Sum(Nvl(A.qty_instock,0) - nvl(A.qty_reserved,0) + nvl(A.qty_delv_retn,0))
STK_QTY_INLOC,
Sum((Nvl(A.qty_instock,0) - nvl(A.qty_reserved,0) + nvl(A.qty_delv_retn,0))) STK_VALUE_INLOC,
SUM(nvl(inv_product.qty_backorder,0)) as Qty_BO,
Sum(Nvl(B.qty_instock,0) - nvl(B.qty_reserved,0) + nvl(B.qty_delv_retn,0)) STK_QTY_INWH,
Sum((Nvl(B.qty_instock,0) - nvl(B.qty_reserved,0) + nvl(B.qty_delv_retn,0))*nvl(inv_product.cost_pricekd,0)) STK_VALUE_INWH
from inv_stores A,inv_product,inv_stores B
where B.location_code(+) = '1' and
B.Department_Code(+) = '10' and
A.department_code = B.department_code(+) and
A.product_code = B.product_code(+) and
A.location_code = '22' and
inv_product.department_code = A.department_code and
inv_product.product_code = A.product_code
Group By A.department_code
But it is Giving Useless Results
now The 4 Diffrent Queries Which i am Uising is This
This Will Give me Stock quantity in Location
Select sum((nvl(qty_instock,0) - nvl(qty_reserved,0)) + nvl(qty_delv_retn,0))
into var_qty
from inv_stores
where department_Code = :department_code and
location_code = :location_code;
This will Give me Value For That Location
Select sum(((nvl(inv_stores.qty_instock,0) - nvl(inv_stores.qty_reserved,0)) +
nvl(inv_stores.qty_delv_retn,0))*nvl(inv_product.cost_price,0))
into var_stk_value
from inv_stores,inv_product
where inv_stores.department_Code = :department_code and
inv_stores.location_code = :location_code and
inv_product.department_code = inv_stores.department_Code and
inv_product.product_code = inv_stores.product_code;
This Will Give me Qty in W/H
Select sum((nvl(qty_instock,0) - nvl(qty_reserved,0)) + nvl(qty_delv_retn,0))
into var_qty
from inv_stores
where department_Code = :department_code and
location_code = '1';
This Will Give me Value in W/H
Select sum(((nvl(inv_stores.qty_instock,0) - nvl(inv_stores.qty_reserved,0)) +
nvl(inv_stores.qty_delv_retn,0))*nvl(inv_product.cost_price,0))
into var_stk_value
from inv_stores,inv_product
where inv_stores.department_Code = :department_code and
inv_stores.location_code = '1' and
inv_product.department_code = inv_stores.department_Code and
inv_product.product_code = inv_stores.product_code;
These 4 Queries is Selecting Data from inv_stores Table,I want to Combine Them Into One........
Suppose if we take for location 22 whose name is 'SHL'(It is s showroom)
Sample Data Will Be Something Like
Dept W/H(qty) W/h(Value) SHL(qty) SHL(Value)
00 3 90 1 30
10 0 0 2 50
12 5 100 1 20This forum is for issues with the SQL Developer tool. You'd get more response in the SQL And PL/SQL forum (where you cross-posted already).
Regards,
K. -
Dear Experts,
Kindly assist me how to create conditiaon type for just 4 sales order type out off 10 sales order type.
Exp:
We have ZZ01 till ZZ10 - SO type
ZZ01-ZZ04 - wanted to add aditional condition, that is admin fee during SO creation.
Means I need to create new condition type for SO as ZAF1 & then tag this condition type with GL acc. 2000000000.
- is that possible to view this condition only for those SO type & others are not allow to view during SO creation.
- this condition ZAF1 (adnib fee) should tag with correct GL acc. the moment billing taking place.
Kindly advice me what are configuration needed in order to create this settings. I never done this before for SD module. Thus please brief me well in order to place all these settings in SAP. Thank you.
rgds,
nanthaHi,
You can also follow this
Pricing procedure config:
In SD, the steps to configure Pricing procedure are as under:
Step 1:
Condition table: If existing condition table meets the requirement, we need not create a new condition table. Considering the requirement for new condition table, the configuration will be done in SPRO as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Table (select the required fields combination, which will store condition record).
Step 2:
Access Sequence: If existing access sequence meets the requirement, we need not create a new access sequence. Considering the requirement for new sequence, the configuration will be done in SPRO as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Access Sequence (Access sequence is made up of Accesses (Tables) & the order of priority in which it is to be accessed. Here we assign the condition table to access sequence.
Step 3:
Condition Type: If existing condition type meets the requirement, we need not create a new condition type. Considering the requirement for new condition type, the configuration will be done in SPRO as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Condition Type. It is always recommended to copy an existing similar condition type & make the necessary changes. Here we assign Access sequence to Condition type.
Step 4:
a. Pricing Procedure: It is recommended to copy a similar pricing procedure & make the necessary changes in new pricing procedure. Pricing Procedure is a set of condition type & arranged in the sequence in which it has to perform the calculation. Considering the requirement for new Pricing Procedure, the configuration will be done in SPRO as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Maintain Pricing Procedure.
b. Pricing Procedure: After maintaining the pricing procedure the next step will be determination of pricing procedure. Configuration for determining pricing procedure in SPRO is as follows: IMG --> Sales & Distribution --> Basic Function --> Pricing Control --> Pricing Procedure --> Determine Pricing Procedure.
Step 5: Condition record: Condition record is a master data, which is required to be maintained by Core team / person responsible from the client. During new implementation, the condition records can be uploaded using tools like SCAT, LSMW, etc. -
Create POWL query for specific user (not self)
Hello All,
was wondering if anyone had an idea on how to create a POWL query for a specific user. Even the low level method in class CL_POWL_QUERY_ACCESSOR seem to assume that you either are creating an administrator query for any/everyone or just for yourself.
One option is to create multiple queries (for each selection criteria that I want) and assign these directly to user (rather than the role) in the config - but that's config that I'd need to transport up - for what is essentially user level personalisation.
My strong favourite at the moment is to throw a breakpoint in CL_POWL_QUERY_ACCESSOR and manually change the user name as I save new queries in directly in production - but that's not exactly the cleanest solution.
Surely someone has had a need to actually create queries for users, not just delete them as per program POWL_D01?
Many thanks for any hints and tips
Cheers,
ChrisWell - I should point out that you don't have to transport those user assignment of queries - tables are production maintainable. However, you do have to transport up the query itself - so not ideal.
Oh well - don't think this one has an answer => closing it to open another question.
Cheers,
Chris -
Hi all,
i have created a condition Query to have only negative turnover values. Is it posible to have a total sum of only these negative turnover values? the general total i am having in my Query is of both the negative and positive turnover sum up together. Can someone sort me out with this.
Thanks alot.Hi,
create 2 querys,
1) one is for general (negative & positive values)
2) query for only negative values with condition,
insert both the querys in a Report designer report,
in report designer after u inserted the second query, just keep the result row and delete the other rows and execute. it will show you the sum of negative values without displaying the individual rows
Regards
ReddY A -
New Condition type for pricing
Hi,
I have a requirement wherein I want to create new condition type for add on cost of material with manaual entry . this condition is to be given in inforecord.
How to proceed? also, this contion type to be inserted in pricing schema??Dear Smitha,
You may ask what is the condition type?
For example:
- discounts, surcharges or tax taxes add to net price
- delivery costs, cash discounts add to effective price
Discounts or surcharges may be percentage based, quantity dependent, or absolute.
Best Regards,
ian, Wong Loke Foong -
New condition type for freight
hi,
i want to create new condition type for freight like some different ways of transportation like (roadrailair), three are at a time, which user exit i want to take and where it will triggerhi,
as you have to have three condition types for sales order
ROAD - VENDOR1 - ZVE1
RAIL - VENDOR2 - ZVE2
ROAD - VENDOR3 - ZVE3 - into sales order.
create a screen exit and add this in your delivery addational tab page - MANUAL ENTRY BY THE USER.
with
LEG 1 - ROAD - VENDOR1 - ZVE1
LEG 2 - RAIL - VENDOR2 - ZVE2
LEG 3 - ROAD - VENDOR3 - ZVE3
create a Z table which captures the information for this.
and link this table to FB70 - t.code
and settle it individually as per FFA.
balajia -
Condition types for import pricing
hi,
the conditions types for import pricing procedure are not appearing.
please suggest all the notes from where i can take reference and create the condition types for import process.
please also suggest what are they?
with regardsHi anitha,
In case of import purchase. u have to configure the conditions in pricing procedure. The condition types are as follows:
1)jcdb basic customs
2)jcv1 CVD
3) jec1 ECS on CVD
4)jed1 cess on customs
5) j1cv secess on cvd
6) jsdb secess on customs
Go to the master note no 1032295 for recent budget changes.
award points if found useful
chintu
Maybe you are looking for
-
IOS5: bluetooth connection between iphone and ipad fails
Hallo, a fter instalation of ios5 on both devices, my iphone4 cannot be no more connected to ipad1 over bluetooth. The both devices "see" each other, but when I coose on both - the connection it simply doesn´t established!? I have checked all option
-
Cluster environment / OBIEE 10.1.3.4.1
Hi All, Can anyone give me more information on Clustering 1> Can we make schedulers work in a cluster environment ? 2> Max number of servers in a cluster configuration ? Thanks Goutham
-
Weblogic Messaging Bridge stops working
Hi, we are having a Weblogic Integration Domain (WLI 8.1). This domain has several JMS distibuted destinations and Messaging Bridges. In Production environment, the Messaging bridge stops then and there and lot of messages get piled up in the queues.
-
I am trying to decide between the MacBookPro or an iMac. I specifically want to use it for FCE and Aperture and was wondering if there were any limitations either had that would stop you from considering one. I am editing HD video. Thanks!
-
PC logons required when it is not shut down.
My PC is for home use only & I am the only user so security is not a concern. When I let it set idle for a few minutes when I return I have to sign on. How can I eliminate this very irritating condition? I do have it set up so I don't have to logon a