cancel
Showing results for 
Search instead for 
Did you mean: 

CL_HTMLB_MANAGER=>GET_SIMPLE_DATA

Former Member
0 Kudos

Hello,

I am implementing a BSP with a tableview iterator. When the user selects one or more rows and clicks a 'Submit' button I want to pass the key field (which does not need to be displayed) via a hidden form field to a function module which will update a row in a BW master data table.

I used an obj of CL_BSP_BEE_TABLE to put the input field together with another field into a custom column. I have the display working and I am now trying to get the key values from the hidden input field in each selected row of the tableview. It seems that GET_SIMPLE_DATA is best the way to do this (but if anyone has other suggestions please speak up). I am brand new to ABAP but have some experience in OO programming and web applications.

So my question is about the 'DATA' parameter in GET_SIMPLE_DATA. I am not clear on the form or syntax. From reading <a href="https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=http%3A//forums.sdn.sap.com/thread.jspa%3FthreadID%3D34487">this post</a> it would seem that this is supposed to be in the form <b>

DATA = <i> InternalTableFromTableview</i>_LINE-<i>fieldname</i>

</b> I tried declaring something like that with this statement:

<b>DATA <i>InternalTableFromTableview</i>_LINE like line of <i>InternalTableFromTableview</i></b>

but the compiler does not like it because I am referencing column names that I've created in <b>ITERATOR~GET_COLUMN_DEFINITIONS</b> (including the custom column), not the actual field names in the interal table from my BSP application.

Can someone please explain where these parameters come from and how I would declare/get them? I can post code if necessary.

Thanks very much,

Nat

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Brian, thanks for your input. I agree that it makes sense that the tableview would have to be identified.

In fact it seems that both the tableview AND the input field would have to be ID'd. How else would the method know what I am looking for if, for example, I had more than one input field and/or tableview? Would you agree?

athavanraja
Active Contributor
0 Kudos

As Biran had mentioned, it should be the table view's ID.

Have a look at the source of the rendered page, you will get an idea.

Regards

Raja

Former Member
0 Kudos

I understand how the naming convention works for IDs in the rendered HTML. I was able to get the info I needed earlier by using cl_htmlb_manager=>get_data and passing in the ID in that format, but I'd still like to understand how GET_SIMPLE_DATA works. If I pass it the tableview ID to the ID parameter I don't see where the inputfield ID goes. I'll keep playing with it and post my findings here. Thanks to Raja and Brian for their comments.

athavanraja
Active Contributor
0 Kudos

You can just simply create a type string variable and useit.

data: hidden_key_field type string .

CALL METHOD cl_htmlb_manager=>get_simple_data

EXPORTING

request = request

id = 'id'

CHANGING

data = hidden_key_field .

Regards

Raja

Former Member
0 Kudos

Thanks for the response Raja, however it seems like the method needs more than just REQUEST, ID, and an empty string variable.

I tried your suggestion but could not see where the method returned anything (e.g. in the debugger, hidden_key_field never had a value).

In the forum post I referred to above, the 'ID' parameter was the name of the tableview. Where then would I reference the actual data I'm looking for, namely the input field in my iterator?

athavanraja
Active Contributor
0 Kudos

Let me understand your question.

You have a HTMLB table view and one of the columns (which is a key field) is hidden and upon row selection you want to get the key value right?

if yes.

give the key column name in htmlb:tableview tag.

<htmlb:tableView id                  = "test"
                           .....
                           keyColumn           = "KEY_COL"

KEY_COL is the column name of the table

and in the oninputprocessing

event = cl_htmlb_manager=>get_event( request ).

 if event->event_type eq cl_htmlb_event_tableview=>co_row_selection .


  data: tv type ref to cl_htmlb_tableview.
  tv ?= cl_htmlb_manager=>get_data(
                          request      = runtime->server->request
                          name         = 'tableView'
                          id           = 'test' ).

  if tv is not initial.
    data: tv_data type ref to cl_htmlb_event_tableview.
    tv_data = tv->data.
tv_data->selectedrowkey . this will hold the key field value.

hope this is clear.

Regards

Raja

Since you are new to SDN i suggest to have a look at this weblog.

/people/mark.finnern/blog/2004/08/10/spread-the-love

Former Member
0 Kudos

Raja, thanks for your efforts to help.

If you'll notice in my original post, I said I am using a tableview <i>with an iterator and a BEE</i> to build a custom column containing the hidden input field combined with a visible attribute from the internal table. Moreover my question is not about how to pull data from a tableview column but rather how to use CL_HTMLB_MANAGER=>GET_SIMPLE_DATA.

And thanks for the link about how to award points. I am fairly familiar with that.

athavanraja
Active Contributor
0 Kudos

i think you originally stated that you had problem declaring a variable for the chaning parameter <b>DATA</b> of cl_htmlb_manager=>get_simple_data method.

For which i have already replied that the variable should be of type string.

<b>How to use CL_HTMLB_MANAGER=>GET_SIMPLE_DATA</b>

For htmlb:inputfields

CALL METHOD cl_htmlb_manager=>get_simple_data

EXPORTING

request = request

id = '<input field id>'

CHANGING

data = <variable>.

for htmlb:tableview cell

CALL METHOD cl_htmlb_manager=>get_simple_data

EXPORTING

request = request

id = '<table id>'

row_idx = <row number>

col_name = '<column name>'

CHANGING

data = <variable> .

Is this what you are looking for or have i completely lost in understanding your requirement.

Regards

Raja

Former Member
0 Kudos

Raja, thanks for your continued help with this. Yes, what I was looking for was an explanation of how GET_SIMPLE_DATA works. I appreciate you explaining in your last post.

The problem is I am not getting any data back. Here is my code:


data: wa3 like line of selected_data,
      wa4 like line of selectedRowIndexTable.

data: foo type INT4,
      temp type string.

LOOP AT selectedRowIndexTable into foo.


      CALL METHOD CL_HTMLB_MANAGER=>GET_SIMPLE_DATA
          EXPORTING
            REQUEST       = RUNTIME->SERVER->REQUEST
            ID            = 'p_cell_id'
            ROW_IDX       = TABLE_EVENT->SELECTEDROWINDEX
            COL_NAME      = 'myColumnName'
          CHANGING
            DATA          = temp.


   MOVE temp to wa3-aribacode.  
   APPEND wa3 to selected_data.
endloop.

One point I want to clarify: I am using an input field within a tableview cell, so I am not sure which version of the method call I should use (i.e. whether to include the column ID or not). I've tried both and neither way returns anything. Note that I am referencing the input field ID and column ID that were both built and added in the iterator.

Am I missing something else?

Thanks.

Nat

Message was edited by: Nat Grauman

former_member181879
Active Contributor
0 Kudos

ID = 'p_cell_id' looks not correct. From what I remember the ID must be the ID of the tableView you rendered.

p_cell_id was previously an input parameter into your iterator with the exact string for the cell. You can look at its value in the debugger, see it in the HTML, and then debug through this get_simple_data to see how it builds up again the correct ID string to get the correct form field from incoming request.