cancel
Showing results for 
Search instead for 
Did you mean: 

Freely Programmed F4 help in Select Options

Former Member
0 Kudos

Hey Folks,

I have implemented a WD component which is meant to function as a Freely Programmed Value Help, say VH.

This was fairly simple by implementing the IWD_VALUE_HELP .

I have used this in two scenarios.

Case 1: In one instance I have associated the F4 help to an input field. I achieved this by means of setting the input help mode as a Freely Programmed Input Help for the corresponding context node.

Case 2: In the second instance I have a set of fields generated dynamically using the select options. Here I have associated the Search Help by using the parameter i_value_help_id of the method add_selection_field of interface IF_WD_SELECT_OPTIONS, while creating the input field.

In both cases, the F4 is successfully attached to the input fieilds.

Now coming to my actual problem.

I have a requirement, that I pre populate some nodes of the component VH prior on its initialization. In order to achieve this, I have defined the corresponding node as an interface node. This prepopulation is needed to define the visibility of a given set of fields in the view pertaining to VH. The idea is that a few fields are meant to be visible in Case 1 and a different set in Case2.

In order to achieve this, here is what I am doing:

In both case 1 and case 2, the component VH is being defined as a Used Component and all the necessary coding for it is in place to create the component usage.

In Case 1 and Case 2, I have mapped the node of VH Interface Controller to the View Controller Context Root. I am now populating the corresponding attributes of the node in the WDDOMODIFYVIEW method of the view controller ( the view which has the field attached to the search help) only when FIRST_TIME is true.

In the handler for input plug of the View in component VH1, I am verifying the values set in the context node to determine the visibility of fields on the layout.

However, only in Case 1, the population of attributes is successfully happening.

In case 2, when the control comes to the Input plug handler, I see that none of the node values are populated.

In the debug mode, I see that all the flow that I was anticipating is actually run in both cases 1 and 2, ie:

On load of the views in both case 1 and case 2, the flow is goes via

WDDOMODIFYVIEW of the view controller (the node attributes are getting populated here) when the view is initialized and

Input Plug Handler of the view for VH (But when it comes here, only flow in Case 1 shows the nodes having the values), when the input help is fired.

In case 2, it seems that the node mapping is not working. Although the attributes are populated by the view controller, the same is not being reflected when the node is read in the in the VH. It behaves as it the instances of the node is different for the View and the component CH. Has this got something to do with the select options? Since the Value Help is being invoked via the dynamic code generation and is not actually manually attached to the input field. But i dont see why this should interfere with the concept of component usage? I was hoping that the attaching of the search help would be achieved via using the concept of Value help listener and the sharing of data to render the view of the used component, would happen via the concept of Component Usages and one should not interfere with the other.

I hope I have been clear.

Please do let me know if someone has some pointers here

Thanks and Best Regards,

Puja.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,Puja,

Thanks your help in explaining how to call free programmed search help (VH)from Section Options

Component.

In this secenaio,do you know how to put the selected data from the pop up back to field in the Selection Options?

I mean I declared an interface event in VH, then I finished the event handler in the comsumer view(CV) which contains Selection Options. But when I raised the event in VH, I could not catch this through event handler in CV,

I believe the reason is that the Select Options is the real caller, so the event handler in CV could not catch

this event.

Could you have me about that? Thanks a lot.

Ray

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi,Puja,

>

> Thanks your help in explaining how to call free programmed search help (VH)from Section Options

> Component.

>

> In this secenaio,do you know how to put the selected data from the pop up back to field in the Selection Options?

>

> I mean I declared an interface event in VH, then I finished the event handler in the comsumer view(CV) which contains Selection Options. But when I raised the event in VH, I could not catch this through event handler in CV,

> I believe the reason is that the Select Options is the real caller, so the event handler in CV could not catch

> this event.

>

> Could you have me about that? Thanks a lot.

>

> Ray

You should use eventing in the VH to pass the values back. Instead you use the ValueHelpListener object that gets passed into the VH. With this object, you have direct access to the originating Context Attribute that triggered the Value Help. You should write the updated value directly back into the source Context before exiting the processing of the Value Help.

Your Value Help Component should have the interface IWD_VALUE_HELP. This interface will create the method SET_VALUE_HELP_LISTENER in your component controller. This method will be called by the framework and will pass in an object of type IF_WD_VALUE_HELP_LISTENER. You can use this object to inspect the source context attribute and to write back to it. You should save an instance of this object in your component so that on completion of the VH you can write the data back.

method set_value_help_listener .
  wd_this->value_help_listener = listener.
endmethod.

Then later when the value help is completed:

