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

Screen Painter

Former Member
0 Likes
548

Hi all,

How to give dropdown list or list box in screen.Give a simple program.

4 REPLIES 4
Read only

Manohar2u
Active Contributor
0 Likes
510

Refer this example program DEMO_DROPDOWN_LIST_BOX

Read only

Former Member
0 Likes
510

Hi,

check this example.

TYPE-POOLS: vrm.

PARAMETERS: p_test TYPE char4 AS LISTBOX VISIBLE LENGTH 10.

DATA: t_data TYPE vrm_values.

INITIALIZATION.

DATA: s_data TYPE vrm_value.

s_data-key = 'ABCD'.

s_data-text = 'First four'.

APPEND s_data TO t_data.

s_data-key = 'EFGHI'.

s_data-text = 'Second four'.

APPEND s_data TO t_data.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_TEST'

values = t_data

EXCEPTIONS

id_illegal_name = 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.

START-OF-SELECTION.

WRITE: / p_test.

Thanks,

Naren

Read only

Former Member
0 Likes
510

Hi,

For that field for which u want to attach the drop down list, u need to select the drop down list option in the screen field attributes also, then only u will be able to see drop down list. For coding refer to this program : demo_dropdown_list_box.

Read only

0 Likes
510

REPORT Z_DDLB.

DEFINE LB_MACRO_KOART.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(31) &3.

PARAMETERS: &1 AS LISTBOX VISIBLE LENGTH &2 OBLIGATORY.

SELECTION-SCREEN END OF LINE.

END-OF-DEFINITION.

************************************************************************

  • SELECTION-SCREEN *

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK S1 WITH FRAME TITLE TEXT-001.

LB_MACRO_KOART MYLIST(1) 5 COMMENT.

SELECTION-SCREEN END OF BLOCK S1.

************************************************************************

  • AT SELECTION - SCREEN

************************************************************************

AT SELECTION-SCREEN OUTPUT.

PERFORM ADD_VALUES_TO_KOART.

COMMENT = 'Account type'.

&----


*& Form ADD_VALUES_TO_KOART

&----


  • Fill the values in dropdownlistbox

----


FORM ADD_VALUES_TO_KOART .

TYPE-POOLS: VRM.

DATA: MY_LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF MY_LIST.

DATA : BEGIN OF I_TAB OCCURS 0,

KOART TYPE C,

END OF I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'A'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'D'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'K'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'M'.

APPEND I_TAB.

CLEAR I_TAB.

I_TAB-KOART = 'S'.

APPEND I_TAB.

CLEAR I_TAB.

&----


*& Filling the list structure with values from MARA table

&----


LOOP AT I_TAB.

VALUE-KEY = SY-TABIX.

VALUE-TEXT = I_TAB-KOART.

APPEND VALUE TO MY_LIST.

ENDLOOP.

&----


*& Finally calling the function module to create the list box.

&----


CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'MYLIST'

VALUES = MY_LIST.

ENDFORM. " ADD_VALUES_TO_KOART