on 07-22-2013 8:12 AM
I created a new component using component workbench. Created a model node of bol entity BuilAddress and added 3 fields to the view through configuration. Added a button using the html page. In the event handler of the button Iam trying to access the value entered in those fields using the code.
lr_entity ?= me->typed_context->mapaddress->collection_wrapper->get_current( ).
but lr_entity is always initial. I also checked the collection wrapper,it's also initial. Please let me know if Iam missing any step.
Thanks in advance.
Hi All,
I just wanted the fields for Address like Street,city,state...So I created a new value node and the existing code itself worked. But Can anyone please tell me why it did not work for a model node.
Thanks,
Arvind Raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The Model Node uses the BOL to get the data. So for this you first need to load the BOL and only then you can get the entities .
In the Web UI when we login the BOL gets loaded and we will get the data through BOL.
On the other side in case of Value Node we get the data from database tables directly.
Thanks
Kumar
Hi Arvind
If you are in custom component
Use model as ONEORDER
---> use the Dynamic Query Object BuilHeaderAdvancedSearch
from this you will get the ressut object as Root Object BuilHeader ( collection of entities ie., result )
in the DO_INIT_CONTEXT of the view impl class you can write the code to get the data ( ie., get the query instance and pass the query parameters then search for result . From result we can get child entities and add the required one to our node in the component )
--->From the builheader entity you get the Dependent Object BuilAddress entity
( builaddress is the child entity of builheader )
Regards
Dinesh Gurram
You can use below code :
data: lr_core type ref to cl_crm_bol_core,
lr_query type ref to CL_CRM_BOL_QUERY_SERVICE,
LR_RESULT TYPE REF TO IF_BOL_ENTITY_COL,
LR_ENTITY TYPE REF TO cl_crm_bol_entity,
************************************************
lr_children type ref to IF_BOL_ENTITY_COL,
lr_child type ref to cl_crm_bol_entity,
lr_parent type ref to cl_crm_bol_entity,
lr_core = cl_Crm_bol_core=>get_instance( ).
*Load the component set
LR_CORE->LOAD_COMPONENT_SET( 'BP_APPL' ).
*----------------------------------------------------------------
*Create the query instance by passing the search object name
lr_query = CL_CRM_BOL_QUERY_SERVICE=>get_instance(
iv_query_name = 'BuilHeaderSearch' ).
From this you can get related entities i.e. BuilAddress and find the relevant data from them.
Thanks
Kumar Gaurav.
From the above code you will get the query in lr_query.
Use below code to set search parameters and find the result and then from result getting the entities and then find relation 'BuilAddress'.
WA_PARMS-NAME = 'BP_NUMBER'.
WA_PARMS-VALUE = '81'.
Append WA_PARMS to IT_PARMS.
*Add the selection parameters
CALL METHOD LR_QUERY->SET_QUERY_PARAMETERS
EXPORTING
IT_PARAMETERS = IT_PARMS.
*Get the result list
LR_RESULT = LR_QUERY->GET_QUERY_RESULT( ).
*----------------------------------------------------------------
*Get the first object(entity) in the result list
LR_ENTITY = LR_RESULT->GET_FIRST( ).
*If the entity is bound
WHILE LR_ENTITY IS BOUND.
*Get the related entities by mentioning the relation ship name
lr_children = lr_entity->get_related_entity(
iv_relation_name = 'BuilAddress' ).
Now from lr_children you can get the address fields for the particular Partner.
i_tab-STRING2 = LR_children->GET_PROPERTY_AS_STRING( 'STREET' ).
Hope it helps
Thanks
Kumar
Hi,
If you are Testing your custom component independently with bsp_wd_cmpwb,As i think you will not able to get data with
lr_entity ?= me->typed_context->mapaddress->collection_wrapper->get_current( ).
Try to put your custom component in standard component like BP_Head and then try with login in CRM_UI.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arvind,
Concept:
Actually BuilAddress is a dependent object on BuilHeader. you can not have a direct entity created for BuilAddress. you must have a BuilHeader and then use create related entity for BuilAddress.
Solution to your problem
Don't hesitate to ask further question if needed.
Regards,
JotSaroop Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arvind,
NOTE: do the below activities for the view in which you have builheader only.
Delete all that stuff what you did to remove "not bound message". Write the following piece of code in your "do_init_context" method of view implementation.
DATA: lr_builheader_factory TYPE REF TO cl_crm_bol_entity_factory,
lv_bol_core TYPE REF TO cl_crm_bol_core,
lt_params TYPE crmt_name_value_pair_tab,
ls_params TYPE crmt_name_value_pair,
lr_ent TYPE REF TO cl_crm_bol_entity,
lr_col_wrap TYPE REF TO cl_bsp_wd_collection_wrapper.
ls_params-name = 'BP_CATEGORY'.
ls_params-value = '1'.
APPEND ls_params TO lt_params.
ls_params-name = 'BP_GROUP'.
ls_params-value = '0001'.
APPEND ls_params TO lt_params.
lv_bol_core = cl_crm_bol_core=>get_instance( ).
lr_builheader_factory = lv_bol_core->get_entity_factory( iv_entity_name = 'BuilHeader' ).
lr_ent ?= lr_builheader_factory->create( iv_params = lt_params ).
lr_col_wrap ?= me->typed_context->contextnodename->get_collection_wrapper( ).
lr_col_wrap->add(
EXPORTING
iv_entity = lr_ent ).
Instead of
lr_entity ?= me->typed_context->mapaddress->collection_wrapper->get_current( ).
do try this
lr_entity ?= me->ztyped_context->mapaddress->collection_wrapper->get_current( ).
~Kavindra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think there is no data present.Bind the context nodes using component controller or custom controller.add your custom component to another standard component and redefine the method WD_USAGE_INITIALIZE in the component controller of standard component and bind the context nodes of custom component and standard component.
Regards.
V CH Bharadwaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arvind,
First check you set method of the fields . I think your entity is initial there as well.
Put a breakpoint in set method of the fields and then try to debug.
If the entity is initial in set method as well then you can not get the entity with value in the event.
Hope it helps
Thanks
Kumar Gaurav.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
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.