cancel
Showing results for 
Search instead for 
Did you mean: 

Field is empty when in display mode

Former Member
0 Kudos

Hi all!

I've changed field type from Input field to Picklist, assigned logics in GET_V_XXXX and GET_P_XXX

Now when im going to Display mode my field is empty!!! and when im in Edit mode everything is okay...

I tried this:

in DO_PREPARE_OUTPUT

    lo_objref_set ?= me->typed_context->btrefobjmain->collection_wrapper->get_current( ).

  TRY .
      lo_ibcomp = lo_objref_set->get_related_entity( 'BTIbaseComponent' ).

    CATCH  cx_root.

  ENDTRY.
  TRY .
      lo_value = lo_ibcomp->get_property_as_string( iv_attr_name = 'INSTANCE' ).
    CATCH cx_root.
  ENDTRY.

  TRY .
      lo_ibcomp->set_property( iv_attr_name = 'INSTANCE' iv_value = lo_value ).
    CATCH cx_root.

  ENDTRY.

But...field is empty in Display ...

Points will be rewarded!

Regards Dan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Checked some strange behavior

if i put code in GET_V_XXX like :

      DATA : lr_ibase_ddlb TYPE REF TO cl_crm_uiu_ddlb
          ,lt_ddlb        TYPE bsp_wd_dropdown_table
          ,ls_ddlb        type bsp_wd_dropdown_line
          .

      ls_ddlb-key   = ''.
      ls_ddlb-value = ''.
      insert ls_ddlb into table lt_ddlb.
      ls_ddlb-key   = '3266'.
      ls_ddlb-value = 'XXX 301'.
      insert ls_ddlb into table lt_ddlb.
      ls_ddlb-key   = '3296'.
      ls_ddlb-value = 'YYY 300'.
      insert ls_ddlb into table lt_ddlb.
     
    IF NOT lr_ibase_ddlb IS BOUND.
      CREATE OBJECT lr_ibase_ddlb
        EXPORTING
          iv_source_type = 'T'.
    ENDIF.
    lr_ibase_ddlb->set_selection_table( it_selection_table = lt_ddlb ).

    rv_valuehelp_descriptor = lr_ibase_ddlb.

everything is working OK! and in display mode it's showing values too

But if i want to insert values in lt_ddlb, according to table values like select * from then insert... i have 2 problems.

This too problems have similiar behavior,if you look at my coding you can see that im putting 1st space value to lt_ddlb ( for situations when object is new created )

defraul value of field is always 1st value in table, NOT CURRENT ...

1st is in edit mode as default value i always got Space!! But i fixed it by get_ibinstance method

2nd when i go to Display mode field is empty ...

Code for 2dn variant is:

      lr_value = me->get_ibinstance( '' ).

*    IF lr_value IS INITIAL.
*      ls_ddlb-key   = ''.
*      ls_ddlb-value = ''.
*      INSERT ls_ddlb INTO TABLE lt_ddlb.
*    ENDIF.

*    SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_smsy FROM smsy_syst_client
*      WHERE mandt <> '000'
*        AND version = 'ACTIVE'
*        AND ( cccategory = 'P' OR cccategory = 'T' )
*        AND generator = 'SYSTEM'.

*    cl_ags_sd_gdapi_util=>search_ib_comp( EXPORTING iv_ib_descr = ''
*                                          IMPORTING et_search_result = lt_instance ).
*
*    IF lr_value IS NOT INITIAL.
*      LOOP AT lt_instance INTO ls_instance WHERE instance = lr_value.
*        CLEAR ls_ddlb.
*        ls_ddlb-key = ls_instance-instance.
*        LOOP AT lt_smsy INTO ls_smsy WHERE systemname = ls_instance-descr+0(3)
*                                       AND mandt = ls_instance-descr+15(3).
*
*          CONCATENATE ls_smsy-systemname ls_smsy-mandt ls_smsy-mtext
*          INTO ls_ddlb-value SEPARATED BY space.
*        ENDLOOP.
*        INSERT ls_ddlb INTO TABLE lt_ddlb.
*
*      ENDLOOP.
*    ENDIF.
*    LOOP AT lt_smsy INTO ls_smsy.
*      CLEAR ls_ddlb.
*      LOOP AT lt_instance INTO ls_instance WHERE descr+0(3) = ls_smsy-systemname
*                                             AND descr+15(3) = ls_smsy-mandt.
*        IF lr_value IS NOT INITIAL AND ls_instance-instance = lr_value.
*          EXIT.
*        ENDIF.
*        ls_ddlb-key = ls_instance-instance.
*
*      ENDLOOP.
*      CHECK ls_ddlb-key IS NOT INITIAL.
*      CONCATENATE ls_smsy-systemname ls_smsy-mandt ls_smsy-mtext
*      INTO ls_ddlb-value SEPARATED BY space.
*
*      INSERT ls_ddlb INTO TABLE lt_ddlb.
*    ENDLOOP.
*
*
*
*    IF NOT lr_ibase_ddlb IS BOUND.
*      CREATE OBJECT lr_ibase_ddlb
*        EXPORTING
*          iv_source_type = 'T'.
*    ENDIF.

