cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Tier Formatted Search

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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?

Former Member
0 Kudos

What data do you have in the @SIS table?

I believe that the problem does not lie with the case statement. Also what is the error you get?

Thanks,

Adele

Former Member
0 Kudos

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?

AlexGrebennikov
Active Contributor
0 Kudos

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

Answers (1)

Answers (1)

former_member184566
Active Contributor
0 Kudos

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