on 01-01-2011 12:23 PM
Dear Experts,
I am not able to pass data between views.I read many threads in this forum, but still clueless.
Here is my requirement, Create a Custom component with 2 views. View one will have Service Request No and and View two will have some fields related to that service request.(Note I am not using a Search and Result page)
I have created a Custom Component and created 2 views and a view set and created custom controller (HeaderCuCo) , I am using BTAdminH in the model node. Binded the 2 views with the custom controller context node(BTAdminH).
When I Enter the serivce request number and press 'DISPLAY' button, it should give me values of that service request in view 2.
In the event handler EH_ONDISP ,I have written the below mentioned code.(This Event handler is triggered from Viewset)
DATA: lr_cuco type ref to ZL_ZRP_DETA_HEADERCUCO_IMPL,
lr_entity type ref to cl_crm_bol_entity.
lr_cuco ?= me->get_custom_controller( 'ZRP_DETAIL/HeaderCuCo' ) .
CHECK lr_cuco IS BOUND.
lr_entity ?= lr_cuco->typed_context->btadminh->collection_wrapper->get_current( ) .
CHECK lr_entity IS BOUND .
lr_cuco in BOUND, but lr_entity in not bound,
What I am missing? should I write this code in DO_PREPARE_OUTPUT of the view 2 also ??
please advice me ..
Regards,
Roopa.
Hi Roopas,
If the you want to pass the data within views of same component, you dont need custom controller.
Custome controller is used when you want to share one view data with some other view in some other component.
If your case, component controller is fine as you are sharing data within views of same component.
have all context nodes of individual views also at component level and bind view nodes to component nodes.
You then will not have to bother about the data flow. It flows automatically when all same nodes are bound to componet controller nodes
Regards,
Suchita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roopas,
Its the custom controller which helps data to flow int he same component and the component controller which helps data to flow across compoents.
I guess your requirement is to display a srvice req details based on the srv req no that you have entered.
In such a case ,you need to first trigger a search for your onoe order object (which in case of service req is BTQSrvReq).
For the searcg ,pass the entered parameter as the order no.Once the search is triggered,you will get a btorder object as a result.
Now,for this entity call the method,get_related_entities('relation name') and then get the btadminh .Set this atadminh to the custom controller btadminh node and then you will get the enity in the result view as well,since you have bound the result btadminh to the custom contorller.
For refrence ,check and one oredr serach component,for eg BT108S_LEA ,the in the view BT108S_LEA/Search ,check the method
EH_ONSEARCH.Here you will get an idea,how a one order search is triggered.
For any issues you can write back .
Thanks,
Suvidha
Hi ,
So now,use the following
lr_current ?= me->typed_context-><context node name>->collection_wrapper->get_current()
lv_attribute = lr_current->get_property_as_string( iv_attr_name = '<attribute name which contains srv req no in the context node>')
so lv_ttribute will now have the srv req no
Suvidha
Roopas,
My name is suvidha not Nisha.
And i already told you how to get the srv req no .
Im sure you are triggering the vent in the same view which has the context node where the srv req no is being enetred in the UI.
So you just have to get th eno from the current entity by using the method,
lr_current->get_property( iv_attribute_name ).
here lr_current is your current entity of the context node which contains the srv req no entered by the user.
Suvidha
My apologies Suvidha.
I have created View 1, View 2 and Viewset. I am triggering the event in Viewset.
I think again I am coming back to sqaure one
collection_wrapper->get_current is blank .. I am not able to get lr_current-get_property ??
is there any coding I need to do apart from Binding the views to custom controller ..??
I have done this developement based on some blog in sdn, the blog is completed after binding the views to custom controller.
Sorry for the trouble ..
Regards,
Roopa
Hi ,
try with ithis
After entering the service request number hit enter and click on display
Regards,
Gangadhar.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Did you tried with lr_cuco ?= me->get_custom_controller( 'GLOBAL.ZRP_DETAIL/HeaderCuCo' ) instead
of lr_cuco ?= me->get_custom_controller( 'ZRP_DETAIL/HeaderCuCo' ) .
Also what code you have wriiten in create_btadminh in context class of view1 for binding.
Regards,
Gangadhar.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Gangadhar.
Yes Gangadhar, I have tried with GLOBAL.ZRP_DETAIL/HeaderCuCo, but still no luck.
Below is the code written in CREATE_BTADMINH.
DATA:
model TYPE REF TO if_bsp_model,
coll_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper,
entity TYPE REF TO cl_crm_bol_entity, "#EC *
entity_col TYPE REF TO if_bol_entity_col. "#EC *
model = owner->create_model(
class_name = 'ZL_ZRP_DETA_FIRST_CN00'
model_id = 'BTAdminH' ). "#EC NOTEXT
BTAdminH ?= model.
CLEAR model.
Added by wizard
bind Context Node to controller
owner->do_context_node_binding(
iv_controller_type = CL_BSP_WD_CONTROLLER=>CO_TYPE_CUSTOM
iv_name = 'GLOBAL.ZRP_DETAIL/HeaderCuCo' "#EC NOTEXT
iv_target_node_name = 'BTADMINH'
iv_node_2_bind = BTADMINH ).
@Nisha.
No Nisha, I am getting getting it even when I put that code in DO_PREPARE_OUTPUT ..
Any clues will be highly appreciated
Regards,
Roopa.
Hi ,
binding the context nodes
owner->do_context_node_binding(
iv_controller_type = CL_BSP_WD_CONTROLLER=>CO_TYPE_CUSTOM
iv_name = 'ZRP_DETAIL/HeaderCuCo' "#EC NOTEXT
iv_target_node_name = 'BTADMINH'
iv_node_2_bind = BTADMINH ).
and also check the context node name in custom contoller whether it is in caps or small letters and give it accordingly in target_node_name
and in view2
use lr_cuco ?= me->get_custom_controller( 'GLOBAL.ZRP_DETAIL/HeaderCuCo' )
Regards,
Gangadhar.S
Hi ,
To your requirement you need to bind the context node (BTAdminH ) of 1st view with the context node of the custom contoller HeaderCuCo in the create_BTAdminH method of the context class of the 1st view
No need to bind the context node of second view with custom controller.
and you can access this in the second view by clicking on display i.e in EH_ONDISP
DATA: lr_cuco type ref to ZL_ZRP_DETA_HEADERCUCO_IMPL,
lr_entity type ref to cl_crm_bol_entity.
lr_cuco ?= me->get_custom_controller( 'ZRP_DETAIL/HeaderCuCo' ) .
CHECK lr_cuco IS BOUND.
lr_entity ?= lr_cuco->typed_context->btadminh->collection_wrapper->get_current( ) .
CHECK lr_entity IS BOUND .
also try with lr_cuco ?= me->get_custom_controller( 'GLOBAL.ZRP_DETAIL/HeaderCuCo' ).
Regards,
Gangadhar.S
Edited by: gangadhar rao on Jan 3, 2011 8:16 AM
Edited by: gangadhar rao on Jan 3, 2011 8:27 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Experts,
Any Pointers ... I am clueless..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.