*   set single attribute
  wd_this->value_help_listener->f4_context_element->set_attribute(
  exporting
    name = wd_this->value_help_listener->f4_attribute_info-name
    value = l_time
    ).

Former Member
0 Kudos

Hi,Thomas,

Thank you so much. I should have thought that before.It's a reference,not a value copy,so I can update this reference.Cool.

Have a nice day!

Best Regards,

Ray

Former Member
0 Kudos

Dear Thomas Jung ,

According to my scenario raised above, do you know how to tranfer some values into the VH?

The requirement is like this : I have to fill in other fields(B) of this Selection Options(SO) , then I will trigger the

free programmed component VH by clicking the search help of field(A) in this SO, so I want to transfer some information to the VH

I think about the way of interface context mapping between CV and VH, but before open the VH ,firstly I have to restore the

information in the context node in CV, unfortunately it seems there is no event or action for me to achieve that before open the

VH.

Some suggestion? Thanks a lot.

Regards,

Ray

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>I think about the way of interface context mapping between CV and VH, but before open the VH ,firstly I >have to restore the

>information in the context node in CV, unfortunately it seems there is no event or action for me to >achieve that before open the VH.

You don't use the traditional context mapping, you use the value help listener as described to have direct access to the source context element and attriubte. And no there is no event or action trigger since the triggering of the VH is done within the framework.

Former Member
0 Kudos

Dear Thomas,

Thanks for your generous help. I traced deep into IF_WD_VALUE_HELP_LISTENER ,and finally find what I want. I wish

I could give you credit for this

Have a nice day.

Regards,

Ray

Former Member
0 Kudos

hi:Ray

I have a probelm about how to created a Freely Programmed F4 help in Select Options,and put help value into select options field


In my instance I have a set of fields generated dynamically using the select options. Here I have associated the Search Help by using the parameter i_value_help_id of the method add_selection_field of interface IF_WD_SELECT_OPTIONS, while creating the input field.



   LT_RANGE_TABLE_V = wd_this->m_handler_V->create_range_table( 'ZCYPHDATE' ).

  wd_this->M_HANDLER_V->add_selection_field(

      i_id                         = 'ZCYPHDATE'

      it_result                    = LT_RANGE_TABLE_V

      i_value_help_type            = if_wd_value_help_handler=>CO_PREFIX_APPLDEV

      i_value_help_id              = 'ZCY_FREEHELP'

      i_no_intervals               = abap_false ).

but,it is error ,the message is

ERROR: Die Component Usage ZCY_FREEHELP existiert nicht (termination: RABAX_STATE)

how should I do?

Thanks and Best Regards     

Answers (3)

Answers (3)

Former Member
0 Kudos

hi:Homit

   I have implemented a WD component which is meant to function as a Freely Programmed Value Help, say ZCY_FREEHELP2 and have implemented an application too.

  

   How to get help value from ZCY_FREEHELP2 into selet option field?

 

   The following code of wddoinit:

METHOD WDDOINIT .

    DATA:

       LT_RANGE_TABLE TYPE REF TO DATA,

       RT_RANGE_TABLE TYPE REF TO DATA,

       READ_ONLY      TYPE ABAP_BOOL,

       TYPENAME       TYPE STRING.

    DATA:

      LR_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER,

      L_REF_CMP_USAGE        TYPE REF TO IF_WD_COMPONENT_USAGE.

* create the used component

      L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_SELECT_OPTIONS( ).

     IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.

      L_REF_CMP_USAGE->CREATE_COMPONENT( ).

     ENDIF.

     WD_THIS->M_WD_SELECT_OPTIONS = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).

