cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the data from one view to another view within same component

Former Member
0 Kudos

Hi

i have a requirement to solve

i have a component BT108H_SLA

In this component i have 2 views

1)BT108_LEA/DETAILS----->CONTEXT NODE(BTSUBJECT--->ATTRIBUTE--->CONC-KEY)

2)BT108_LEAD/LEADOVVIEWSET----EVENT HANDLER---->EH_ONSAVE

i have to retrive the conc-key values in eh_onsave button.

as per my requirement i need to find out Reason Field from where its getting populated in which table i can see?

i already check in CRMD_ORDERADM_H,CRM_ORDER_H,CRMD_ORDERADM_I

i didnt find any where for Reason field

when i create a lead my reason filed is not mandatory but after create the lead when i open with edit mode and when i press redetermine parties button under more menu then my Reason filed will be mandatory ,if we didnt get reason filed and try to save i need to stop my transaction and shows Reason filed is blank

another one is if when i create a lead i given reason filed with some value and after that i went with edit mode then  whatever value i enter when i create the lead in reason field that value have to been blank and give the option to user to select another reason. and make it as manadatory

please let me know the process how to get?

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member211707
Active Participant
0 Kudos

Hello Anitosh,

As per your requirement,field with drop down ,should be empty when you are making that view as editable..and this field also should be mandatory..you are making this field mandatory by configuration...

so, go to eh_onedit event handler and,

find the current entity e.g lr_entity of context node which contains this field..and write below code

lr_entity->set_property_as_string( iv_attr_name = 'conc_key' iv_value = ' ' ).

This will make field with empty value...

are u using set_view_editable(me) code to make that view editable by checking locking of current entity or any thing else..just mention it....

If you are talking about data flow from one view to other..so you can use

a) custom controller for this purpose: Create custom controller and define one attribute in attribute header e.g. flag1 ..and define this custom controller in first view and get this custom controller..and set attribute value here...

Code like this:--

data: lr_cuco type ref to cuco_implementation_clas_name.

lr_cuco ?= get_custom_controller( ' GLOBAL.customcontroller name').

if lr_cuco is not bound.

lr_cuco->flag = 'X'.

endif.

then,

Write same code till not bound..then get attribute value in your local variable..

lv_flag = lr_cuco->flag.

b) you can use get_parameter and set_parameter also for this...

Thanks ,

Amit

    

Former Member
0 Kudos

Hi Anithosh,

The attribute you are refering is in context node BTSUBJECT(BOL entity BTSubject).

It is aggregated by parent object BTSubjectSet which in turn is aggregated by parent object BTBOSSet which is finally aggregated by parent object BTAdminH.

Now both the views have context node BTADMINH(BOL entity BTAdminH) which is bound to custom controller LeadDetailsCuCo.

So create a method(say ZGET_CONC_KEY) in the implementation class of the view LeadOVViewset to read the details of the attribute CONC_KEY. Add an exporting parameter EV_CONC_KEY of type CHAR20.

Add the following code in the method

   METHOD zget_conc_key.
  DATA: lr_btadminh     TYPE REF TO cl_crm_bol_entity,
        lr_bosset       TYPE REF TO cl_crm_bol_entity,
        lr_subjectset   TYPE REF TO cl_crm_bol_entity,
        lr_subject_col  TYPE REF TO if_bol_entity_col,
        lr_subject      TYPE REF TO cl_crm_bol_entity.


  lr_btadminh ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
  IF lr_btadminh IS BOUND.
    TRY.
        CALL METHOD lr_btadminh->get_related_entity
          EXPORTING
            iv_relation_name = 'BTHeaderBOSSet'
*      iv_mode          = NORMAL
          RECEIVING
            rv_result        = lr_bosset
            .
      CATCH cx_crm_genil_model_error .
    ENDTRY.
    IF lr_bosset IS BOUND.
      TRY.
          CALL METHOD lr_bosset->get_related_entity
            EXPORTING
              iv_relation_name = 'BTSubjectSet_L'
*      iv_mode          = NORMAL
            RECEIVING
              rv_result        = lr_subjectset
              .
        CATCH cx_crm_genil_model_error .
      ENDTRY.
      IF lr_subjectset IS BOUND.
        TRY.
            CALL METHOD lr_subjectset->get_related_entities
              EXPORTING
                iv_relation_name = 'BTSubjectAll'
