cancel
Showing results for 
Search instead for 
Did you mean: 

F4 help for only a single cell in a table

Former Member
0 Kudos

Dear All,

The requirement here is to provide input help for only a particular cell in a table.

This cannot be achieved by assigning search help to the attribute of the context as this will render all the cells of that particular column with F4 help. I tried applying the cell variant concept but only go up to a certain extent.

I tried OVS as well. But for this to work we need to lead select the entry and then go ahead with F4, which will make is inconvenient for the user.

I even searched the forum for some answers, but i could only go to a certain extent with the help of those.

So, if anyone out there has any idea, please help me out. Also, if this is a repeat post by any chance (i think not) kindly provide me with the link of the original.

Thanks and Best Regards,

Pramod

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You can do this with a cell variant. What you need is multiple attributes within the context that hold the same data. You will need some ABAP logic to copy values from one field to some dummy fields to create the multiple copies of the attribute.

That way when you create your cell variants, you can bind the input fields to different attributes. You could have one attribute with a value help and one without.

Here is an example. The first row has a value help on Carrier ID:

http://www.flickr.com/photos/tjung/2714133068/in/set-72157606418550143/

The second row does not have a value help on Carrier ID:

http://www.flickr.com/photos/tjung/2714133094/in/set-72157606418550143/

Here is what I did with my context - I just manually created a second CARRID attribute:

http://www.flickr.com/photos/tjung/2713320505/in/set-72157606418550143/

abhimanyu_lagishetti7
Active Contributor
0 Kudos

good idea,

taking dummy attribute and setting using cell variant. woow .. cool

Abhi

Former Member
0 Kudos

Thanks a lot Thomas, that helps !

Just one other question.. Is there any Demo Application (like WDR_TEST_TABLE for cell variants) that gives me further insight into this ?

Regards,

Pramod

abhimanyu_lagishetti7
Active Contributor
0 Kudos

I am running older versions, so i didn't find any sample dynpros..

You can try with this peace of code..nyways..

DATA: LR_TABLE TYPE REF TO CL_WD_TABLE.

DATA: LR_COLUMNS TYPE CL_WD_table_column=>tt_table_column.

DATA: LR_COLUMN TYPE REF TO CL_WD_TABLE_COLUMN.

DATA: LR_EDITOR TYPE REF TO CL_WD_VIEW_ELEMENT.

DATA: LR_TEXT TYPE REF TO CL_WD_TEXT_VIEW.

DATA: BINDING TYPE STRING.

DATA: LR_CELL TYPE REF TO CL_WD_TABLE_STANDARD_CELL.

IF FIRST_TIME EQ ABAP_TRUE.

LR_TABLE ?= VIEW->GET_ELEMENT( 'TBL_COMPONENTS' ).

LR_COLUMNS = LR_TABLE->GET_COLUMNS( ).

LOOP AT LR_COLUMNS INTO LR_COLUMN.

LR_EDITOR ?= LR_COLUMN->GET_TABLE_CELL_EDITOR( ).

BINDING = LR_EDITOR->BOUND__PRIMARY_PROPERTY( ).

IF BINDING EQ 'RRSO.SOCOMP.POSNR' OR

BINDING EQ 'RRSO.SOCOMP.MATNR' OR

BINDING EQ 'RRSO.SOCOMP.KWMENG' OR

BINDING EQ 'RRSO.SOCOMP.NETPR' OR

BINDING EQ 'RRSO.SOCOMP.POPRICE' OR

BINDING EQ 'RRSO.SOCOMP.QUANTITY'.

LR_CELL = CL_WD_TABLE_STANDARD_CELL=>NEW_TABLE_STANDARD_CELL( VIEW = VIEW

VARIANT_KEY = 'TOTAL' ).

IF BINDING EQ 'RRSO.SOCOMP.QUANTITY'.

LR_TEXT = CL_WD_TEXT_VIEW=>NEW_TEXT_VIEW( VIEW = VIEW

TEXT = 'Total'

H_ALIGN = CL_WD_TEXT_VIEW=>E_H_ALIGN-FORCED_RIGHT ).

ELSE.

LR_TEXT = CL_WD_TEXT_VIEW=>NEW_TEXT_VIEW( VIEW = VIEW ).

ENDIF.

LR_CELL->SET_EDITOR( LR_TEXT ).

ENDIF.

LR_COLUMN->ADD_CELL_VARIANT( LR_CELL ).

ENDLOOP.

ENDIF.

This code is for setting Text View as cell editor, instead text view u can take input field and use bind_value method to bind with another context attribute.

Abhi

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I wouldn't recommend the approach that Abhi suggested. He is using coding to create the cell variants and this should only be used in a last resort when doing dynamic creation of the entire UI. You should instead define the cell variants at design time in the layout and use context binding to control with cell variant is displayed.

I don't know of any examples in the system, but it isn't really that difficult to do. You go to your table column, right mouse click and choose insert cell variant. Create a cell variant of type TableStandardCell.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/56/5e9041d3c72e7be10000000a1550b0/frameset.htm

Then create the UI element (inputField in this case) as a child of the the TableStandardCell using Context menu option Insert Editor. You have control here to create the UI element the way you want it - and to set the bindings to the alternative context attribute.

Back on the Table Column UI element itself, there is a property called selectedCellVariant. Bind this property to a context attribute that will control which cell variant is used for a particular row. This is how you can choose to switch between the standard cell variant and the one you just created that has no value help attached.

Former Member
0 Kudos

Thomas,

I found the answer in one your previous thread replies. Thanks a lot for the help again. Problem solved !

Regards,

Pramod

Answers (2)

Answers (2)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

I don't think this is possible.. You can hav a dropdown by index and provide different valueset for different cells.

Abhi

vivekananthan_sellavel
Active Participant
0 Kudos

HI,

You can use the below procedure to attach a search help to your dynamically created context attribute.

data lo_nd_info type if_wd_context_node_info.

lo_nd_info = lo_nd->get_node_info( ).

CALL METHOD lo_nd_info->set_attribute_value_help EXPORTING name = 'ATTR1' " Your attribute Name value_help_mode = '121' " Valid value help mode value_help = 'Z187442'. " Search help name

The various possible values that you can pass to value_help_mode are as shown below.

deactivated 101

automatic 111

ddic 121

ovs 131

application_defined 141

Regards

vivek