on 08-29-2005 11:17 PM
Hey Guys,
I'm trying to build a formatted search that will choose an item code based on a prompt where the user enters an item group (easy enough).
After the user enters the first prompt, there would be a second prompt that would be conditional based on the item group entered from the first prompt. For example, if the user chooses "Sports Equipment," the user would be prompted for a UDF, "Sport."
My question is how do I build that conditional statement so that SBO will prompt the user correctly the second time?
Appreciate any input or ideas!
Kevin
Yes, I understand, thank you! However, I am still facing the issue of attempting to set it up to change the choose from list according to data entered by the user.
We came up with the solution to show multiple fields in the formatted search. However, the problem we are still having is that when I attempt to enter a case statement with multiple 'if' statements, I get an error in SAP. Here is my query so far:
SELECT T0.ItemName, T1.ItmsGrpNam,
(CASE WHEN T1.ItmsGrpNam = 'Accessories' THEN T3.U_LstItm1
WHEN T1.ItmsGrpNam = 'Ball Games' THEN T1.ItmsGrpCod
ELSE T3.U_LstItm2 END) AS 'List Item'
FROM OITM T0 INNER JOIN OITB T1 ON T0.ItmsGrpCod = T1.ItmsGrpCod
INNER JOIN [dbo].[@SIS] T3 ON T3.U_ItemGrp = T1.ItmsGrpNam
WHERE T3.U_ItemGrp = '[%0]'
Of course this is still in testing so even if it works it won't give me the desired result. But I need this to work to pull the desired information. Any hints?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, sorry I didn't get back to you very quickly, things have been hectic but I think this may help solve the problem.
SELECT ItemCode, ItemName, ItmsGrpCod,
(CASE WHEN ItmsGrpCod = 106 THEN U_OD
WHEN ItmsGrpCod = 111 THEN U_HS END) AS "User-Defined Field 1"
FROM OITM
This works exactly the way I'd expect it to. However, when I add this:
WHERE ItmsGrpCod = [%0]
It doesn't work anymore in SBO. The error message says, "File not found 'Received Alerts' (ODBC - 2004)"
Not sure what this means exactly because the [%0] works in other queries for bringing up real time variables.
Does this simplify the problem a bit for you?
Kevin, you should use the alias for table name in your query. The following query works fine for me:
SELECT
T0.ItemCode,
T0.ItemName,
T0.ItmsGrpCod,
(
CASE
WHEN T0.ItmsGrpCod = 106
THEN T0.U_OD
WHEN T0.ItmsGrpCod = 111
THEN T0.U_HS
END
) AS 'UDF1'
FROM
OITM T0
WHERE
T0.ItmsGrpCod = N'[%0]'
HTH
if your query returns more than one record as the result, it won't make the choose from list come up by itself.
But if you press shift F2 in the field with the formated search that returns more than one record of data it will then show a choose from list.
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
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.