on 04-13-2014 7:34 AM
Hi All,
My requirement is when to create field with dropdown values and when user changes the value,it suppose to show popup box for confirmation to change the value.
Plese provide me the approch to how to deal with it.
BR
Gaurav
Hi Gaurav,
I hope you have already created a field.
Implement get V and get P methods to get the dropdown for the field. V method for getting values in the dropdown and P method for setting the field type as dropdown. Please let me know if you need sample code for the same methods.
After doing this, in get P method you have to write the code for triggering server event which will be your EH_(event). Then you have to write the pop up code for confirmation. Again please write me if you want the sample code for pop up.
Thats it
Thanks,
Bhushan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhushan,
Thanks for your reply.I have done with generation of dropdow box with value
Actually I am trying to write code in EVENT_HANDLING,but not able to do so.
Can you please provide me sample code's or url for the how to do method.
Please explain me what will be require to save the changed data also.
BR
Gaurav
Hi Gourav,
In the event handler, you can write something similar to below.
CALL METHOD comp_controller->window_manager->create_popup_2_confirm
EXPORTING
iv_title = lc_title
iv_text = lc_text
iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_okcancel
RECEIVING
rv_result = confirm_popup.
confirm_popup->set_on_close_event( iv_event_name = 'POPUP_CLOSED' iv_view = me ). " Here you should have the event for close.
confirm_popup->open( ).
Thanks,
Faisal
Hi Faisal,
I have this sample code too.
I am struguling for where to write the code.
As per requirement I have created field in sales order item row via AET with drop box.
Now when user changes the value from dropbox popup message suppose to appear.
Is it possible to show pop up message when user only changes the value from drop down as I guess to call event Save button must be pressed.
Please guide me about where to write code.
BR
Gaurav
Hi Gaurav,
Here is how you can do this step by step. No need to press the save button, the event can be triggered when you change the values in dropdown.
1) Go to get_p of your attribute and add the following code there.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_pick_list.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick. " To call the event handler by clicking
rv_value = "SHOW_POP_UP."
2) I hope you have already done the GET_V part in order to get the values to the dropdown.
3) Go to event handler and create an event handler called SHOW_POP_UP (EH_ONSHOW_POP_UP the name will come).
4) In this evend handler method write the following code.
CALL METHOD comp_controller->window_manager->create_popup_2_confirm
EXPORTING
iv_title = lc_title
iv_text = lc_text
iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_okcancel
RECEIVING
rv_result = confirm_popup.
confirm_popup->set_on_close_event( iv_event_name = 'POPUP_CLOSED' iv_view = me ). " Here you should have the event for close.
confirm_popup->open( ).
I hope this will solve your issue.
Thanks,
Faisal
Hi Faisal,
Its working for me,but in my case Pop up window should have Yes ,No and Cancel.
So I am passing iv_btncombination = if_bsp_wd_window_manager=>co_btncomb_yesnocancel.
So can you please guide me for above case like when user presses NO button then how to reset the value with the old one and same for the cance as well.
Thanks for your help.
BR
Gaurav
Hmmm....That will need to implement some logic... You can try something like below.
In view initialization, create a static variable gv_pop_up with the current value of this field. (First clear it and assign the current value).
In event EH_ONSHOW_POP_UP, write the following code before the call of pop up.
lr_ddlb ?= typed_context->context_node_name ->collection_wrapper->get_current().
lv_value = lr_ddlb->get_property_as_string( iv_attr_name = 'YOUR_FIELD_NAME' ).
Now you have the new value selected in lv_value.
Compare the old value with new value (lv_value and gv_pop_up) and then if user presses NO, assign the old value to the drop down. I hope you know how to set the collection. Also, if user presses yes, don't forget to update the static variable with the new value so that it will compare next time with this value.
Thanks,
Faisal
Hi Gaurav,
You can do some R&D when we have the approach on how to do. However, PFB for what you should be doing in step by step.
1) As per our code, we have an event called POPUP_CLOSED once we close the pop up. First create that event handler.
2) Now in the event handler, write the following code.
lv_plug = confirm_popup->GET_FIRED_OUTBOUND_PLUG( ).
CASE lv_plug.
WHEN cl_gs_ptc_bspwdcomponent_cn01=>co_event_yes.
* Write the code when yes.
WHEN cl_gs_ptc_bspwdcomponent_cn01=>co_event_no.
* Write the code when No.
ENDCASE.
Also, if you declare a static variable as mentioned earlier, that will be accessible here in your method.
Thanks,
Faisal
No...not the set method. I am talking about setting the collection. Do one thing, check the initialization of your table view. There you will see something like me->set_collection (lv_collection) or lr_entity->set_collection(lv_collection). That means you are updating the collection for the entity with the values.
The same can be used in our case as well. What you probably can do is,
1) Once user presses No, Set the collection's field value with the old value (in dropdown in your case).
2) Then call me->set_collection by passing the above collection.
Try out this. If you are unable to do, let me know. I will give you the code once connected to the system.
Thanks,
Faisal
Hi Gaurav,
lr_col = me->typed_context->btadmini->collection_wrapper->get_current( ).
Now set the collection wrapper with your old field value (using set_value_as_string/value).
Now, lr_entity->set_collection(lr_coll).
I understand it's a table field. That's why given collection to be set in entity.
Kindly mark helpful answers.
Thanks,
Faisal
Hi Faisal,
lr_entity is bol property access and its not having method collection method.
below is my data defination of required class interface's.
DATA: lr_current TYPE REF TO if_bol_bo_property_access,
lr_cw TYPE REF TO cl_bsp_wd_collection_wrapper,
lr_it YPE REF TO if_bol_bo_col_iterator.
i am changing calue of field in lr_current
same was reflecting in lr_cw
but not visible on UI
lr_cw->publish_current( ).
Please correct me if I am wrong.
BR
Gaurav
User | Count |
---|---|
3 | |
2 | |
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.