cancel
Showing results for 
Search instead for 
Did you mean: 

HTMLB Complex Select Options

Former Member
0 Kudos

Hi,

I am pretty comfortable with developing BSP application with HTMLB.Now i have a complex scenario of forming the SELECT statement dynamically with HTMLB.I am in need of the following requirements,

1) Dynamically selecting the Columns in the TableView when the user selects the Fields available for that table.

2) Dynamic Arrangement of Columns for e.g User selected

1,4,7,8 and giving the option to the user to rearrange in

any way like 4,7,1,8 and save it in his user session.

3) Dynamic sorting of Columns for the TableView and the user specified the sort order

4) Dynamic filtering of data for the TableView

My whole idea is to take the BSP application to EP60. I know selecting Dynamically sounds crazy but some of the experts would have done it for sure.

Can any expert help me out in this?

Thank you

arun

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Points have been assigned to this Post

Former Member
0 Kudos

> Points have been assigned to this Post

Your point?

If you are referring to my posting of code, first I was saying thank you because the thread actually helped me as well. Plus since the thread is not marked "solved" I wanted to post a sample of code that worked.

Former Member
0 Kudos

Hi Arun,

How about we attack this from diffrent angle. If I were you, I select all possible fields required, in this case you have a 'static' internal table.

So let say there are 1 2 3 4 5 6 columns

and the user want to see only 2 4 5 and 3. You do a select for all the column (1-6), but you can define the column dynamically using iterator, so the user can only see the columns that s/he has selected (2 4 5 and 3). I believe this is what Brian said on the previous answer.

As far as sorting and filter, I believe this can be done 'automatically' if you see SBSPEXT_TABLE application, you can see how this can be done.

Honestly, I did not see the benefit of just retrieving the data (field) that is specified.. Maybe to reduce an overhead, but is 3-4 extra column will impact the performance that much? I doubt it.

Regards,

Iwan

Former Member
0 Kudos

Thanks Brian McKellar,

I too used the same example for dynamic select

SELECT (l_columns)

FROM spfli

INTO flights or <flights>

ORDER BY (l_order).

Let me reform the question now,

1) l_columns should be formed at runtime with the user selected columns which are provided by me as list of checkboxes.

2) The target in the INTO class should be dynamic enough to only have the fields selected by the user at runtime. Because i want the report to be formed based on the fields selected by the user and the table or field symbol in the INTO class is assigned to the <TableView>. I cannot specigy <Tableviewcolumns> because i don't know the list of columns at design time.

3) l_order should be formed at runtime with the sorting made by the user with the selected columns in l_columns.

4) I should be able to sort the columns by clicking the header of each and every column.

Anyhow you have provided me lots of valuable information through this Posting thanks for that.

If you could give your email i can attached the actual expections as screenshots. so that you understand it really clear.

Thank you

arun

former_member181879
Active Contributor
0 Kudos

Again Iwan's answers reflect very much my opinion. Unless of course either you have a lot of data, or you do NOT know the table to use.

In my opinion you can not see the forest, because you are blinded by the trees. Or more exactly, it is probably not difficult what you want to do, but you see many problems/questions. So I have a very special request to you. We change roles. I will ask questions, and you answer exactly only these questions. I will try to return tomorrow again to speed it up. Do not write more than the required answers.

(A) Do you know beforehand the name of the table? Is this table known at designtime? (Do I know it?) How many records are we looking at? Can we use SFLIGHT as example.

(B) Please read all of the ABAP online documentation on the sequence "INTO CORRESPONDING FIELDS OF TABLE itab". This you do by writing SELECT in any class, softly clicking with mouse on it, and then very firmly hitting the key labeled F1. Take the hour to read, as I do! So question B: did you find and read this? Is it going to be part of the solution?

(C) We forget everything about BSP and <htmlb:tableView>. We concentrate only on getting the data. Assume that the user has checked checkboxes 2,3&5. Write all of the ABAP code, as complete as you can, to just select the data from the database. Use question marks in your code where you are not sure.

