Skip to Content
0
Former Member
Jun 04, 2009 at 02:20 PM

A new controller for each page open

36 Views

Hi All,

AT present when i open an invoice from worklist, it creates a model, but when i open another invoice, it deletes the prevoious models and creates a new one, now that is preventing us from having multiple invoices open at same time.

I am attaching the do_init code for my controller, please let me know if you can see something that i cant:

super->do_init( ).

  • Restore model from model list

model ?= me->get_model( gv_model_id ).

if model is not bound.

  • Create model

model ?= create_model( class_name = 'ZCL_MOD_WF_INVOICE'

model_id = gv_model_id ).

endif.

  • Set model to current controller and run mandatory initialisation method

model->if_bsp_model~init( id = gv_model_id

owner = me ).

me->set_model( model_id = gv_model_id

model_instance = model ).

if class_component_id is initial.

class_component_id = component_id.

endif.

clear component_id.

Method super->do_init () is defined in the inherited class for controller:

data: lv_ostream type string,

lv_cburl type string,

lv_wi_id type sww_wiid,

lv_status type sww_wistat.

  • Restore models

me->read_models( ).

Method me->read_models()

data: lv_ostream type string,

ls_model type lbsp_model_item,

lt_models type lbsp_model_list.

  • Read cookie

call method cl_bsp_server_side_cookie=>get_server_cookie

exporting

name = controller_name

application_name = application_name

application_namespace = application_namespace

username = sy-uname

session_id = runtime->session_id

data_name = controller_name

  • IMPORTING

  • EXPIRY_DATE =

  • EXPIRY_TIME =

changing

data_value = lv_ostream

.

check lv_ostream is not initial.

  • deserialize

  • try.

  • call transformation id

  • source xml lv_ostream

  • result models = m_models

  • cookie_reads = m_cookie_reads.

*

  • catch cx_xslt_exception.

  • ignore errors for now

  • endtry.

  • m_cookie_size = strlen( lv_ostream ).

    m_cookie_reads = m_cookie_reads + 1.

    endmethod.

    Please advise