WD:ABAP  change lead selection

Hi all,
I  need to change the lead selection according to a particular table column.  The lead selection is set to the first row of the table.  The table has some input fields which already contain values.  If the user changes the value of the input field in any row, the lead selection has to be changed to that row of the table without having to select that row.  I wrote the code in  onEnter event of the table, but it is returning the values of the first row that has the lead selection.  How do I change it? It would be helpful if u could please post the code too.
Thanks,
Sravanthi

Hi,
You can change it in ModifyView method. You can use setLeadSelection method.
Regards,
Parminder

Similar Messages

  • Change lead selection in dropdown by key

    Hi,
    I am using dropdown by key in one of my application.
    I am getting some values by calling a FM.FM
    returning me a table . My context for the dropdown is from the structure of the table.
    --drpplan(node)
      ---code -(attribute)
      -- desc-(attribute)
    I am binding the values from the table to the node info and to code attribute to populate the dropdown by key.
    It is working fine.
    My requirement is when user selects some thing from dropdown corresponding description should show in a textview.
    If I used a dropdown by key I know I dnt have write any code for this as the lead selection autometically changes. How to do this in dropdown by key.
    I konw I can write in the onselect method, call the FM again and read the table  with sected key and set the value.
    But in this approch I am calling FM twice hitting the db again.
    Is there any other way out. ?
    Thanks,
    Prosun

    u can store the data in an internal table when the FM is 1st called.
    And retrieve the describtion at  selection event.

  • Why does GET_STATIC_ATTRIBUTES or SET_STATIC_ATTRIBUTES change lead selecti

    I loop over all elements of a context node, and change some attributes.
    The code looks like this:
          LOOP AT lt_element_list INTO lo_el_element.
            lo_el_element->get_static_attributes( IMPORTING static_attributes = ls_element ).
            ls_element-created_by_name  = get_user_name( iv_user_id = ls_element-created_by ).
            ls_element-changed_by_name  = get_user_name( iv_user_id = ls_element-changed_by ).
            lo_el_element->set_static_attributes( EXPORTING static_attributes = ls_element ).
          ENDLOOP.
    This coding seems to change the the lead selection of the context node, which leads to problems somewhere else.
    Why does it change the lead selection and how can I prevent it?

    hi daniel.....
             i dont think there is a need for looping in this manner.
             you just get all the values of a node into an internal table.
             and then loop the internal table an make changes in it.
             then clear the node and pass this currently changed internal table into the node.
              the lead selection changes because you are setting the attribute and it might be stored in index 1 or the to the index where the lead selection is referred to. this might be your problem.
    ---regards,
       alex b justin

  • Changing lead Selection Color

    Hello,
    After applying themes which property do i need to to change so that the color of the row will change from from dark yellow to some light color when ever i select that perticular record
    in table UI Element.
    Thanks & Regards
       Kiran

    Hi,
    Use
    node.setLeadSelection(x)
    regards
    Ayyapparaj

  • WD ABAP: Lead selection on a recursive node

    Hi,
    I would like to know if lead selection is permitted on a recursive node in WD ABAP.
    As of now, methods 'set_lead_selection_index' or 'set_lead_selection' do not cause lead selection to change in my view, and the lead selection rests only with the first row in my table..(I have set the rowSelectable property to YES for my table.)
    Also, method call 'set_selected' performed on my target element does not solve the problem.
    Any help much appreciated!
    Best Regards.

    Hi Adithya,
    Yes, you can have a leadSelection on a recursive node and it can be changed by the same methods that are used for non-recursive ones.
    Best regards,
    Thomas

  • How to block lead selection change in a tree ?

    Hi Guys,
    <u>Scenario</u>
    I have MasterTree - DetailEditor pair. <i>MasterTree</i> is used to visit some tree-structured data and <i>DetailEditor</i> is used to edit currently selected tree node.
    <u>Requirement</u>
    If currently selected node data is updated through <i>DetailEditor</i> and needs to be saved, than on a subsequent tree selection change the user should be warned about unsaved data.
    <u>Implementation</u>
    In <b>onAction</b> event handler of <i>MasterTree</i> I check whether last selected node data is updated and needs to be saved and if this is the case rollback <i>treeSelection</i> to that node. On the time <b>onAction</b> event handler is called the tree selection is changed from the node that needs save to the newly selected node. In order to rollback <i>treeSelection</i> I need to introduce variable referencing last selected tree node.
    <u>Question</u>
    Is there any other technique to implement above scenario without using additional variable and manually rollback <i>treeSelection</i> ? For example, to plug in WDP framework on validation step just before lead selection is changed.
    Thanks in advance

    Alex,
    Here is a link to the phase model of WD:
    http://help.sap.com/saphelp_nw04/helpdata/en/b8/cd96edb9c8794aa362e6e8b4236a1f/frameset.htm
    There aren't any hooks provided prior to the event handlers being called. As far as I can tell, the way you are handling it is the only way that will work.
    -Cindy

  • How to prevent action (lead selection change) with popup (confirmation)?

    Hello all,
    I have an application where I want the user to confirm when he selects a new line in a table. When the user selects a new line in the table an other used component reloads its data based on the new line selected. If the user has not pressed the save button before selecting a new line, any changes in the used component will be lost.
    Currently I use onLeadSelect action on the table to call the load_data method(id=xxx) on the used component in order to display data relevant for id=xxx based the new line.
    I can open a popup to confirm from the onLeadSelect-action or the WDDoBeforeAction, but the action still happens; it doesn't wait for the user to respond. And then any changes are lost...
    I may have to store the parameters sent to the onLeadSelect method in context and continue when the button action from the pop-up returns via subscribed method, but I think this is an unelegant way of doing this.
    There must be a better way...? Any ideas?
    Regards,
    Christian Frier

    on the lead select event handler you can show the popup and no other logic. Move your logic to the ok and cancel button handlers of the pop up.

  • WDABAP: note of change of Lead Selection overall component

    Hi,
    I would like to build a similiar wd-application like wd-component 'wdt_master_detail'. There you will see a table with fly-data and below some details of the actual selected row of the table (by lead selection).
    The difference is that I want to seperate the data retrieval in a model-component(z_model) and for the table / details two seperate wd-components(z_table / z_detail) which mapps the fly-data. The wd-application instantiate a wd-component (z_container) which includes in its view z_table and z_detail.
    When the lead selection changes(by selecting a new row in the table of z_table) the details of z_detail should change to the details of the element with the lead selection. But this does not work! By node->get_lead_selection_index in z_detail I get only the inital lead-selection. node->get_lead_selection_index in z_table provides the right index.
    I tried also following: z_table calls z_model->set_lead_selection and this method set the lead selection of the original node new. But this does not help.
    Has someone an idee what I have to do that the component z_detail receive the information? Has the z_model to raise an event with the information of the new index? I hope not.
    Thanks a lot!
    Regards,
    Marcel
    added 1:
    I have an assumption why it does not work:
    Maybe z_table and z_detail instantiates two separate z_model.
    So a solution would be that z_container instantiates z_model and provide this instance to z_table and z_detail but I have absolutly no idee whether and how this could be working... Please kindly help.
    added 2:
    I thinking further a little bit loud...
    I have the idea that z_container mapps the context from z_model and set this these to input-node.
    z_table and z_detail mapps from z_container. ok, if I would like to create many application then I have to create related components(z_comp_appl_xx) and these components includes z_container. This would be maybe the solution if there is a instance problem(see added1) but I have tested and the details screen gets NOT the lead selection
    Message was edited by: Marcel Schreier

    Hi Marcel,
    to extend Thomas comments, here are some suggestions to turn it into code. Hope it helps.
    option A)
    assuming you name the usages in z_container "usage_z_model", "usage_Z_table", "usage_Z_detail":
    in componentcontroller of z_container methode wddoinit() do the following:
    DATA lr_model_usage    TYPE REF TO    if_wd_component_usage.
    lr_model_usage =   wd_this->wd_cpuse_usage_z_model( ).
    IF lr_model_usage->has_active_component( ) IS INITIAL.
      lr_model_usage->create_component( ).
    ENDIF.
    DATA lr_usage    TYPE REF TO    if_wd_component_usage.
    lr_usage =   wd_this->wd_cpuse_usage_z_table( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( model_usage = lr_model_usage ).
    ENDIF.
    lr_usage =   wd_this->wd_cpuse_usage_z_detail( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( model_usage = lr_model_usage ).
    ENDIF.
    Following this way, it is required to name the usages of z_model in component z_table and z_detail "MODEL_USAGE".
    option B)
    in componentcontroller of z_table and z_detail create an interface-methode set_usage() with one parameter ir_usage type if_wd_component_usage
      DATA lr_usage  TYPE REF TO  if_wd_component_usage.
      lr_usage = wd_this->wd_cpuse_usage_z_model( ).
      lr_usage->enter_referencing_mode( ir_usage ).
    in component z_container method wddoinit() do the following:
    DATA lr_usage    TYPE REF TO    if_wd_component_usage.
    DATA lr_if_ctr_z_table TYPE REF TO iwci_z_table.
    DATA lr_if_ctr_z_detail TYPE REF TO iwci_z_detail.
    DATA lr_model_usage    TYPE REF TO    if_wd_component_usage.
    *-- create instance of z_model
    lr_model_usage =   wd_this->wd_cpuse_usage_z_model( ).
    IF lr_model_usage->has_active_component( ) IS INITIAL.
      lr_model_usage->create_component( ).
    ENDIF.
    *-- create instance of z_table
    lr_usage =   wd_this->wd_cpuse_usage_z_table( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( ).
    ENDIF.
    *-- set usage
    lr_if_ctr_z_table =   wd_this->wd_cpifc_usgae_z_table( ).
    lr_if_ctr_z_table->set_usage( model_usage = lr_usage).
    *-- create instance of z_deatil
    lr_usage =   wd_this->wd_cpuse_usage_z_detail( ).
    IF lr_usage->has_active_component( ) IS INITIAL.
      lr_usage->create_component( model_usage = lr_model_usage ).
    ENDIF.
    *-- set usage
    lr_if_ctr_z_detail =   wd_this->wd_cpifc_usage_z_detail( ).
    lr_if_ctr_z_detail->set_usage( model_usage = lr_usage).
    regards, Ulli

  • Automatic lead selection change line in WD table

    Hi all,
    In footer of WD table, there is an input field, where user can specify number of record, which will be shown in first visible line.   
    I need to automatically select this line as lead selection. How can I achieve this behaviour? ( I'm using NW 2004 SP 19)
    Thanks for any answer.
    Regards,
    Juraj

    Hi Juraj,
    Assuming that when first time the view containing the table is loaded their is no changes required.
    Only when you enter some value in the input field then that record should be shown as first visible row ans should be lead selected.
    Now,
    1. Create a context attribute ctx_rowinput.Bind this context to the input field.
    2. Create a action say onInputShow and associate this with the input field.
        Either use a button and associate the action to the button or OnEnter event of input field.
    3. In your action onInputShow();
      public void onActionInputShow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        int i = wdContext.currentContextElement().getctx_rowinput();
        wdContext.node<table node>().setLeadSelection(i);
    4. In your wdDoModifyView add the following code
      public static void wdDoModifyView(IPrivateTest_Table_View wdThis, IPrivateTest_Table_View.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
        if(!firstTime)
              IWDTable table =(IWDTable)view.getElement("Table");
              table.setFirstVisibleRow(wdContext.currentContextElement().getctx_rowinput());
        //@@end
    <b>Note: If you enter 3 in the input field it will show 2 record as the node index
    starts from 0.And also before setting the leadselection and visible row check if
    the input value exceeds the nuber of rows in the table.</b>
    This has worked for me.

  • How to change the select options selection text dynamically in webdynpro abap ?

    I am using standard interface WDR_SELECT_OPTIONS.... i want to change the Selection text dynamically in my select options.I.E. if the select option is for VBELN field than i want to change its description SALES ORDER Number through Code to some other text.
    If anyone can please help me in this.

    Hi,
    You can achieve your requirement as below
    Get the range table of your selection field as below
              data lt_range_table type ref to data.
              wd_this->m_handler->GET_RANGE_TABLE_OF_SEL_FIELD(
                        exporting
                        i_id = 'VBELN'
                        receiving
                        rt_range_table = lt_range_table ).
    Update the selection field with new description - 'Your New Text'
              wd_this->m_handler->UPD_SELECTION_FIELD(
                        exporting
                             I_ID = 'VBELN'
                             I_DESCRIPTION = 'Your New text'
                             I_IS_AUTO_DESCRIPTION = abap_false
                             IT_RESULT = lt_range_table ).
    You can also pass the other parameters as per your requirement
    Hope this helps you.
    Regards,
    Rama

  • Table - Automatic scroll on changing the lead selection

    Hi @ all,
    I´ve got two tables and I want to add an entry from tab1 to tab2 if it is not existing in tab2. In case of an existing entry in tab2, the lead selection will be set on the entry in tab2 to show the entry. My Problem is the behaviour of the scroll bar in tab2. I need something like automatic scrolling to the lead selection of the table. Is that possible?
    Armin

    Hi  Armin,
    you can the use the proterty "First visible row" of the table.
    create one attribute of type WDy_BOOLEAN and bind it to the "First visible row" of the table.
    as soon as you set the lead selection,get its index and set it to the attributr that is( property  "First visible row").
    once this property is set , scrolling is done automatically and lead selected row is visible as first row.
    I hope this resolves your issue.
    Thanks,
    Krishna

  • ECATT abends during recording when lead selection is set to 0 on web dynpro

    We have a web dynpro application that works ok when running by itself.   When we tried to record ECATT testing on it, it abended after we click on a selection from a list of values.    The error on the browser indicated an error on the "lead select".   After reviewing the dump, we found that it abends on an exception when the lead selection on the ALV is not set.   When we changed our code to set the lead selection to 1, the ECATT recording worked.
    We have a requirement to set the lead selection of ALV to 0 so we need to change back our code.   We just did the setting to 1 just to get ECATT recording to work for now.    Does anybody know why ECATT requires this?   Is there a support packs that fixes this?
    Here is a snippet from ST22 for more details on this:
    Runtime Errors         UNCAUGHT_EXCEPTION
    Exception              CX_WD_CONTEXT
    Date and Time          2007/02/07 14:50:06
    Short text
    An exception occurred that was not caught.
    What happened?
    The exception 'CX_WD_CONTEXT' was raised, but it was not caught anywhere along
    the call hierarchy.
    Since exceptions represent error situations and this error was not
    adequately responded to, the running ABAP program
    'CL_WDR_CONTEXT_NODE===========CP' has to be
    terminated.
    What can you do?
    Note down which actions and inputs caused the error.
    To process the problem further, contact you SAP system
    administrator.
    Using Transaction ST22 for ABAP Dump Analysis, you can look
    at and manage termination messages, and you can also
    keep them for a long time.
    Error analysis
    An exception occurred which is explained in detail below.
    The exception, which is assigned to class 'CX_WD_CONTEXT', was not caught and
    therefore caused a runtime error.
    The reason for the exception is:
    The lead selection has not been set. VIEW_TABLE
    How to correct the error
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "UNCAUGHT_EXCEPTION" "CX_WD_CONTEXT"
    "CL_WDR_CONTEXT_NODE===========CP" or "CL_WDR_CONTEXT_NODE===========CM00V"
    "_RAISE_ELEMENT_NOT_FOUND"
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
    To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    System environment
    SAP-Release 700
    Application server... "torsapd01"
    Network address...... "10.2.75.183"
    Operating system..... "Windows NT"
    Release.............. "5.2"
    Hardware type........ "4x AMD64 Level"
    Character length.... 8 Bits
    Pointer length....... 64 Bits
    Work process number.. 0
    Shortdump setting.... "full"
    Database server... "TORSAPD01"
    Database type..... "MSSQL"
    Database name..... "PR3"
    Database user ID.. "dbo"
    Char.set.... "English_United State"
    SAP kernel....... 700
    created (date)... "Aug 28 2006 22:20:27"
    create on........ "NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00"
    Database version. "SQL_Server_8.00 "
    Patch level. 75
    Patch text.. " "
    Database............. "MSSQL 7.00.699 or higher, MSSQL 8.00.194"
    SAP database version. 700
    Operating system..... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2"
    Memory consumption
    Roll.... 16128
    EM...... 16759616
    Heap.... 0
    Page.... 0
    MM Used. 12713776
    MM Free. 4042608
    User and Transaction
    Client.............. 200
    User................ "SIC0010"
    Language Key........ "E"
    Transaction......... " "
    Program............. "CL_WDR_CONTEXT_NODE===========CP"
    Screen.............. "SAPMHTTP 0010"
    Screen Line......... 2
    Information on Caller ofr "HTTP" Connection:
    Plug-in Type.......... "HTTP"
    Caller IP............. "10.49.77.47"
    Caller Port........... 8000
    Universal Resource Id. "/sap/bc/webdynpro/sap/zpr3_base_price/"
    Information on where terminated
    Termination occurred in the ABAP program "CL_WDR_CONTEXT_NODE===========CP" -
    in "_RAISE_ELEMENT_NOT_FOUND".
    The main program was "SAPMHTTP ".
    In the source code you have the termination point in line 11
    of the (Include) program "CL_WDR_CONTEXT_NODE===========CM00V".
    Source Code Extract
    Line
    SourceCde
    1
    method RAISEELEMENT_NOT_FOUND.
    2
    data: l_count type I,
    3
    l_node_name type string.
    4
    5
    l_node_name = if_wd_context_node~get_path( ).
    6
    7
    l_count = if_wd_context_node~get_element_count( ).
    8
    if l_count = 0.
    9
    raise exception type cx_wd_context exporting textid = cx_wd_context=>NODE_EMPTY node_nam
    10
    elseif element_index = if_wd_context_node=>use_lead_selection.
    >>>>>
    raise exception type cx_wd_context exporting textid = cx_wd_context=>NO_LEAD_SELECTION n
    12
    else.
    13
    raise exception type cx_wd_context exporting textid = cx_wd_context=>ELEMENT_NOT_FOUND n
    14
    endif.
    15
    endmethod.
    Contents of system fields
    Name
    Val.
    SY-SUBRC
    0
    SY-INDEX
    1
    SY-TABIX
    0
    SY-DBCNT
    2
    SY-FDPOS
    0
    SY-LSIND
    0
    SY-PAGNO
    0
    SY-LINNO
    1
    SY-COLNO
    1
    SY-PFKEY
    SY-UCOMM
    SY-TITLE
    HTTP Control
    SY-MSGTY
    E
    SY-MSGID
    TD
    SY-MSGNO
    600
    SY-MSGV1
    000003587101
    SY-MSGV2
    0001
    SY-MSGV3
    EN
    SY-MSGV4
    SY-MODNO
    0
    SY-DATUM
    20070207
    SY-UZEIT
    145005
    SY-XPROG
    SAPCNVE
    SY-XFORM
    CONVERSION_EXIT

    Hi Eugene,
    i suggest you raise an SMP ticket for these.
    Looks like a bug at first glance.
    regards
    Phil

  • Regarding lead selection?

    i m getting this error when i clivk on one button.
    how can i resolve this
    Error when processing your request
    Note
    The following error text was processed in the system CGD : The lead selection has not been set. NURSING
    The error occurred on the application server cgslsvr3_CGD_20 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: RAISEELEMENT_NOT_FOUND of program CL_WDR_CONTEXT_NODE===========CP
    Method: PATH_TABLE_GET_ELEMENT2 of program CL_WDR_CONTEXT_NODE===========CP
    Method: GET_BOUND_ELEMENT of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP

    there can be many possibilities for this, without knowing what you have done it is difficult to answer
    There are no Elements in the Context node, change the cardinality of your context node to 1..1 or 1..n
    Abhi

  • How to tackle the error - " The Lead Selection has not been set in view "?

    Hi Guys,
    I'm getting this error " The Lead Selection has not been set in view " . If any one has faced the same problem , then please guide me . I am new to WD ABAP so finding it difficult to track the reason.
    TIA,
    Vishesh

    Hi Pradeep,
    I have already checked  "Initialisation Lead Selection" property . I have faced the same problem in another view also there it got solved by changing the cardinality.  In this case, I had tried both cardinality and Lead selection property  but nothing  is working.
    Thanx.

  • Getting "The Lead selection has not been set in view"Error during runtime

    Hi Guys,
    I'm getting  this error " The Lead Selection has not been set in view " . If any one has  faced the same problem , then please guide me .  I am new to WD ABAP so finding it difficult to track the reason.
    TIA
    Moderator Message: Please search the forum before posting basic messages. Thread locked
    Edited by: Neil Gardiner on Oct 1, 2010 3:48 PM

    Hi Pradeep,
    I have already checked  "Initialisation Lead Selection" property . I have faced the same problem in another view also there it got solved by changing the cardinality.  In this case, I had tried both cardinality and Lead selection property  but nothing  is working.
    Thanx.

Maybe you are looking for

  • External hard drive not being shown

    Hi, For some reason my Maxtor external HD doesnt show as being connected to my computer. It shows on a PC when connecting via UBS, just not a Mac. Can anyone please recommend a solution. Thanks

  • Wifi type thinkpad yoga 12

    I want to ask information : The connector of wifi is it a mini PCIe standard? Can i use this for PCIe x16 adapter?

  • How to find for a specific sales order trip is created or not?

    Hi, I need to find out that a trip is created or not for a specific sales order. Its urgent. Please let me know. If you can provide join for the query. Thanks

  • Time limit on admin account?

    I was wondering if there is any way or any third party app which will allow me to set time limits on the admin account. I want this because if I make an other account or guest account it doesnt keep the icon dock customized and it doesnt show XBMC th

  • Need reference material on pdf forms

    hi all, I need to develop a pdf form in sap...But i have no knowledge about it..Can u suggest some good link or any reference so that i can have a concept of pdf forms and so that i can start developing one...