Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Drop Down in Input enabled ALV

Former Member
0 Kudos

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

.

2 REPLIES 2

Former Member
0 Kudos

Hi Deepu,

This following code should work..try this


DATA : lif_des TYPE char30 VALUE 'ABCD100 Glass company London',
       lif_des2 TYPE char30,
       lifnr TYPE char18.

DATA : delim VALUE space.


lif_des2 = lif_des.
SHIFT lif_des UP TO delim.
REPLACE FIRST OCCURRENCE OF lif_des IN lif_des2
                                      WITH ' '.
CONDENSE lif_des2.
lifnr = lif_des2.
WRITE 😕 lifnr.

0 Kudos

Hello Sudhakar,

May be I have to Write the code what u have specified in one of the Method.

My Qn was, which method shud I use for manipulating the values of a drop down list box ?

Regards,

Deepu.K