We are going to skip the rest of your problems until we have succeeded in (C). This seems to be the biggest problem. We need the data in an internal table, and then everything becomes plain sailing.

You can email me a name.surname@sap.com. However, then everybody else misses out on the fun. The written word is a powerful thing. You are doing good, and we are getting close.

++bcm

Former Member
0 Kudos

Hello Arun,

I had implemented this kind of scenario in which columns of the TableView were dynamic. What I did was I created itab with specified number of rows and only one column. In the iterator I used second itab to form columns. loop on second itab to form columns and then form the appropriate rows.

Rajeev Patkie

Former Member
0 Kudos

This thread helped out sooooooooooooo mcuh!! Thanks guys!!!


<%
  DATA: columnDefinitions type TABLEVIEWCONTROLTAB,
          wa                type TABLEVIEWCONTROL.

          wa-COLUMNNAME          = 'RFCSYSID'.
          wa-TITLE               = 'System'.
          wa-SORT                = 'X'.
          APPEND wa TO columnDefinitions.
          CLEAR wa.

          wa-COLUMNNAME          = 'KERNRL'.
          wa-TITLE               = 'Kernel Level'.
          wa-SORT                = 'X'.
          APPEND wa TO columnDefinitions.
          CLEAR wa.
%>

<htmlb:tableView
                     id="dbtable"
                     width="100%"
                     footerVisible="false"
                     fillUpEmptyRows="false"
                     headerVisible="true"
                     headerText="<%=tmpText%>"
                     design="ALTERNATING"
                     sort="SERVER"
                     table="<%=dbtab%>"
                     filter="server"
                     columnDefinitions="<%= columnDefinitions %>" />

Former Member
0 Kudos

Thanks Brian McKellar,

This is the same example i used to create the report. But what i am looking for is, I will provide checkboxes to select the list of columns(This checkbox column values are hardcoded) and at runtime and wheni press a button it should display a report with only the selected columns in the checkboxes.

It is the same thing for Arranging the column and sorting. Everything is selected by the User at runtime.

Is this really possible in HTMLB, Because in the Select statement the INTO clause target is an static table which has all the fields in it, I want this to table to be a dynamic structure or field synbol so that it can change the number of fields at runtime.

Thank you

arun

former_member181879
Active Contributor
0 Kudos

Arun,

I am still slightly confused by your question. There are one or two questions:

(1) How to get the rendering of the table using the <htmlb:tabelView> so dynamic that only specific columns are used and in a specific sequence. For this, you can very easily do it with the column definitions. If you really fail, we can build an example.

(2) How to use the SELECT statement to only fetch specific columns from the database (so as to obtimize load performance). This question has nothing to do with BSP. I look at the online documentation for ABAP about 60 seconds (using the SELECT keyword as search criteria), and find this example code:


  DATA: l_columns TYPE TABLE OF string, 
        l_container TYPE string, 
        l_count     TYPE i. 
  APPEND `CITYTO`   TO l_columns. 
  APPEND `count( * )` TO l_columns. 
  SELECT (l_columns) 
         FROM spfli 
         INTO (l_container, l_count) 
         GROUP BY (l_group). 
    WRITE: / l_count, l_container. 
  ENDSELECT. 

The documentation is relatively complex here. Maybe you can read it directly in your system, as I do not want to paste all of it here. Of course l_columns can have more fields.

Is this roughly what you wanted?

former_member181879
Active Contributor
0 Kudos

Would recommend as starting point this article: <a href="/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator">BSP Programming: HTMLB TableView Iterator</a>.

What you are specifically interested in, is the column definition method in the iterator. This is the time that can you update, completely replace, or even in that moment actually define the column definitions. It is easily possible to specify what columns should be rendered, and in what sequence. Look at all the flags that this table support per column.

We do not have the concept of column select in <htmlb:tableView>.