cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Web UI Custom field value not getting set .

naval_bhatt4
Contributor
0 Kudos

Hi All,

We have a custom field which is created as a numerical field .

When I am trying to enter the field with a numerical value its not getting updated

ie; when I press enter after entering value in UI it disappears .

But when I enter chars it accepts the value .

Code snippet for GET and SET methods are .

************************************

     DATA: current TYPE REF TO if_bol_bo_property_access.

     DATA: dref    TYPE REF TO data.

     value = 'BTCustomerH not bound'."#EC NOTEXT

     if iterator is bound.

       current = iterator->get_current( ).

     else.

       current = collection_wrapper->get_current( ).

     endif.

   TRY.

     TRY.

         dref = current->get_property( 'ZZFC_PROBABILITY' ). "#EC NOTEXT

       CATCH cx_crm_cic_parameter_error.

     ENDTRY.

     CATCH cx_sy_ref_is_initial cx_sy_move_cast_error

           cx_crm_genil_model_error.

       RETURN.

   ENDTRY.

     IF dref IS NOT BOUND.

       value = 'BTCustomerH/ZZFC_PROBABILITY not bound'."#EC NOTEXT

       RETURN.

     ENDIF.

     TRY.

         value = if_bsp_model_util~convert_to_string( data_ref = dref

                                     attribute_path = attribute_path ).

       CATCH cx_bsp_conv_illegal_ref.

         FIELD-SYMBOLS: <l_data> type DATA.

         assign dref->* to <l_data>.

           value = '-CURR/QUANT REF DATA MISSING-'.

       CATCH cx_root.

         value = '-CONVERSION FAILED-'.                  "#EC NOTEXT

     ENDTRY.

   SHIFT value LEFT DELETING LEADING '0'.

   IF value = ' '.

     value = '0'.

   ENDIF.

*************************************

DATA:

     current TYPE REF TO if_bol_bo_property_access,

     dref    TYPE REF TO data,

     copy    TYPE REF TO data.

   FIELD-SYMBOLS:

     <nval> TYPE any,

     <oval> TYPE any.

*   get current entity

   IF iterator IS BOUND.

     current = iterator->get_current( ).

   ELSE.

     current = collection_wrapper->get_current( ).

   ENDIF.

*   get old value and dataref to appropriate type

   TRY.

       TRY.

           dref = current->get_property( 'ZZFC_PROBABILITY' ). "#EC NOTEXT

         CATCH cx_crm_cic_parameter_error.

       ENDTRY.

     CATCH cx_sy_ref_is_initial cx_sy_move_cast_error

           cx_crm_genil_model_error.

       RETURN.

   ENDTRY.

*   assure that attribue exists

   CHECK dref IS BOUND.

*   set <oval> to old value

   ASSIGN dref->* TO <oval>.

*   create a copy for new value

   CREATE DATA copy LIKE <oval>.

*   set <nval> to new value

   ASSIGN copy->* TO <nval>.

*   fill new value using the right conversion

   TRY.

*        TRY.

       CALL METHOD if_bsp_model_util~convert_from_string

         EXPORTING

           data_ref       = copy

           value          = value

           attribute_path = attribute_path.

     CATCH cx_sy_conversion_error.

       RAISE EXCEPTION TYPE cx_bsp_conv_failed

         EXPORTING

           name = 'ZZFC_PROBABILITY'.                        "#EC NOTEXT

   ENDTRY.

*   only set new value if value has changed

   IF <nval> <> <oval>.

     current->set_property(

                     iv_attr_name = 'ZZFC_PROBABILITY'       "#EC NOTEXT

                     iv_value     = <nval> ).

   ENDIF.

******************************************

Attached the field properties

Accepted Solutions (1)

Accepted Solutions (1)

naval_bhatt4
Contributor
0 Kudos

Done

Former Member
0 Kudos

hi naval,

how did you solve it.

Rgds,

Vishal

Former Member
0 Kudos

Hi Naval,

How did you solve this by implementing _M_ and _P_ methods ?.

BR

Raj

naval_bhatt4
Contributor
0 Kudos

Hi Raj ,

I think it was M method ..... P is for the field type it doesnt control the input values validation..

naveenkolathuru
Participant
0 Kudos

Hi Naval,

I'm facing the same issue. Would please provide the code in M method.

AET wont support to add field to BTREFOBJ ,so I added date field in BOL Structure and added to config . I can choose the value of date , as soon as i hit enter value disapper. In set method dref is not bound. Suggest me how to fix the issue.

Thanks,

Naveen.

naval_bhatt4
Contributor
0 Kudos

Hi Naveen ,

I suggest you to first test the BOL , in BOL model browser .

you should check if the field is available in the structure, after that you can fill the dref with the BOL entity from iterater 

former_member606508
Participant
0 Kudos

would have been far better if you would explain how rather than just saying Done.

Answers (2)

Answers (2)

former_member228349
Participant
0 Kudos

hi,

I am facing similar problem,  text or numeric entries not getting set,  it is an model custom attribute but not getting set,  How did you solve it..

thanks

Dhinesh

Former Member
0 Kudos

You need to set the appropriate meta data value for the field type . its either the _M_ or the _P_ method. Implement them as well.

Reward points if problem is fixed.

Cheers

Chetan