09-27-2007 11:25 AM
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.
09-27-2007 11:33 AM
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
09-28-2007 4:25 AM
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