cancel
Showing results for 
Search instead for 
Did you mean: 

ASSERTION_FAILED when filling dropdownbykey with sql queries

brad_landry2
Active Contributor
0 Kudos

Hi everybody,

I'm new to WDA, and I am coding a new interface for transaction CBIH82 in EHS.

I am filling a dropdownbykey with a sql query, for the work area.

On the view, the dropdownbykey is populated, but when I click on a button, or when I launch an action, I have the error "ASSERTION_FAILED".

However, if I fill the dropdownbykey manually in the code, I got no error.

Error in IE :

The ASSERT condition was violated

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
Method: CONV_VIEW_INTO_VE_ADAPTER_TREE of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
Method: SET_CONTENT_BY_WINDOW of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
Method: RENDER_WINDOWS of program CL_WDR_CLIENT_SSR=============CP
Method: IF_WDR_RESPONSE_RENDERER~RENDER_VIEWS of program CL_WDR_CLIENT_SSR=============CP
Method: IF_WDR_RESPONSE_RENDERER~RENDER_USER_INTERFACE_UPDATES of program CL_WDR_CLIENT_SSR=============CP

Here is the dump :

27926     else.                                                                            
27927       IFUR_NW5_COMBOBOX~READONLY = wd_DROPDOWN_BY_KEY->vl_READ_ONLY.                 
27928     endif.                                                                           
27929 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|READONLY                                   
27930     if M_PARENT_READONLY = abap_true or                                              
27931        mv_KEY_ATTR_INFO-is_read_only = abap_true.                                    
27932       IFUR_NW5_COMBOBOX~READONLY = abap_true.                                        
27933     endif.                                                                           
27934                                                                                
27935 *   >> property-UCA IFUR_NW5_COMBOBOX~REQUIRED                                       
27936 *   >> UCA STANDARD|DROPDOWN_BY_KEY|REQUIRED                                         
27937     if mv_WD_STATE = cl_wd_dropdown_by_idx=>e_state-required.                        
27938       IFUR_NW5_COMBOBOX~REQUIRED = abap_true.                                        
27939     else.                                                                            
27940       IFUR_NW5_COMBOBOX~REQUIRED = abap_false.                                       
27941     endif.                                                                           
27942                                                                                
27943 *   >> property-Property IFUR_NW5_COMBOBOX~USEDINSAPTABLE                            
27944     IFUR_NW5_COMBOBOX~USEDINSAPTABLE = /1WDA/VTABLE_CELL_EDITOR~mv_INSIDE_TABLE.     
27945                                                                                
27946 *   >> property-UCA mv_VALUE_SET                                                     
27947 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|VALUE_SET                                  
27948     data value_set_item type WDR_CONTEXT_ATTR_VALUE.        "#EC NEEDED              
27949     mv_VALUE_SET = mv_KEY_ATTR_INFO-value_set.                                       
27950     read table mv_VALUE_SET into value_set_item                                      
27951       with key value = mv_KEY_INTERNAL.                                              
27952     if sy-subrc = 0.                                                                 
27953       IFUR_NW5_COMBOBOX~VALUE = cl_http_utility=>escape_html( value_set_item-text ). 
27954     else.                                                                            
27955       " entry not found - only legal for "initial" value                             
>>>>>       assert mv_KEY_INTERNAL co ` 0`.                       "#EC NOTEXT              
27957       IFUR_NW5_COMBOBOX~VALUE = ''.                         "#EC NOTEXT              
27958     endif.                    

The error is at line 27956.

And here is my code to fill the dropdownbykey in my wddoinit of my view :

data:
    lieux_de_travail                    type string,
    description_lieux_travail           type string,
    table_record_number_travail         type TABLE OF string,
    table_lieux_travail_full            type TABLE OF string,
    lieux_travail_full                  type string,
    record_number_travail               type string,
    valeur_int                          type i VALUE 0,
    valeur_string                       type string.

SELECT RECNROOT FROM CCIHT_WAH INTO TABLE table_record_number_travail.

LOOP AT table_record_number_travail INTO record_number_travail.
  SELECT WANAM FROM CCIHT_WALD INTO description_lieux_travail WHERE RECNROOT = record_number_travail.
  ENDSELECT.
  SELECT WAID FROM CCIHT_WAH INTO lieux_de_travail WHERE RECNROOT = record_number_travail.
  ENDSELECT.
  IF NOT lieux_de_travail = 'ALOUETTE'.
    CONCATENATE lieux_de_travail description_lieux_travail INTO lieux_travail_full SEPARATED BY ' - '.
  ELSE.
    lieux_travail_full = lieux_de_travail.
  ENDIF.
 INSERT lieux_travail_full INTO TABLE table_lieux_travail_full.
ENDLOOP.

data:     NODE_INFO type ref to IF_WD_CONTEXT_NODE_INFO,
          NODE_INFO_ACLOC type ref to IF_WD_CONTEXT_NODE_INFO.

NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).

NODE_INFO_ACLOC = NODE_INFO->GET_CHILD_NODE( 'INFO_ACLOC' ).

data:    LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST,
         L_VALUE type WDR_CONTEXT_ATTR_VALUE.

valeur_int = 0.

LOOP AT table_lieux_travail_full INTO L_VALUE-TEXT.
  ADD 1 TO valeur_int.
  MOVE valeur_int to valeur_string.
  L_VALUE-VALUE = valeur_string.
  INSERT L_VALUE into table LT_VALUESET.
ENDLOOP.

CLEAR valeur_int.

NODE_INFO_ACLOC->SET_ATTRIBUTE_VALUE_SET(
     NAME = 'LIEUX'
     VALUE_SET = LT_VALUESET ).

The values are stored in the context node "INFO_ACLOC", and cardinality 1.1/0.1, in LIEUX of type String.

Anybody had this error before?

Thank you!

Brad

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hi Brad,

The selectedKey property contains a value that is not part of the value set and is neither an initial value (the only exception for a value not being part of the value set).

Best regards,

Thomas

brad_landry2
Active Contributor
0 Kudos

Hi Thomas,

thank you, that was it.

I had a conversion of int to string, and the resulting string was not good.

It looked like as a number in the debug mode, but not in the hexadecimal value.

I did not saw it, because I'm beginning to learn abap too.

Brad

thomas_szcs
Active Contributor
0 Kudos

Hi Brad,

Glad to see that it works now.

Best regards,

Thomas

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Brad,

I suspect the domain in question is of type NUMC

and you have populated with non numeric value.

The system type checks the list. Invalid entries will cause a dump.

regards

Phil.