*    iv_mode          = NORMAL
*    iv_owned_only    = ABAP_FALSE
              RECEIVING
                rv_result        = lr_subject_col
                .
          CATCH cx_crm_genil_model_error .
        ENDTRY.
        IF lr_subject_col IS BOUND.
          CALL METHOD lr_subject_col->get_first
            RECEIVING
              rv_result = lr_subject.
          IF lr_subject IS BOUND.
            CALL METHOD lr_subject->if_bol_bo_property_access~get_property_as_string
              EXPORTING
                iv_attr_name = 'CONC_KEY'
              RECEIVING
                rv_result    = ev_conc_key.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
ENDMETHOD.

Now in the method ON_SAVE call this custom method to get the attribute value.

Hope it helps.

Regards,

Sayan

Former Member
0 Kudos

Hi thanks for ur help a lot

but i am faceing this problem related to another one.

in webui i have a field called Reason(drop down).when we create a lead that field was not mandatory to give input,after createing the lead when i go with edit mode i have to select reason filed must and should.if we wont select and try to save the transaction as per my requirememnt my transaction wont be save and show the message Reason Field was mandatory

in case when i am createing lead then i givend Reason(drop down) and i save my transaction

after that when i go with edit mode then my Reason showing to me old value which is already i selected when createing the lead,as per my requirement i dont want to show that old value which is selected when created lead i want to clear those values when i am go with edit mode then i have to give option to select any other reason like i have to show empty option then user will select any one of another reason and he willl save that trasacation then my transaction have to save.

please give me any ideas for this requirememnt

component :- bt108h-sla

view:details

context node:btsubject

attribute: conc-key

Former Member
0 Kudos

hi ,

try to get the lead value in event handler method on save .

if it is empty and reason field is empty , then try to rise error message ....

rgds,

Lokesh.

Former Member
0 Kudos

i did already code part in that event handler but its not working

when i try to go with edit mode my previous value which is i given for Reason filed is not clear.

i need to clear that value when i go with edit mode

Former Member
0 Kudos

Hi thanks  a LOT  for ur  reply

i am very new to sap crm webui

i want to write the code part eh_onpartnerdetermination

i want to retrive the context node BTSUBJECT.

but in the view bt108h_lea.leadovviewset i didnt find the context node BTSUBJECT

i seem this context node located into another view that view name bt108h_lead.details

now i want to retrive this BTSUBJECT NODE details into my eventhandler ONPARTNERDETERMINATION OF 2ND view.

then how and where i have to write the code part plz send me waiting for u r reply

Former Member
0 Kudos

Hi Anithosh,

Please refer to my earlier post.

Create a Z method and add the code written above.

Call the z method from the event handler. It will work.

Regards,

Sayan

Former Member
0 Kudos

Hi Anithosh,

We can bind the context nodes of the both the views with the custom controller. Then set attributes by setting the collection in first view; then attribute value will be automatically available in second view.

Regards,

Amrit

Former Member
0 Kudos

Hi can u tell me the process

how to set the collection in first view?

i think we have to go with context node BTSUBJECT and create binding

it will ask for  bsp application name and controller type and controller and tgt context node

i will do this.

but after doing this how to set in collection can u please send me code part where i have to write for collection and how to use this attribute in another view eventhandler in same component

Former Member
0 Kudos

Hi ,

already there is a lot of disccussions are the on this topic..,

As per ur req : CONC-KEY needs to get in eh_onsave() method of second component..,

just call the impl class of 1st component in eh_onsave() method of second component ...

thats it ..,

try this it will work..

Thanks and Regards,

Lokesh.

Former Member
0 Kudos

HI thanks for u r reply

i am using same component

within same component i have 2 views in details view i have context node btsubject with attribute conc-key

in second view in eh_onsave() event handler i need to pass that conc-key value

for thispurpose how can i write the code to get the value

Former Member
0 Kudos

hi ,

u have attribute con-key rt ??

where this attribute is filling .. in view 1 rt ??

if it is filling in view 1 ..

then call that attribute in event handler method of second view ...

lik ycl_class1_impl=>con_key..

thanks ,

Lokesh

Former Member
0 Kudos

hi thanks for ur  reply

can u please brief explain how to write the code

i am new to sap webui codeing part

so please send me procedure

its very helpfulll to me

Former Member
0 Kudos

Hi Anithosh,

1. You can declare oen global variable (public and static)to store the value of conc_key in the impl class of the veiw1.

2. n do_prepare_output of view1, you can read the current entity using the syntax me->typed_context->btsubject->collection_wrapper->get_current().
3. using this entity, read the value of CONC_KEY using the method GET_VALUE_AS_STRING and store it in the  global variable.
4. In view 2, in eh_onedit event handler, you can access this global variable using syntax:
impl class name=>global var name.
Hope this helps!!!
Prerna