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

Drop down values.

Former Member
0 Likes
1,031

Hi all,

My requirement is I have created two subscreens for a standard transaction.

I have created these in screen painter

I have a field Vendor Type in which its has a drop down with 3 values in it & when click on drop down it looks like:

01| Normal vendor

02| Non-PAN vendors

03| Credit Card holders.

These two columns must be available in the drop down. Any inputs will be appreciated.

Thanks in advance,

Rajkamal.

8 REPLIES 8
Read only

Former Member
0 Likes
984

Hi,

Try this link...

Regards

Guru

Read only

Former Member
0 Likes
984

Hi,

Try this link

Regards

Guru

Edited by: Guru  Prasad on Sep 2, 2008 2:55 PM

Read only

Former Member
0 Likes
984

This example will help you in retrieving values from list box.

DATA: g_name1 TYPE vrm_id,

g_list1 TYPE vrm_values,

g_wa_list LIKE LINE OF g_list1,

g_value_1 LIKE LINE OF g_list1.

DATA: g_status(20) TYPE c.

CONSTANTS: c_status TYPE string VALUE 'G_STATUS',

c_to_be_sub TYPE string VALUE 'TO BE SUBMITTED',

c_sub TYPE string VALUE 'SUBMITTED',

c_chg_needed TYPE string VALUE 'CHANGE NEEDED',

c_app TYPE string VALUE 'APPROVED'.

In PBO we populate list box.

MODULE f4_scr OUTPUT.

REFRESH g_list1.

g_name1 = c_status.

g_value_1-key = c_to_be_sub.

g_value_1-text = c_to_be_sub.

APPEND g_value_1 TO g_list1.

g_value_1-key = c_sub.

g_value_1-text = c_sub.

APPEND g_value_1 TO g_list1.

g_value_1-key = c_chg_needed.

g_value_1-text = c_chg_needed.

APPEND g_value_1 TO g_list1.

g_value_1-key = c_app.

g_value_1-text = c_app.

APPEND g_value_1 TO g_list1.

IF NOT g_list1 IS INITIAL.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = g_name1

values = g_list1.

ENDIF.

ENDMODULE. " F4_SCR OUTPUT

*Function module to get the list box values. * we write this code in PAI

MODULE user_command_9000 INPUT.

g_name1 = c_status.

CALL FUNCTION 'VRM_GET_VALUES'

EXPORTING

id = g_name1

IMPORTING

values = g_list1

EXCEPTIONS

id_not_found = 1

OTHERS = 2.

IF sy-subrc 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

READ TABLE g_list1 INTO g_wa_list WITH KEY key = g_status.

IF sy-subrc EQ 0.

g_status = g_wa_list-text.

ENDIF.

ENDMODULE.

This will surely help to retrieve the values from list box.

Read only

Former Member
0 Likes
984

Hi,

Iam giving you the code for DROP DOWN BOX. Hope this would be helpful for you.

report zBCALV_EDIT_01.

TABLES:bkpf.

PARAMETERS: p_bukrs type bukrs,

p_gjahr type gjahr.

select-options:so_belnr for bkpf-belnr.

DATA: ok_code LIKE sy-ucomm,

save_ok like sy-ucomm,

container TYPE scrfname VALUE 'CONT',

grid TYPE REF TO cl_gui_alv_grid,

g_custom_container TYPE REF TO cl_gui_custom_container,

lt_f4 type lvc_t_f4 with header line,

gs_layout TYPE lvc_s_layo,

g_max type i value 100.

types:begin of ty_bkpf,

bukrs type bukrs,

belnr type belnr_d,

gjahr type gjahr,

monat type monat,

Waers type waers,

end of ty_bkpf.

data:wa_bkpf type ty_bkpf,

it_bkpf type standard table of ty_bkpf,

it_catalog type standard table of lvc_s_fcat, " with header line.

wa_catalog type lvc_s_fcat.

*----


*

  • MAIN *

*----


*

start-of-selection.

CREATE OBJECT g_custom_container

EXPORTING container_name = container.

CREATE OBJECT grid

EXPORTING i_parent = g_custom_container.

perform populate_catalog.

perform make_it_f4.

perform set_drdn_table.

select bukrs

belnr

gjahr

monat

waers

from bkpf

into table it_bkpf

where bukrs = p_bukrs and

belnr in so_belnr and

gjahr = p_gjahr.

.

if not sy-subrc eq 0.

message e005(zmsg).

endif.

CALL SCREEN 100." starting at 1 1..

*----


*

  • MODULE PBO OUTPUT *

*----


*

MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

set TITLEBAR 'MAIN100'.

CALL METHOD grid->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

I_SAVE = 'A'

  • I_DEFAULT = 'X'

IS_LAYOUT = gs_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = it_bkpf

IT_FIELDCATALOG = it_catalog.

if sy-subrc ne 0.

message e009(zmsg).

endif.

  • Set editable cells to ready for input initially

CALL METHOD grid->set_ready_for_input

EXPORTING

I_READY_FOR_INPUT = 1.

clear lt_f4.

