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

ABAP OO Dropdownlist

Former Member
0 Likes
2,243

Hey Gurus,

Basically I have search through all but I could not find any examples on ABAP OO dropdown list. Is that possible? I have found a lot of examples where it attached to ALV Grid which its not what I want.

Currently I'm referring to this example:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/frameset.htm

Just wondering if this can also be achieved via OO.

Regards,

JC.

Hey Gurus,

Basically I have search through all but I could not find any examples on ABAP OO dropdown list. Is that possible? I have found a lot of examples where it attached to ALV Grid which its not what I want.

Currently I'm referring to this example:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/frameset.htm

Just wondering if this can also be achieved via OO.

Regards,

JC.

6 REPLIES 6
Read only

Former Member
0 Likes
1,289

Hi,

I am Posting Code which is already executed by me.

Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code

This will detailed explanation of Drop Down.

Warm Regards,

PavanKumar.G

Edited by: pavankumar.g on Dec 13, 2011 1:34 PM

Edited by: Rob Burbank on Dec 13, 2011 9:26 AM

Read only

Former Member
1,289

Hi,

Check this link: [Dropdowns in ALV (Using 'set_drop_down_table' method)|http://wiki.sdn.sap.com/wiki/display/Snippets/DropdownsinALV]

Hope this helps!

Reetesh

Read only

Former Member
0 Likes
1,289

Hi,

Yes you can achieve that thorugh cl_gui_alv_grids set_drop_down_table

Regards

Arshad

Read only

Former Member
0 Likes
1,289

Hi,

I am sending you the code for displaying drop down.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

I_STRUCTURE_NAME = 'ZDROP_CL'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_INTERNAL_TABNAME =

CHANGING

CT_FIELDCAT = P_T_FCAT

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

  • PROGRAM_ERROR = 2

  • OTHERS = 3

.

LOOP AT P_T_FCAT INTO S_FCAT.

IF S_FCAT-FIELDNAME = 'LAND1'.

S_FCAT-EDIT = 'X'.

S_FCAT-DRDN_FIELD = 'DROP_DOWN_LIST'.

MODIFY P_T_FCAT FROM S_FCAT.

ENDIF.

ENDLOOP.

ENDFORM. " BUILD_FCAT

&----


*& Form DROP_DOWN

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DROP_DOWN .

S_DROP-HANDLE = 1.

S_DROP-VALUE = 'US'.

APPEND S_DROP TO T_DROP.

S_DROP-HANDLE = 1.

S_DROP-VALUE = 'DS'.

APPEND S_DROP TO T_DROP.

S_DROP-HANDLE = 1.

S_DROP-VALUE = 'FR'.

APPEND S_DROP TO T_DROP.

CALL METHOD GRID->SET_DROP_DOWN_TABLE

EXPORTING

IT_DROP_DOWN = T_DROP

  • IT_DROP_DOWN_ALIAS =

.

ENDFORM. " DROP_DOWN

&----


*& Form BUILD_DATA

&----


  • text

----


  • <--P_GT_OUTTAB text

----


FORM BUILD_DATA CHANGING P_GT_OUTTAB TYPE STANDARD TABLE.

DATA: S_TYPE TYPE ZDROP_CL,

T_TYPE TYPE STANDARD TABLE OF ZDROP_CL.

DATA: T_OUTTAB TYPE TY_KNA1.

SELECT KUNNR LAND1 NAME1 FROM KNA1 INTO TABLE T_TYPE

WHERE KUNNR IN CUSTOMER.

LOOP AT T_TYPE INTO S_TYPE.

MOVE-CORRESPONDING S_TYPE TO T_OUTTAB.

T_OUTTAB-DROP_DOWN_LIST = 1.

append T_OUTTAB to P_GT_OUTTAB.

  • MODIFY P_GT_OUTTAB FROM T_OUTTAB transporting DROP_DOWN_LIST.

clear T_OUTTAB.

clear S_TYPE.

ENDLOOP.

ENDFORM. " BUILD_DATA

Warm Regards,

PavanKumar.G

Read only

former_member226225
Contributor
0 Likes
1,289

hi.

I am postimg the method for dropdown list in alv grid

here we have one method SET_DROP_DOWN_TABLE of class CL_GUI_ALV_GRID

and we have one parameter IT_DROPDOWN of type LVC_T_DROP and

prepare the internal table of lvc_t_drop and call the method

attach these the internal table to IT_DROPDOWN.

Read only

former_member226225
Contributor
1,289

Hi ,

in the fieldcatalog level make the necessary changes.

ls_fcat-fieldname = 'COURSE'.

ls_fcat-col_pos = 5.

ls_fcat-coltext = 'Course'.

ls_fcat-outputlen = 10.

ls_fcat-DRDN_HNDL = 25.

ls_fcat-edit = 'X'.

APPEND ls_fcat to lt_fcat.

and after that call the method

set_drop_down_table of cl_gui_alv_grid

and it is having the parameter it_dropdown of type lvc_t_fcat

and prepare the internal table

clear ls_drop.

ls_drop-handle = '25'.

ls_drop-value = 'ABAP'.

append ls_drop to lt_drop.

clear ls_drop.

ls_drop-handle = '25'.

ls_drop-value = 'CRM'.

append ls_drop to lt_drop.

clear ls_drop.

ls_drop-handle = '25'.

ls_drop-value = 'WEBDYNPRO'.

append ls_drop to lt_drop.

and call the method

CALL METHOD o_grid->set_drop_down_table

EXPORTING

it_drop_down = lt_drop.

Thanks and Regards,

Raghunadh.K