cancel
Showing results for 
Search instead for 
Did you mean: 

Read tableview data of a view in Page with flow logic popup.

Former Member
0 Kudos

Hi All,

I have a BSP with MVC pattern.

i have a main page with VIEW with 3 tableviews each tableview has two buttons.

when i click on each button a popup(page with flow logic) window comes up and i do some process by reading tableview data.

now the as the popup window is Page with flow logic, i'm not able to get the tableview data in the popup.

how can i read the tableview data in the popup(as i said, these popups are pages with flow logic, so i need to read the data in onInputprocessing(not in controller).

please suggest.

Cheers

Srini.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check these 2 links.

[Link1|]

[Link2|;

Hope this helps.

Regards,

Abhinav

Former Member
0 Kudos

Hi Abhinav,

Now Iu2019m getting the popup as I did below.

I have a main controller (HOME.DO, class: In the 'CAST' Operation ('?=' or 'MOVE? TO') is a Type mismatch

occurred. The source type '\ ZCL_CT_ROM_EQUIP_MAINTAIN CLASS = "is not

target allocation is compatible with '\ ZCL_BSP_ROM CLASS = ") and I have another sub controller (ORDER.DO, class: ZCL_CT_MAINTAIN CLASS)

In the main view(DETAILS.HTM), I have the below code to call the popup of ORDER.DO.

onClientClick = "javascript:window.open('ordert.do?popup=true','_blank','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=350,left = 350,top = 300')" />

now, I wrote the code within the controller within DO_REQUEST of ORDER.DO as below.

DATA: POPVIEW TYPE REF TO IF_BSP_PAGE.

DISPATCH_INPUT( ).

DATA: LV_FIELD TYPE STRING.

  • Get the value of Page level variables.

*matnrobj ?= create_model( class_name = 'ZCL_M_BSP_CREATE_ORDERS'

  • model_id = 'matnrobj' ).

LV_FIELD = REQUEST->GET_FORM_FIELD( 'popup' ).

IF LV_FIELD IS NOT INITIAL .

me->VIEW_NAME = 'show_order.htm'.

ENDIF.

IF me->VIEW_NAME IS INITIAL.

me->VIEW_NAME = 'details.htm'

ENDIF.

POPVIEW = CREATE_VIEW( VIEW_NAME = me->VIEW_NAME ).

POPVIEW->set_attribute( name = 'matnrobj' VALUE = me->matnrobj ).

CALL_VIEW( POPVIEW ).

When the view is being called Iu2019m getting the ZCL_BSP_CLASS following error:

In the 'CAST' Operation ('?=' or 'MOVE? TO') is a Type mismatch

occurred. The source type '\ ZCL_CT_MAINTAIN CLASS = "is not

target allocation is compatible with '\ ZCL_BSP_CLASS = "

Iu2019m activating the sub controller ORDER.DO in in method DO_INIT in HOME.DO.

Instead of calling the view it is giving this cast error. So what I want to know is.

1. When we are calling a view from controller(sub controller here), what are the precautions we need to take care.

2. Where do I need to create the sub controlleru2026.

3. is the link missing between main and sub controller.

Please give a link or suggest.

Cheers,

Srini.

raja_thangamani
Active Contributor
0 Kudos

Srini,

Look at [this link|].. You can call the view as popup.. that will be more easier to handle the data.

Raja

Former Member
0 Kudos

Hi Raja,

I'm doing that only, calling view in sub controller, i'm getting the cast error. i want to know the procedure to call the view from sub controller. do i need to take any specific steps before i call or is it fine as i have shown above..

Please suggest.

raja_thangamani
Active Contributor
0 Kudos

you can call the pop-up from main controller itself as i menitoned in above link.

Raja

Former Member
0 Kudos

Hi Raja,

Ya, that is true, but i have 6 popups and if i call all of them the main controller would become clumsy. so i want to modularize.

Thanks,

Srini.

raja_thangamani
Active Contributor
0 Kudos

Look at below links. It will help you..

[Calling Subcontroller1|http://help.sap.com/saphelp_erp2004/helpdata/en/9d/1ca7f91b76ad4493d62b8ecc7c83db/frameset.htm]

[Calling Subcontroller2|http://help.sap.com/saphelp_erp2004/helpdata/en/ce/43473ccf20514ee10000000a114084/frameset.htm]

Raja

Former Member
0 Kudos

Hi Raja,

In this way we can call the views, but we may not get the popups. as per the links....

we need to create sub controller(SC) either in main controller or in view. suppose if i create the SC in Main controller(MC), then i need to call the SC in the main view using< BSP: Call>, this calls the SC method and it will call the SC view(this has to be popup), but this view may not come as popup. as we can't call this view from SC's DO_REQUEST method using WINDOW.OPEN. so i can't get the popup.

my scenario is, from my view i want to get a popup. and i want to handle all the processing of the popup within the SC.

I hope my issue is clear to you...

Thanks,

Srini.

raja_thangamani
Active Contributor
0 Kudos

Srini,

Can you give us detail of which class is for what, its confusing me...

Make sure the you have given the same superclass for all the controller/model class to avoid the mismatch.

Raja

Former Member
0 Kudos

Hi Raja,

Main controller class name is: ZCL_BSP_HOME., this class is the main controller class and has the main view(HOME.HTM), this view has 3 trays and each tray has 2 buttons.

Sub controller class name : ZCL_CT_MAINTAIN, controller name: this is the sub controller, which has one view, which needs to come as popup(DETAILS.HTM) from main view.

So when I click on a button in the main view HOME.HTM, I want a popup DETAILS.HTM to come up.

So when Iu2019m calling the popup from main view HOME.HTM, using the window.open(u2018maintain.do?details = trueu2019, u2026u2026) ,here in the call Iu2019m using the sub controller not main controller.

It is giving the cast error, if I use the main controller I comes fine.

So in summary, I want to get popup of sub controller from main view.

Hope Iu2019m clear this time.

Cheers,

Srini.

raja_thangamani
Active Contributor
0 Kudos

Ok Thanks for the detail. This is what I simulated in my system..

Make sure you have given the superclass for BOTH the controller.

Main controller class name is: ZCL_BSP_HOME and Its super class is CL_BSP_APPLICATION.

Sub controller class name : ZCL_CT_MAINTAIN and Its super class is CL_BSP_APPLICATION

So when I click on a button in the HOME.HTM, I get the popup DETAILS.HTM without any issues.

After adding the super class, if you still face an issue please post the entire code of main & sub-controller.

Raja

Former Member
0 Kudos

Hi Raja,

Super class is CL_BSP_CONTROLLER2, right.

for both controllers i have set this, do you want me to change this to CL_BSP_APPLICATION.

Please confirm.

raja_thangamani
Active Contributor
0 Kudos

I'm sorry. I meant CL_BSP_CONTROLLER2. Could you please post you entire code here?

Raja

Former Member
0 Kudos

Hi Raja,

Here is the code.

-


Flow:

1. From the main page(DETAILS.HTM), which has 3 trays.

First tray has 1 button

Second tray has 2 buttons

Third tray has 2.

as usual each of these tray has one tableview

I want to call the pop up when I click on the button PICKUP of second tray first button..

2. Within this main page, there is a statement for popup as below javascript:window.open('home.do?pickup=true', u2026.

Which calls the popup window from the class ZCL_BSP_HOME.(THIS WORKS FINE)

Please note: To call this same popup from the sub controller, Iu2019m just changing the HOME.DO to MAINTAIN.DO as below.

javascript:window.open('maintain.do?pickup=true', (THIS IS NOT WORKING. )

3. Main controller: HOME.DO, class: ZCL_BSP_HOME, has 4 methods implemented, and in DO_REQUEST, I wrote the code for the popup, this is working fine.

Please note, in INIT method of this class Iu2019m creating the sub controller MAINTAIN.DO. and setting the status to 1.

4. Sub controller ZCL_CT_MAINTAIN, has DO_REQUEST method implemented for the popup, but this is not working.

-


CLASS-ZCL_BSP_HOME

INIT

method DO_INIT.

data design type string.

find ?= create_model(

class_name = 'ZCL_BSP_CUSTOMER'

model_id = 'find' ).

orderobj ?= create_model( class_name = 'ZCL_M_BSP_ORDERS'

model_id = 'orderobj' ).

endmethod.

DO_REQUEST

method DO_REQUEST.

data : view type ref to if_bsp_page,

lv_form_field type string.

  • Dispatch the input so that the event handler can process

  • events like when the agent clicks on the Search button

me->dispatch_input( ).

  • Dispatch the input so that t* The attribute me->view_name can be set by the event handler

  • to change navigation t

DATA: lt_fields TYPE tihttpnvp ,

ls_fields LIKE LINE OF lt_fields.

CALL METHOD request->get_form_fields

CHANGING

FIELDS = lt_fields.

DATA: LV_FIELD TYPE STRING.

LV_FIELD = REQUEST->GET_FORM_FIELD( 'pickup' ).

IF LV_FIELD IS NOT INITIAL .

me->VIEW_NAME = 'pickup.htm'. " Change the name as per your need

ENDIF.

IF me->VIEW_NAME IS INITIAL.

me->VIEW_NAME = 'find.htm'." Change the name as per your need

ENDIF.

  • if me->view_name is initial.

  • me->view_name = 'find.htm'.

*

*

  • endif.

  • Create the response view

view = me->create_view( view_name = me->view_name ).

if view is bound.

  • Add a reference to the model instance to the view,

  • so that the view can access the model

view->set_attribute( name = 'find' value = me->find ).

view->set_attribute( name = 'orderobj' value = me->orderobj ).

me->call_view( view ).

endif.

endmethod.

METHOD do_handle_event.

DATA: username TYPE bapialias-useralias,

lt_fields TYPE tihttpnvp ,

ls_fields LIKE LINE OF lt_fields,

lv_menge(10) TYPE c,

lv_index(2) TYPE c,

lv_date(10),

lv_t_st_idx TYPE i, " for tableview index

lv_t_ed_idx TYPE i,

lv_f_idx TYPE i,

lv_wday type DTRESR-WEEKDAY,

lv_month type i,

lv_year type i,

lt_months type table of T247,

ls_months type T247.

  • lv_f_dt_idx TYPE i.

DATA: tv TYPE REF TO cl_htmlb_tableview,

tv_event TYPE REF TO cl_htmlb_event_tableview ,

event1 TYPE REF TO if_htmlb_data.

FIELD-SYMBOLS: <ls_matnr> TYPE zrom_matnr.

  • Check that the event has been triggered by the search button

IF htmlb_event IS BOUND AND htmlb_event->server_event = 'onSearch'.

*Execute the search implemented in the query model

me->find->find( ).

*-- Assign customer number to the order object. to be accessed in

*-- order model.

me->orderobj->kunnr = me->find->kunnr.

me->orderobj->get_orders( ).

.

IF NOT me->find->kna1 IS INITIAL.

me->view_name = 'cust_details.htm'.

  • me->view_name = 'find.htm'.

ENDIF.

ELSEIF htmlb_event IS BOUND AND htmlb_event->server_event = 'logoff'.

CLEAR: me->find->kna1, me->find->kunnr.

REFRESH: me->orderobj->orders,me->equipobj->equip,me->billobj->billing.

  • me->view_name = 'find.htm'.

*-- Call the create order page

ELSEIF htmlb_event IS BOUND AND htmlb_event->server_event = 'create'.

me->view_name = 'create_order.htm'.

ENDIF.

Endif.

Endmethod.

-


method DO_HANDLE_DATA.

  • this is the default behaviour, if all data

  • are handled by a model

  • fill_model_data( FIELDS = form_fields

  • messages = global_messages ).

CALL METHOD SUPER->DO_HANDLE_DATA

EXPORTING

FORM_FIELDS = form_fields

GLOBAL_MESSAGES = global_messages

.

endmethod.

CLASS-ZCL_CT_MAINTAIN

This is the sub controller code to call the popup from the DETAILS.HTM PAGE.

But as this is not working, SO I wrote this code in the class ZCL_BSP_HOME, method: DO_REQUEST.

method DO_REQUEST.

*CALL METHOD SUPER->DO_REQUEST

  • .

DATA: POPVIEW TYPE REF TO IF_BSP_PAGE.

DISPATCH_INPUT( ).

DATA: LV_FIELD TYPE STRING.

  • Get the value of Page level variables.

*matnrobj ?= create_model( class_name = 'ZCL_M_BSP_CREATE_ORDERS'

  • model_id = 'matnrobj' ).

LV_FIELD = REQUEST->GET_FORM_FIELD( 'pickup' ).

IF LV_FIELD IS NOT INITIAL .

me->VIEW_NAME = 'show_order.htm'. " Change the name as per your need

ENDIF.

IF me->VIEW_NAME IS INITIAL.

me->VIEW_NAME = 'norml.htm'." Change the name as per your need

  • ENDIF.

POPVIEW = CREATE_VIEW( VIEW_NAME = me- >VIEW_NAME ). CALL_VIEW( POPVIEW ).

endmethod.

-


DETAILS.HTM

<htmlb:form>

<htmlb:button id = "PICKUP"

text = "Pick Up"

tooltip = "Click to reqest a pick up(Select a row)"

onClientClick = "javascript:window.open('home.do?pickup=true', '_blank','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=350,left = 350,top = 300');" />

<htmlb:tray id = "tray3"

title = "Maintain Details"

design = "form"

width = "100%"

isCollapsed = "false"

tooltip = "Maintain details" />

<htmlb:tableView id = "myEquip"

headerVisible = "TRUE"

visibleRowCount = "4"

design = "ALTERNATING"

onNavigate = "onMyNavigate"

selectionMode = "LINEEDIT"

keepSelectedRow = "TRUE"

onRowSelection = "onMyRowSelection"

table = "<%= maintain->maint %>"

width = "10" >

<htmlb:tableViewColumns>

<htmlb:tableViewColumn columnName="MATNR" />

<htmlb:tableViewColumn columnName="MAKTX" />

<htmlb:tableViewColumn columnName="SERNR" />

</htmlb:tableViewColumns>

</htmlb:tableView>

</htmlb:tray>

</htmlb:form>

-


thnaks,

Srini.

Edited by: sapbsp on Apr 27, 2009 3:47 AM

Edited by: sapbsp on Apr 28, 2009 3:20 PM

Edited by: sapbsp on Apr 28, 2009 3:29 PM

Former Member
0 Kudos

Hi Raja,

This issue is now fixed. For the popup view i need to give the sub controller class name instead of the main controller name.

Thanks a lot for your help.

Cheers,

Srini.

raja_thangamani
Active Contributor
0 Kudos

Glad to hear that.. I couldn't spend much time to help you as was quit busy...

Raja

Answers (1)

Answers (1)

former_member184111
Active Contributor
0 Kudos

Hi,

You can use Server side cookies.

Regards,

Anubhav