Skip to Content
avatar image
Former Member

Depedent dropdown list: cannot control each line in the table view

Hello Sap Gurus,

I have set up a code in order to get dependent dropdown entries. Better said, whenever attribute X is modified you get different value for attribute Y.

The point is that I cannot control each line independently.

Once the first selection is executed as desired:

But then once I select "Outsourcing" the values are lost, like shown below.

I do believe that I miss something within the dropdown list code.

I have coded the GEP_P of the attribute LOB. Then this method is calling the event

DDLB_CLICK. This event is carrying out the set of the attribute LOB.

And then it comes the GET_V of the attribute Portfolioelement. See the code below.

DATA: current TYPE REF TO if_bol_bo_property_access.
DATA: dref TYPE REF TO data,
LV_PRODUCT TYPE ZDTEL00004W,
LT_DOMAIN_ENTRIES type standard table of DD07V,

wa_domain_entries type DD07V.
DATA : lr_ddlb TYPE REF TO cl_crm_uiu_ddlb,

it_ddlb TYPE bsp_wd_dropdown_table,

et_ddlb TYPE bsp_wd_dropdown_table,

ut_ddlb TYPE bsp_wd_dropdown_table,

wa_ddlb TYPE bsp_wd_dropdown_line.
DATA: lv_event TYPE string,

lv_index TYPE int4,

lv_dummy TYPE string,

lv_one_click_lock TYPE sysubrc.


current = collection_wrapper->get_current( ).
Current->get_property_as_value( EXPORTING iv_attr_name = ' ZZFLD00001J ' IMPORTING ev_result = LV_PRODUCT ).

CALL FUNCTION 'DD_DOMVALUES_GET'

EXPORTING

DOMNAME = 'ZDTEL000050'

TEXT = 'X'

LANGU = sy-langu

TABLES

DD07V_TAB = lt_domain_entries.

Refresh: it_ddlb.
CASE LV_PRODUCT.

WHEN '01'.

LOOP AT lt_domain_entries INTO wa_domain_entries
WHERE domvalue_l NE '0001'
AND domvalue_l NE '0002'
AND domvalue_l NE '0003'
AND domvalue_l NE '0004'
AND domvalue_l NE '0005'
AND domvalue_l NE '0008'
AND domvalue_l NE '0009'.
wa_ddlb-key = wa_domain_entries-valpos.
wa_ddlb-value = wa_domain_entries-ddtext.
APPEND wa_ddlb TO it_ddlb.
CLEAR wa_ddlb.
ENDLOOP.

WHEN '02'.
CLEAR it_ddlb.
LOOP AT lt_domain_entries INTO wa_domain_entries
WHERE domvalue_l NE '0006'
AND domvalue_l NE '0007'
AND domvalue_l NE '0009'.

wa_ddlb-key = wa_domain_entries-valpos.

wa_ddlb-value = wa_domain_entries-ddtext.

APPEND wa_ddlb TO it_ddlb.

CLEAR wa_ddlb.
ENDLOOP.

WHEN '03'.
CLEAR it_ddlb.
LOOP AT lt_domain_entries INTO wa_domain_entries
WHERE domvalue_l NE '0001'
AND domvalue_l NE '0002'
AND domvalue_l NE '0003'
AND domvalue_l NE '0004'
AND domvalue_l NE '0005'
AND domvalue_l NE '0006'
AND domvalue_l NE '0007'
AND domvalue_l NE '0008'.

wa_ddlb-key = wa_domain_entries-valpos.
wa_ddlb-value = wa_domain_entries-ddtext.
APPEND wa_ddlb TO it_ddlb.
CLEAR wa_ddlb.
ENDLOOP.

* WHEN OTHERS.

ENDCASE.

* Build the value descriptor reference

CREATE OBJECT lr_ddlb

EXPORTING

iv_source_type = 'T'.

Append INITIAL LINE to it_ddlb.

sort it_ddlb by key.
CALL METHOD lr_ddlb->set_selection_table

EXPORTING

it_selection_table = it_ddlb.

rv_valuehelp_descriptor ?= lr_ddlb.


But then I have got my problem.

I need to keep the values coming from the first selection and at the same time to get other values.

Any help is welcomed.

Regards,

Andrea

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    May 26, 2015 at 09:07 AM

    Hello Andrea,

    I think your problem comes from this statement :

    collection_wrapper->get_current( ).


    You need to get your entity with the index (IV_INDEX parameter) using method FIND of the collection wrapper.


    Regards,

    BenoƮt

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Benoît,

      you were totally right. Actually you saved my day.

      Actually the problem was the statement collection_wrapper->get_current( ).

      I replace this statement with the below statement and it works.

      current = collection_wrapper->find( iv_index = IV_INDEX ).

      I have really to thank you for your precious piece of advice.

      Best regards,

      Andrea