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.
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>
could you explain me in detail?
Raja T
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:
<%@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
<%@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
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