Application Development and Automation 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: 
Read only

Dropdown in ALV

Former Member
0 Likes
1,981

Hi Guys...

I am using REUSE_ALV_GRID_DISPLAY to display an ALV. I want to know how can we impelement the dropdown option in one of the fields. Please suggest an option without using classes as i have already finished most of the coding without classes. Is this option possible and if yes how. ? Code would be of great help.

Hi Guys...

I am using REUSE_ALV_GRID_DISPLAY to display an ALV. I want to know how can we impelement the dropdown option in one of the fields. Please suggest an option without using classes as i have already finished most of the coding without classes. Is this option possible and if yes how. ? Code would be of great help.

5 REPLIES 5
Read only

former_member181966
Active Contributor
0 Likes
1,224

Check out the following Demo`s in SE38

BCALV*

Also check thread

Hope this’ll give you idea!!

<b>P.S award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

Read only

Former Member
0 Likes
1,224

Provide a form name to 'USER_COMMAND' in REUSE_ALV_GRID_DISPLAY function module. Identify the double clicking (selection) on any particular field by FCODE &IC1. You will write the code like following.

FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.     "#EC CALLED
  data : l_prev_tunit like t006-msehi.
  Case r_ucomm.
    When '&IC1'.
*-------Rolling average ( main report)
      if rs_selfield-fieldname = 'R_AVG'.
        read table i_output into v_output index rs_selfield-tabindex.
        perform show_drill_down_rep using v_output.
      endif.
*-------Number of breakdow ( main report)
      if rs_selfield-fieldname = 'NUM_BRKDWN'.
        read table i_output into v_output index rs_selfield-tabindex.
        perform show_drill_down_rep using v_output.
      endif.

Read only

venkat_o
Active Contributor
0 Likes
1,224

Hi Madhu,

I dont think it is possible without OOPs ALV .

Anyway Have a look at this link.

<b>1</b>.

<b>Thanks,

Venkat.O</b>

Read only

Former Member
0 Likes
1,224

HI

GOOD

GO THROUGH THIS LINKS I HOPE THESE WILL HELP YOU TO SOLVE YOUR PROBLEM.

Making Fields as Dropdown Menus

Certainly, it will be nice to make some fields as dropdown menus. The procedure for making a field as a dropdown menu is similar to making it to contain a hyperlink. However, in this case, we do not give our table filled with handles directly to the method “set_table_for_first_display”. The table for values must be of type “LVC_T_DROP” and we will use the method “set_drop_down_table” to register our handles table. To make an entire column as dropdown, just while generating the field catalog; pass the handle number to field “DRDN_HNDL” for that field.

e.g. ps_fcat-drdn_hndl = '1' .

To make individual cells as dropdown, you must add a new field to contain the handle, for each column field to be as dropdown. While filling your list data or somewhere separate where you modify it, you fill these new fields with handles. To match the fields containing handle information with the columns, we use again the field catalog. We pass the name of our new field to the field “DRDN_FIELD” of the field catalog structure for the column.

e.g. For the example at the Code Part18:

ps_fcat-drdn_field = 'PTYP_DD_HNDL' .

Code Part 19 – Adding a new field to contain handle for drilldown values

Code Part 20 – Preparing values for the dropdown menu with the handle ‘1’

*--- Internal table holding list data

DATA BEGIN OF gt_list OCCURS 0 .

INCLUDE STRUCTURE SFLIGHT .

DATA rowcolor(4) TYPE c .

DATA cellcolors TYPE lvc_t_scol .

DATA carrid_handle TYPE int4 .

DATA connid_handle TYPE int4 .

DATA ptype_dd_hndl T

GO THROUGH THIS LINK TO KNOW FURTHER

http://www.abap4.it/download/ALV.pdf

THANKS

MRUTYUN

Read only

Former Member
0 Likes
1,224

If you are using REUSE_ALV_GRID_DISPLAY_LVC function module for the ALV grid display, you can make the fields in a column dropdown boxes by doing the following:

1. Create a custom domain for the field that you want to be a dropdown list and then in the value range specify the values as single values.

2. Create a data element referring to this domain.

3. Create a data dictionary structure, which will include the dataelement created. This structure would be the output structure for the ALV report. It is important that the output structure be a dictionary structure.

4. Generate the field catalog using 'LVC_FIELDCATALOG_MERGE' using the structure created in step 3.

5. Loop at the field catalog internal table and when the field name is that of the field you need set the EDIT = 'X' in the field catalog.

eg.

data: I_FIELDCAT_ALV_LVC TYPE LVC_T_FCAT,

WA_FIELDCAT_ALV_LVC LIKE LINE OF I_FIELDCAT_ALV_LVC.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'ZTEST_DD' " ztest_dd contains the data element

" created in the data dictionary

CHANGING

ct_fieldcat = I_FIELDCAT_ALV_LVC.

LOOP AT I_FIELDCAT_ALV_LVC INTO WA_FIELDCAT_ALV_LVC.

CASE WA_FIELDCAT_ALV_LVC-FIELDNAME.

WHEN 'ZTEST1'.

WA_FIELDCAT_ALV_LVC-EDIT = 'X'.

ENDCASE.

MODIFY I_FIELDCAT_ALV_LVC FROM WA_FIELDCAT_ALV_LVC.

ENDLOOP.

6. That should work. It worked for me, so, I guess, it would work for you too.

Remember to capture the changes you need to hit save after you run the report and select a value from the drop down list. Then, you can code for whatever you want by checking the return code r_ucomm and then using the internal table used for output.

Thanks,

Rajesh