* init the select screen

     WD_THIS->M_HANDLER = WD_THIS->M_WD_SELECT_OPTIONS->INIT_SELECTION_SCREEN( ).

   WD_THIS->M_HANDLER->SET_GLOBAL_OPTIONS(

                            I_DISPLAY_BTN_CANCEL  = ABAP_FALSE

                            I_DISPLAY_BTN_CHECK   = ABAP_FALSE

                            I_DISPLAY_BTN_RESET   = ABAP_FALSE

                            I_DISPLAY_BTN_EXECUTE = ABAP_FALSE ).

   DEFINE MCR_SEL.

     free lt_range_table.

     lt_range_table = wd_this->m_handler->create_range_table( &1 ).

     wd_this->m_handler->add_selection_field(

       i_id = &1

       i_description = &2

       it_result = lt_range_table

       i_read_only = &3

       I_NO_INTERVALS = &4 ).

   END-OF-DEFINITION.

   MCR_SEL 'ZCYNUM1' '物流发货计划号' ABAP_FALSE ABAP_FALSE.

   DATA LO_SO_API TYPE REF TO IF_WD_CONTROLLER.

   LO_SO_API = WD_THIS->M_WD_SELECT_OPTIONS->WD_GET_API( ).

   DATA LO_SO_CMP TYPE REF TO IF_WD_COMPONENT.

   LO_SO_CMP = LO_SO_API->GET_COMPONENT( ).

   DATA LO_SO_CMP_USG TYPE REF TO IF_WD_COMPONENT_USAGE_GROUP.

   LO_SO_CMP_USG = LO_SO_CMP->CREATE_CMP_USAGE_GROUP(

       NAME           = 'MYSO'

       USED_COMPONENT = 'ZCY_FREEHELP2' ).

   FREE LT_RANGE_TABLE.

   LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( 'ZCYPHDATE' ).

   WD_THIS->M_HANDLER->ADD_SELECTION_FIELD(

        I_ID                                     = 'ZCYPHDATE'

        IT_RESULT                        = LT_RANGE_TABLE

        I_DESCRIPTION                = '配货计划时间'

        I_VALUE_HELP_TYPE      = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_APPLDEV

        I_VALUE_HELP_ID              = 'MYSO'

        I_NO_INTERVALS               = ABAP_FALSE ).

endmethod.

 

    Thanks and Best Regards

Former Member
0 Kudos

Hi Thomas,

I am trying to use Freely Programmed search help for calling a custom WD component on pressing of F4 of an input field.

I have done everything required and the component is being called properly as well.

The issue here is that i need to pass two values to the the custom WD component on F4. As you suggested above I used FS_CONTEXT_ELEMENT to get the reference of the source context node and attributes. But the problem is that this gives reference to only that node which has the input field with F4 help. The values which i need to pass are present in some other node.

Can you please suggest a way of accessing the other node to retrieve and use the values in the custom component called?

Regards,

Ritvik

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The context element of the value help listener is always going to point to the source that triggered the value help. The Freely Programmed value help is still a component usage however. You can create a cross component context binding to the component usage of the value help.

Former Member
0 Kudos

hi:Thomas 


I have a probelm about how to created a Freely Programmed F4 help in Select Options,and put help value into select options field


In my instance I have a set of fields generated dynamically using the select options. Here I have associated the Search Help by using the parameter i_value_help_id of the method add_selection_field of interface IF_WD_SELECT_OPTIONS, while creating the input field.



   LT_RANGE_TABLE_V = wd_this->m_handler_V->create_range_table( 'ZCYPHDATE' ).

  wd_this->M_HANDLER_V->add_selection_field(

      i_id                         = 'ZCYPHDATE'

      it_result                    = LT_RANGE_TABLE_V

      i_value_help_type            = if_wd_value_help_handler=>CO_PREFIX_APPLDEV

      i_value_help_id              = 'ZCY_FREEHELP'

      i_no_intervals               = abap_false ).

but,it is error ,the message is

ERROR: Die Component Usage ZCY_FREEHELP existiert nicht (termination: RABAX_STATE)

how should I do?

  Thanks and Best Regards

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

when i pass I_VALUE_HELP_ID as my component usage name and I_VALUE_HELP_TYPE as

IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_APPLDEV to the method call ADD_SELECTION_FIELD

i am able to see the F4 icon, as soon as i click it throughs an error

ZVH is my component usage name which is my freely programmed comopnent

Component usage ZVH does not exist

Abhi

Former Member
0 Kudos

Hi Abhi,

Verify if you have created the Component Usage group , by pointing the component usage of the freely programmed component to the interface controller of the select options component.

This is achived by

- getting a handle of the interface controller of the select options

wd_this->m_select_options = wd_this->wd_cpifc_select_options( ).

li_controller = wd_this->m_select_options->wd_get_api( ).

li_component = li_controller->get_component( ).

- creating the component usage

li_component->create_cmp_usage_group(

name = 'ZVH'

used_component = <<the name of the webdynpro component corresponding to ZVH>>).

You would need to do this prior to invoking the add selection field. This way the select options component is aware of the component its referring to in the i_value_help_id.

I suspect this could be the problem.

@ Abhi and others ... sigh! Any pointers to the issue I am facing?

Cheers,

Rashmi.

Former Member
0 Kudos

The mapping never worked automatically. Finally, as a quick fix I had to manually code for the value population in the WDDOMODIFYVIEW method. An ugly way to fix it...but I was bound by time limitations.

Regards,

Puja.

Former Member
0 Kudos

hi: Abhimanyu

     I are creating a freely programmed help in seletion option ,I have also encountered similar problems,are you solved the problem ?