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: 

drop-down

Former Member
0 Kudos

Hi,

I got a requirement that to add drop-down to user defined fields in the cj01 tcode.

how can i add drop-down option to the fields.Can any one help me with the steps.

2 REPLIES 2

Former Member
0 Kudos

Hi

Look at the example Program DEMO_DYNPRO_DROPDOWN_LISTBOX

The same thing you can do it in the Table control also, first put the field as List box(from the Attributes), then in the PBO event of that screen, fill the values in that field.

Try with this sample report:

REPORT demo_dynpro_dropdown_listbox.

TYPE-POOLS vrm.

DATA: name TYPE vrm_id,

list TYPE vrm_values,

value LIKE LINE OF list.

DATA: wa_spfli TYPE spfli,

ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

TABLES demof4help.

name = 'DEMOF4HELP-CONNID'.

CALL SCREEN 100.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE init_listbox OUTPUT.

CLEAR demof4help-connid.

SELECT connid cityfrom cityto deptime

FROM spfli

INTO CORRESPONDING FIELDS OF wa_spfli

WHERE carrid = demof4help-carrier2.

value-key = wa_spfli-connid.

WRITE wa_spfli-deptime TO value-text USING EDIT MASK '__:__:__'.

CONCATENATE value-text

wa_spfli-cityfrom

wa_spfli-cityto

INTO value-text SEPARATED BY space.

APPEND value TO list.

ENDSELECT.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list.

ENDMODULE.

MODULE user_command_100.

save_ok = ok_code.

CLEAR ok_code.

IF save_ok = 'CARRIER' AND NOT demof4help-carrier2 IS INITIAL.

LEAVE TO SCREEN 200.

ELSE.

SET SCREEN 100.

ENDIF.

ENDMODULE.

MODULE user_command_200.

save_ok = ok_code.

CLEAR ok_code.

IF save_ok = 'SELECTED'.

MESSAGE i888(sabapdocu) WITH text-001 demof4help-carrier2

demof4help-connid.

ENDIF.

ENDMODULE.

reward if usefull

former_member196299
Active Contributor
0 Kudos

hi Jyoti ,

Naresh has given a very nice example .

If you need few more samples then please go through the transaction ABAPDOCU .there you can see few more examples for creating the dropdown lists .

Regards,

Ranjita