cancel
Showing results for 
Search instead for 
Did you mean: 

How to show only the result line of a Query result ?

Former Member
0 Kudos

Hi Experts,

I want to show only the result line of the Query. Is this possible in query Designer ?

In BeX Workbook, I can hide the rows but they grow or shrink dynamically and hence it is unpredictable how many rows to suppress.

If you have any solutions/workarounds, please reply !

Rekha

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

VBA coding can be used to display just the Result rows.

Somthing like this - modify as needed.

This scans the range of query results looking to find the last row, then checks those rows to see if the word Result is found or not, deleting (or you could just hide) the detail rows. There is also a LEAF option in BEx Boolean options that returns a 1 or 0 depending on whether a row is a detail or result that could also be used to hide rows rather than looking for the presence of "Result" in a particular column

Sub SAPBEXonRefresh(queryID As String, resultArea As Range)

For rownum = 17 To 64000 Step 1

' col 2 is the Total Result, col 3 is the User Group result

If Cells(rownum, 2) = "" And Cells(rownum, 3) = "" Then

lastrow = rownum - 1

Exit For

End If

Next

For rownum = lastrow To 17 Step -1

If Cells(rownum, 2) = "Result" Or Cells(rownum, 3) = "Result" Then

Rows(rownum).Hidden = False

Else

' Rows(rownum).Hidden = True

Rows(rownum).EntireRow.Delete

End If

Next

End Sub

Former Member
0 Kudos

Vaidyanathan

If you have just one characteristic for which there is only the result you want (perhaps Comp Code) it's the best way to achieve this.

Alternatively, in Excel run your query on Sheet B, have your query properties set to display the Results rows on top of the report, theis means the results will always be on for instance row 20. Then on Sheet A - use Excel formula to bring your results into the other sheet.

Regards

Gill