cancel
Showing results for 
Search instead for 
Did you mean: 

How to populate drop down value based on item category?

former_member198180
Active Participant
0 Kudos

Hi Team,

My requirement is Create column at item level for STAGE LOCATION as drop down. drop down should populate value from custom table based on item type ..

for this i have created one AET field i.e Stage location and i have added this field on Complaint creation screen of ITEM Assignment block..For this i have created Z table which contains two fields Item_type and Sales stage. they are maintained item type - zjm,zti,zrt,sales stages value 1000,1200,1300 like that values they are created.

For getting drop down i have implemented Get_p and get_v methods.in get_v i have added the logic as below..


DATA: lt_sel_table     TYPE          bsp_wd_dropdown_table,

       ls_sel_table     TYPE LINE OF  bsp_wd_dropdown_table,

         lr_ddlb TYPE REF TO cl_crm_uiu_ddlb.

  DATA : lt_item TYPE TABLE OF zlocation,

        ls_item TYPE zlocation

******* Write your Selection lgic to fill lt_ddlb

  SELECT *

       FROM zlocation

       INTO TABLE lt_item.

  IF sy-subrc EQ 0.

    INSERT INITIAL LINE INTO lt_sel_table INDEX 1.    "This is for blank value

    LOOP AT lt_item INTO ls_item.

      ls_sel_table-key   = ls_item-item_type.

      ls_sel_table-value = ls_item-sloc.

      APPEND ls_sel_table TO lt_sel_table.

      CLEAR: ls_sel_table, ls_item.

    ENDLOOP.

  ENDIF.

  CREATE OBJECT lr_ddlb

    EXPORTING

      iv_source_type = 'T'.

  lr_ddlb->set_selection_table( it_selection_table = lt_sel_table ).

  rv_valuehelp_descriptor = lr_ddlb.

Now iam getting drop down and drop down values..exact requirement is user based on item category created user supppoe item category is ztre then storage location 1000 it is set ,based on that item category storage should get popultaed..these values are maintained on ztable.then how to do it..please help hee.

Thanks

Kalpana

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member202474
Contributor
0 Kudos

Hi kalpana,

                    So you mean that the moment you select a value in the dropdown, based on that anothe  field item category storage must get autopopulated. For this your dropdown must have an event so that it comes back to the code and autopopulates it.

For this in GET_P method , for property SERVER EVENT pass value "DDLB_CLCK".

In the do prepare output method write the logic to fetch the value of item category storage from the z table provided there is a value in the dropdown field- Storage location and using set_property method set its value.

Hope it helps.

Regards,

RUby.

former_member198180
Active Participant
0 Kudos

Hi Ruby,

Thanks for your reply ,based on item category drop down value ,the storage location value should be set.

here Item_type attribute user select item -ztrs,the storage location value set automatically 1000(this value populate from custom table).

Get_p method i have added fp_server event.DDl_chk...Any sample code for this.

Thanks

kalpana

former_member202474
Contributor
0 Kudos

Hi Kalpana,

                   In GET_P method write teh below code.

WHEN if_bsp_wd_model_setter_getter=>fp_server_event.

rv_value = 'DDLB_CLCK'.

ENDCASE.

In DO_PREPARE_OUTPUT method write the logic.

lr_entity ?= me-> typed_context->context_node->..........

use get_propert_as value method of lr_entity and read the item category value.

If not initial then using set properyt method set the valu of location by hitting teh z table.

Reward if useful.

Regards,

Ruby.