*    lr_ibase_ddlb->set_selection_table( it_selection_table = lt_ddlb ).
*    rv_valuehelp_descriptor = lr_ibase_ddlb.

Any advice?

Former Member
0 Kudos

Hi Dan,

Really not sure if I understood your problem, you are not able to see the value in display mode as you can see it in edit mode.

First thing is to go GET_XXX method of the attribute where the value is getting displayed . Check here whether the drop down key is retrieved in debug mode.

Regards,

Nithish

Former Member
0 Kudos

Hi, checked GET_XXX method value is passing okay to and i getting it in GET_V_XXX ( where DDLB table is created and im putting this value ast 1st row in DDLB tab )

But when im in display mode i can't see DDLB-VALUE there...of assigned DDLB-KEY .

Former Member
0 Kudos

Hi Dan,

According to your screenshot , in the edit mode you would have set the value in drop down , after you might have save it . At  this point the drop down field many not get saved , that is the reason in display mode method GET_XXX returning value is initial.

Check in SET_XXX method of the attribute when drop sown is set.

Regards,

Nithish

Former Member
0 Kudos

Hi, first of all i want to say that im changing field type.

From input to DDLB, so when i was as input field there was just a value of field.

Now i have 2 parameters of DDLB, key and value. System passing key as a value for this field and all works correct, but when we open ddlb box we see only values of keys.

SO, system do save key and this fine. But field value is empty.

I can't understand this:

When i fill lt_ddlb manually not from tables without loop just insert like :

        ls_ddlb-key   = '1111'.
       ls_ddlb-value = 'MHT 300'.
       insert ls_ddlb into table lt_ddlb.

     IF NOT lr_ibase_ddlb IS BOUND.
       CREATE OBJECT lr_ibase_ddlb
         EXPORTING
           iv_source_type = 'T'.
     ENDIF.
     lr_ibase_ddlb->set_selection_table( it_selection_table = lt_ddlb ).

     rv_valuehelp_descriptor = lr_ibase_ddlb.

all is working okay and i can see my value that i chosed. But if i insert some loop .... field is empty

Former Member
0 Kudos

Hi Dan,

Can you  debug the original code where you are filling the ddlb , also make sure the lt_ddlb is sorted .

Reagrds,

Nithish

Former Member
0 Kudos

Debuged and attached, one thing. Old field type was numerical and this is checking in set_xxx.

But im little confused, system stores numerical value of field like 3326, but i need to set there a ddlb-value as text.

Former Member
0 Kudos

Hi Dan,

I have checked the attachment . in GET_V_XXX method , you need not fetch the value from GET_XXX method as lr_value and prepare drop down.

A sample code is just prepare drop down from an internal table like.

   CLEAR ls_ddlb.
    LOOP AT lt_tab INTO ls_tab.
      ls_ddlb-key = ls_tab-code.
      ls_ddlb-value=ls_tab-description.
     
INSERT ls_ddlb INTO TABLE lt_ddlb.

    ENDLOOP.

    INSERT INITIAL LINE INTO lt_ddlb INDEX 1.

    IF sy-subrc EQ 0.
      gr_ddlb_ttype->set_selection_table( it_selection_table = lt_ddlb ).
    ENDIF.

And in GET_XXX make sure th key matches exactly with the key provided here . If it has trailing  or leading zeros convert it and pass in GET_XXX.

This will work for both edit and display modes.

Regards,

Nithish

Former Member
0 Kudos

Hi Nithish, problem solved!!!!

It was leading zeros!!!

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
           EXPORTING
             input  = ls_ddlb-key
           IMPORTING
             output = ls_ddlb-key.

solved

Thanks again!!!

Regards Dan

Answers (0)