Skip to Content
0
Former Member
Nov 09, 2007 at 09:30 AM

Reg: Drop Down in Input enabled ALV

38 Views

Hello All,

1. I created a Drop down list box for the Field vendor ( LIFNR ).

2. This List box contains the Vendor as well as the Vendor Description concatenated into one value.

3. Now when I select a value from the Drop DOwn List Box I want to get only the Vendor value into the field but not the Description .

4. Can anyone tell me how to acheive this ?

5. My present code is as follows :

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

*&*********************************************************************************
*& Form        : set_drdn_table                                                  *
*& Description : Prepare the DropDown List for the Vendor          *
*&*********************************************************************************
FORM set_drdn_table .

  DATA: lt_dropdown TYPE lvc_t_drop,
        ls_dropdown TYPE lvc_s_drop.

  DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.

  CLEAR lwa_lifnr.
* Populate the DD List Box with the Lifnr and Description values
  LOOP AT lt_lifnr INTO lwa_lifnr.
    ls_dropdown-handle = '1'.
    CONCATENATE lwa_lifnr-lifnr lwa_lifnr-description INTO ls_dropdown-value SEPARATED BY space.
    APPEND ls_dropdown TO lt_dropdown.
    CLEAR: ls_dropdown.
  ENDLOOP.

  CLEAR lt_f4.
  lt_f4-fieldname  = 'LIFNR'.
  lt_f4-register   = 'X'.
  lt_f4-chngeafter = 'X'.
  APPEND lt_f4.

* Call the Method and set the Dropo Down Table
  CALL METHOD gr_alvgrid->set_drop_down_table
    EXPORTING
      it_drop_down = lt_dropdown.

ENDFORM.                    " set_drdn_table 

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

Regards,

Deepu.K

.