lt_f4-fieldname = 'WUNIT'.

lt_f4-register = 'X'.

append lt_f4.

ENDMODULE.

*----


*

  • MODULE PAI INPUT *

*----


*

MODULE pai INPUT.

save_ok = ok_code.

clear ok_code.

CASE save_ok.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN 'SWITCH'.

PERFORM switch_edit_mode.

WHEN OTHERS.

  • do nothing

ENDCASE.

ENDMODULE.

*----


*

  • FORM EXIT_PROGRAM *

*----


*

FORM exit_program.

LEAVE PROGRAM.

ENDFORM.

*&----


*

*& Form SWITCH_EDIT_MODE

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM switch_edit_mode.

*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.

IF grid->is_ready_for_input( ) EQ 0.

*§4.Use SET_READY_FOR_INPUT to switch between the substates.

CALL METHOD grid->set_ready_for_input

EXPORTING i_ready_for_input = 1.

ELSE.

CALL METHOD grid->set_ready_for_input

EXPORTING i_ready_for_input = 0.

ENDIF.

ENDFORM. " SWITCH_EDIT_MODE

*&----


*

*& Form populate_catalog

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form populate_catalog .

*Company code

wa_catalog-col_pos = 1.

wa_catalog-coltext = 'Comp Code'.

wa_catalog-tabname = 'BKPF'. "'it_bkpf'.

wa_catalog-fieldname = 'BUKRS'.

append wa_catalog to it_catalog.

clear wa_catalog.

*Document number

wa_catalog-col_pos = 2.

wa_catalog-coltext = 'Doc Number'.

wa_catalog-tabname = 'BKPF'. "'it_bkpf'.

wa_catalog-fieldname = 'BELNR'.

append wa_catalog to it_catalog.

clear wa_catalog.

*FISCAL YEAR

wa_catalog-col_pos = 3.

wa_catalog-coltext = 'Fiscal Year'.

wa_catalog-tabname = 'BKPF'. "'it_bkpf'.

wa_catalog-fieldname = 'GJAHR'. "'gjahr'.

append wa_catalog to it_catalog.

clear wa_catalog.

*Fiscal Month

wa_catalog-col_pos = 4.

wa_catalog-coltext = 'Fiscal Month'.

wa_catalog-tabname = 'it_bkpf'. "'BKPF'. ".

wa_catalog-fieldname = 'MONAT'. "'mondat'.

wa_catalog-col_pos = 5.

wa_catalog-coltext = 'Currency'.

wa_catalog-tabname = 'it_bkpf'. "'BKPF'. ".

wa_catalog-fieldname = 'WAERS'.

append wa_catalog to it_catalog.

clear wa_catalog.

endform. " populate_catalog

*&----


*

*& Form make_it_f4

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form make_it_f4 .

clear wa_catalog.

loop at it_catalog into wa_catalog.

if wa_catalog-fieldname eq 'WAERS'.

*§2.Set status of column WUNIT to editable and set a dropdown handle.

wa_catalog-edit = 'X'.

wa_catalog-drdn_hndl = '1'.

wa_catalog-outputlen = 3.

  • Field 'checktable' is set to avoid shortdumps that are caused

  • by inconsistend data in check tables. You may comment this out

  • when the test data of the flight model is consistent in your system.

wa_catalog-checktable = '!'. "do not check foreign keys

modify it_catalog from wa_catalog.

endif.

endloop.

endform. " make_it_f4

*&----


*

*& Form set_drdn_table

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

form set_drdn_table .

data: lt_dropdown type lvc_t_drop,

ls_dropdown type lvc_s_drop.

  • First listbox (handle '1').

ls_dropdown-handle = '1'.

ls_dropdown-value = 'EUR'.

append ls_dropdown to lt_dropdown.

ls_dropdown-handle = '1'.

ls_dropdown-value = 'INR'.

append ls_dropdown to lt_dropdown.

call method grid->set_drop_down_table

exporting it_drop_down = lt_dropdown.

endform. " set_drdn_table

Regards,

Deepthi Dandibhotla.

Read only

Former Member
0 Likes
984

Hi,

VRM_SET_VALUES is used to display list of values for drop down field.

Please go thru the following code for better understanding.

TYPE-POOLS: VRM.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

PARAMETERS: PS_PARM(10) AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

NAME = 'PS_PARM'.

VALUE-KEY = '1'.

VALUE-TEXT = 'LINE 1'.

APPEND VALUE TO LIST. VALUE-KEY = '2'.

VALUE-TEXT = 'LINE 2'.

APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Regards,

Shalini

Read only

Former Member
0 Likes
984

Please do not cross-post to mutliple forums! It cannot be excluded that all posts will be deleted.

Many thanks,

Julius

Read only

0 Likes
984

Hello Julius,

I realised that I have posted my question in wrong forum (Performance Tuning) after submitting the question.. that is the reason I have unmarked as a question... After unmarking, I posted the same in General forum.

Regards,

Rajkamal.

Read only

0 Likes
984

Okay. I deleted the other one.

Cheers,

Julius