cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Table - Different Search Help depending on Cell

Former Member
0 Kudos

Hey you experts,

For my current project I'm working on an editable ALV Table. The table has three columns and shall contain:

1) The name

2) The Old value

3) The New Value

of an item.

The name of the item is known (e.g. Product Category, Accounting Type and so on).

The main problem: I have/want to offer search-help to the user in the second and third column depending on the content of the first cell ==> The search help can of course differ in several rows. Example:

NAME OLD-VALUE NEW-VALUE

P.Category Computer Notebook

Acc.Type. A B

The Computer field, shall have a search-help for a differnt data-type (DDIC help) than the A/B types.

Is this possible? There should be a kind of "On-Open-F4-Help" event in which i can adjust the F4 help, which shall be used depending on the currently selected cell.

Thanks for any help,

greetings,

Timo Stark

Accepted Solutions (1)

Accepted Solutions (1)

former_member628395
Active Participant
0 Kudos

Hi,

If I have understood you requirement, properly, I think OVS(Object Value Selector) should help you.

[SAP - help.sap.com|http://help.sap.com/saphelp_nw70ehp1/Helpdata/EN/47/9ef8c99b5e3c5ce10000000a421937/content.htm]

[Web Dynpro Valuehelp Using Object Value Selector|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cf40cf90-0201-0010-4a85-e5a207b900d8]

Regards,

Sagar

Former Member
0 Kudos

Thank you very much for your answer.

The Main Problem using OVS is, that i need to use already existing DDIC search-help for the data-types.

E.g. my company has programed a search-help for the data-type "Product category". Therefore if the user tries to add a line with the Name "Product Category" and he tries to start the field help for "New / Old Value" the already existing field help shall be used. I do NOT want to reprogram 20 different already programed search helps with OVS.

I hope you understand the issue, if not please ask for the things you can not understand. It would be very very important for me to finish the task in the next days therefore any hint would be perfect.

Former Member
0 Kudos

Actually I'm only searching for a method, that gets invoked when the user presses the "f4 help" button and which can adjust the ddic search help (=> the data type of the ddic search help shown) which will be shown afterwards depending on the selected cells.

E.g. the search-help for the cell on position (row 2, column 2) shall be ddic for DATE, on position (row 3, column 2) shall be ddic for Vendor. Is this possible?

former_member1151507
Participant
0 Kudos

Hi,

I am not sure if we can call any method before F4 help.

Alternativey, we can change the Search help in even handler for ON_LEAD_SELECT event of ALV using

CALL METHOD lo_nd_node_info->set_attribute_value_help

EXPORTING

name = 'KTONR'

value_help_mode = '121'

value_help = lv_vhelp.

set lv_vhelp value based on your requirement.

But one draw back of doing this is if we select the row, then only F4 will be changed. Otherwise it shows incorrect F4 help.

Regards,

Manogna

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Timo,

Pls share, if you were able to use different search helps based on conditions?

Former Member
0 Kudos

Hey Sam,

Yes I was able to achieve it. Create a collective search help, which includes all relevant data-elements.

Create a search hel exit.

Use the following code:


  IF CALLCONTROL-STEP <> 'SELONE' AND
     CALLCONTROL-STEP <> 'SELECT' AND
     " AND SO ON
     CALLCONTROL-STEP <> 'DISP'.
     EXIT.
  ENDIF.

*"----------------------------------------------------------------------
* STEP SELONE  (Select one of the elementary searchhelps)
*"----------------------------------------------------------------------
* This step is only called for collective searchhelps. It may be used
* to reduce the amount of elementary searchhelps given in SHLP_TAB.
* The compound searchhelp is given in SHLP.
* If you do not change CALLCONTROL-STEP, the next step is the
* dialog, to select one of the elementary searchhelps.
* If you want to skip this dialog, you have to return the selected
* elementary searchhelp in SHLP and to change CALLCONTROL-STEP to
* either to 'PRESEL' or to 'SELECT'.

  DATA: lv_line LIKE LINE OF SHLP_TAB,
        lv_line_tmp LIKE LINE OF SHLP_TAB.
  DATA lv_current_context_element TYPE REF TO IF_WD_CONTEXT_ELEMENT.
  DATA lv_parent_data TYPE /SIE/SRM_FYC_CHANGE.
  DATA:lv_current_node TYPE REF TO IF_WD_CONTEXT_NODE,
       lv_index TYPE i.

  IF CALLCONTROL-STEP = 'SELONE'.
    lv_current_context_element = CL_WDR_VALUE_HELP_HANDLER=>M_CONTEXT_ELEMENT.
    lv_current_node = lv_current_context_element->get_node( ).
    lv_index = lv_current_context_element->get_index( ).
    lv_current_node->get_static_attributes( exporting index = lv_index importing static_attributes = lv_parent_data ).

    "switch over parent data..
    CASE lv_parent_data-type.
      WHEN 10.
        "cost center
        lv_line-SHLPNAME = 'BBP_F4_COST_CTR'.
      WHEN 3.
        lv_line-SHLPNAME = 'COM_CAT'.
      WHEN OTHERS.
        lv_line-SHLPNAME = ''.
        callcontrol-step = 'EXIT'.
        EXIT.
     ENDCASE.


     LOOP AT shlp_tab INTO lv_line_tmp.
        IF lv_line_tmp-shlpname <> lv_line-shlpname.
          DELETE TABLE shlp_tab FROM lv_line_tmp.
          CONTINUE.
        ENDIF.
     ENDLOOP.
     callcontrol-step = 'PRESEL'.
    EXIT.
  ENDIF.

*"----------------------------------------------------------------------
* STEP PRESEL  (Enter selection conditions)
*"----------------------------------------------------------------------
* This step allows you, to influence the selection conditions either
* before they are displayed or in order to skip the dialog completely.
* If you want to skip the dialog, you should change CALLCONTROL-STEP
* to 'SELECT'.
* Normaly only SHLP-SELOPT should be changed in this step.
  IF CALLCONTROL-STEP = 'PRESEL'.
*   PERFORM PRESEL ..........
    EXIT.
  ENDIF.
*"----------------------------------------------------------------------
* STEP SELECT    (Select values)
*"----------------------------------------------------------------------
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
  IF CALLCONTROL-STEP = 'SELECT'.
*   PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB
*                       CHANGING SHLP CALLCONTROL RC.
*   IF RC = 0.
*     CALLCONTROL-STEP = 'DISP'.
*   ELSE.
*     CALLCONTROL-STEP = 'EXIT'.
*   ENDIF.
    EXIT. "Don't process STEP DISP additionally in this call.
  ENDIF.
*"----------------------------------------------------------------------
* STEP DISP     (Display values)
*"----------------------------------------------------------------------
* This step is called, before the selected data is displayed.
* You can e.g. modify or reduce the data in RECORD_TAB
* according to the users authority.
* If you want to get the standard display dialog afterwards, you
* should not change CALLCONTROL-STEP.
* If you want to overtake the dialog on you own, you must return
* the following values in CALLCONTROL-STEP:
* - "RETURN" if one line was selected. The selected line must be
*   the only record left in RECORD_TAB. The corresponding fields of
*   this line are entered into the screen.
* - "EXIT" if the values request should be aborted
* - "PRESEL" if you want to return to the selection dialog
* Standard function modules F4UT_PARAMETER_VALUE_GET and
* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
  IF CALLCONTROL-STEP = 'DISP'.
*   PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
*                           CHANGING SHLP CALLCONTROL.
    EXIT.
  ENDIF.

greetings

Former Member
0 Kudos

Hello Timo,

I think you can still use OVS input help. I presume you have a node containing name, old value and new value as attributes that you bound to the ALV.

You can assign OVS input help for the attributes old value and new value - so you would be creating a usage of component WDR_OVS. In the view you can create an event handler method for event 'OVS'of the interface controller of WDR_OVS. In the template code that opens up for this method you created, you can enter the structure for the search input and selection table for the F4 help.

snippet from the template code:

types:

begin of lty_stru_input,

  • add fields for the display of your search input here

field1 type string,

end of lty_stru_input.

types:

begin of lty_stru_list,

  • add fields for the selection list here

column1 type string,

end of lty_stru_list.

Here you can create more than one structure for search input and selection table depending on the different kinds of input helps that you need.

Thereafter, in each phase (configuration phase, search structure and selection table)

you can use the above structures on a case condition, the cases corresponding to the entry in the 'Name' column.

Hope this helps!

Cheers,

Vidya