Skip to Content
author's profile photo Former Member
Former Member

Autopopulating correlated fields .

Hi All,

I have a requirement as follows :

I have a tableview in which Account name& Division are two columns .The column account has to be filled dynamically. i.e.There should be an input field with an expand icon. When I click on this expand icon ,it should take me to a new window which has another tableview containig account details such as Account name, Division etc..For every Account there is a corresponding Division and when i select a particular Account in the new window the Account name and Division should be populated into the initial tableview columns.

Can anyone help me out with this?

Thanks & Regards.

Chandana.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Posted on Dec 28, 2006 at 11:22 AM

    Hi You can do it by using F4 help kind of stuff.

    When you click on the Expand icon, call another view using Java script and populate a table in it. and when you click on the table get that value into the table view.

    Follow the below link you would see some help on how to create the F4 help and all.

    /people/ravikiran.chittum/blog/2006/08/10/working-with-modal-dialog-in-a-bsp-application

    /people/rakeshvarman.gopalakrishnan/blog/2006/08/09/capturing-f4-keypressed-event-in-html-and-htmlb-input-fields-using-javascript-validations

    /people/thomas.jung3/blog/2004/11/01/bsp-value-input-help-popups-version-20-part-1

    Thanks,

    Sreekanth

    <i>*-- reward if it helps you</i>

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 29, 2006 at 04:37 AM

    could you explain me in detail?

    Raja T

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 29, 2006 at 06:37 PM

    Here is the similar example. I used MVC concept:

    <b>Note:</b> But instead of Model class i used APplication class. You can change ito MODEL Class where ever applicaable.

    Let me know if you have any issue:

    Main.htm:

    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2002+design2003" >
      <htmlb:page title="Add Employee Details " >
        <htmlb:form action="POST" >
          Account Number:
          <htmlb:inputField id          = "Account"
                            showHelp    = "true"
                            value       = "<%= Account %>"
                            onValueHelp = "javascript:window.open('acctpop.do?showppopup=true', '_blank', 'Account Details','width=100,height=300');" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>

    <b>Page attribute:</b>

    account TYPE string

    Acctpop.htm

    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page title="Test" >
        <htmlb:form id="my_window" >
          <%
      data TV_ITERATOR Type Ref To zcl_itr." - Iterator Function
      data iterator type ref to IF_HTMLB_TABLEVIEW_ITERATOR.
      create object tv_iterator exporting appl_cons = application.
      iterator = tv_iterator.
          %>
          <htmlb:tableView id               = "pop"
                           width            = "200"
                           headerVisible    = "true"
                           design           = "alternating"
                           visibleRowCount  = "10"
                           fillUpEmptyRows  = "true"
                           selectionMode    = "SINGLESELECT"
                           selectedRowIndex = "<%= row_index %>"
                           onRowSelection   = "MyEventRowSelection"
                           showNoMatchText  = "true"
                           filter           = "server"
                           sort             = "server"
                           onHeaderClick    = "MyEventHeaderClick"
                           table            = "<%= it_account %>"
                           iterator         = "<%= iterator %>" >
          </htmlb:tableView>
          <%
      if account is not initial.
          %>
          <htmlb:inputField id      = "checked"
                            visible = "FALSE"
                            value   = "<%= lv_checked %>" />
                <script for="checked" language="javascript" even="onLoad()">
                {
                       opener.document.htmlb_form_1.account.value = <%= account %>;
                       window.self.close();
                }
          </script>
          <%
      endif.
          %>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>

    <b>Controller Class:</b>

    METHOD DO_INIT.
      CREATE OBJECT APPL.
      SELECT * FROM SFLIGHT INTO TABLE APPL->ITAB.
    
    ENDMETHOD
    
    
    METHOD DO_REQUEST.
      DATA: POPVIEW TYPE REF TO IF_BSP_PAGE.
      DISPATCH_INPUT( ).
    
      DATA: LV_FIELD TYPE STRING.
    * Get the value of Page level variables.
    
      LV_FIELD = REQUEST->GET_FORM_FIELD( 'showppopup' ).
    
      IF LV_FIELD IS NOT INITIAL .
        APPL->VIEW_NAME = 'acctpop.htm'.
      ENDIF.
      IF APPL->VIEW_NAME IS INITIAL.
        APPL->VIEW_NAME = 'main.htm'.
    
      ENDIF.
    
      POPVIEW = CREATE_VIEW( VIEW_NAME = APPL->VIEW_NAME ).
      IF APPL->VIEW_NAME = 'acctpop.htm'.
    
        POPVIEW->SET_ATTRIBUTE( NAME = 'it_account' VALUE = APPL->ITAB ).
        POPVIEW->SET_ATTRIBUTE( NAME = ' accout' VALUE = APPL->account ).
      ENDIF.
      CALL_VIEW( POPVIEW ).
    
    ENDMETHOD.
    
    METHOD DO_HANDLE_DATA.
    data: FIELD TYPE IHTTPNVP.
    
      READ TABLE FORM_FIELDS WITH TABLE KEY
      NAME = ' Account ' INTO FIELD.
      ME-> Account = FIELD-VALUE.
    
    ENDMETHOD.
    
    
    METHOD DO_HANDLE_EVENT.
      DATA: IND TYPE I.
      DATA: TV TYPE REF TO CL_HTMLB_TABLEVIEW.
      DATA: EVENT1 TYPE REF TO CL_HTMLB_EVENT.
      EVENT1 = CL_HTMLB_MANAGER=>GET_EVENT( RUNTIME->SERVER->REQUEST ).
      TV ?= CL_HTMLB_MANAGER=>GET_DATA(
      REQUEST = RUNTIME->SERVER->REQUEST
      NAME = 'tableView'
      ID = 'pop' ).
      IF TV IS NOT INITIAL.
        DATA: TV_DATA TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
        TV_DATA = TV->DATA.
    
        IF TV_DATA->SELECTEDROWINDEX IS NOT INITIAL.
          DATA: ROW LIKE LINE OF APPL->ITAB.
          READ TABLE APPL->ITAB INDEX TV_DATA->SELECTEDROWINDEX INTO ROW.
          DATA VALUE TYPE STRING.
    
          APPL-> Account = ROW- Account.
        ENDIF.
      ENDIF.
    
    ENDMETHOD.

    Hope this will help you.

    Let me know if you have any queries.

    Raja T

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 05:44 AM

    Hi Raja,

    I have implemented the code given by you,but that doesnt meet my requirement.Its functionality is similar to input help while my issue is different.Let me explain it in detail...

    Suppose there is a table which has the columns Category, Account, Division, Customer name etc.Initially this table is displayed as a tableview (tv1) and in the Account column when i have to enter data ,There is an "Expand Icon".When I click on this icon, It shud display a view which contains another tableview(tv2) with columns Account,Division,Accountdata etc .I select a row in this view.And the Account and related Division of tv2 are autopopulated into the Account and Division columns of tv1 .( For each account there is one corresponding Division).

    Can you plz help me out on this?

    Thanks and Regards .

    Vishnu Chandana

    Add a comment
    10|10000 characters needed characters exceeded

    • Write the below code in Iterator of tableview TV1:

      Lets assume TV1 has field Account, Division & button('3rd column'):

      <b>Layout of TV1</b>

            <htmlb:tableView id               = "tv1"
                             width            = "200"
                             headerVisible    = "true"
                             design           = "alternating"
                             visibleRowCount  = "10"
                             fillUpEmptyRows  = "true"
                             selectionMode    = "SINGLESELECT"
                             selectedRowIndex = "<%= row_index %>"
                             onRowSelection   = "MyEventRowSelection"
                             showNoMatchText  = "true"
                             filter           = "server"
                             sort             = "server"
                             onHeaderClick    = "MyEventHeaderClick"
                             table            = "<%= it_initial %>"
                             iterator         = "<%= iterator1 %>" >
            </htmlb:tableView>

      <b>Write the below code in Iterator1:</b>

      In method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START:
      
              WHEN 'Expand'.
                CONCATENATE 'expand' row_ref->account INTO l_event SEPARATED BY '-'.
                p_replacement_bee = cl_htmlb_button=>factory( id      = l_cell_id
                                                                         text    = 'select'
                                                                         onclick = l_event
                                                                         tooltip = l_tooltip ).
            ENDCASE.

      • Here button event l_event will have value "event-exapnd-youraccount_numnber"

      IN DO_HANDLE_EVENT
      
              IF event_id->server_event+0(6) = 'expand'.
                SPLIT event_id->server_event AT '-' INTO l_dummy l_account.
      
                model->account =  l_accout
      
      *    call the another view which has the table_view TV2
      
           endif.

      <b>* View for tv2</b>

      Accthelp.htm

      * The moment user selects the Particular row, event will trigger & populate the "Division" in TV1 of previous View
      
            <htmlb:tableView id               = "tv2"
                             width            = "200"
                             headerVisible    = "true"
                             design           = "alternating"
                             visibleRowCount  = "10"
                             fillUpEmptyRows  = "true"
                             selectionMode    = "SINGLESELECT"
                             selectedRowIndex = "<%= row_index %>"
                             onRowSelection   = "MyEventRowSelection"
                             showNoMatchText  = "true"
                             filter           = "server"
                             sort             = "server"
                             onHeaderClick    = "MyEventHeaderClick"
                             table            = "<%= model->it_account %>"
                             iterator         = "<%= iterator2 %>" >
            </htmlb:tableView>

      <b>Controller Class:</b>

      METHOD DO_HANDLE_EVENT.
      
      * To capture the row select event
      
        DATA: IND TYPE I.
        DATA: TV TYPE REF TO CL_HTMLB_TABLEVIEW.
        DATA: EVENT1 TYPE REF TO CL_HTMLB_EVENT.
        EVENT1 = CL_HTMLB_MANAGER=>GET_EVENT( RUNTIME->SERVER->REQUEST ).
        TV ?= CL_HTMLB_MANAGER=>GET_DATA(
        REQUEST = RUNTIME->SERVER->REQUEST
        NAME = 'tableView'
        ID = 'tv2' ).
        IF TV IS NOT INITIAL.
          DATA: TV_DATA TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
          TV_DATA = TV->DATA.
       
          IF TV_DATA->SELECTEDROWINDEX IS NOT INITIAL.
            DATA: ROW LIKE LINE OF model->it_account.
            READ TABLE model->it_account INDEX TV_DATA->SELECTEDROWINDEX INTO ROW.
            DATA VALUE TYPE STRING.
       * Here ROW will have the selected row records
            model->division = ROW-division.
          ENDIF.
        ENDIF.
       
      ENDMETHOD.

      Hope this will help you

      Raja T

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.