Google Search - Blog...........

ABAP - Drop Down List Box In The Selection Screen.


This code sample gives the idea about providing drop down list box in the Selection Screen.

The code has been tested under SAP R/3 Enterprise Release 4.70, mySAP Technology Components Release 6.20. It may also work under earlier versions with minor modifications
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



ALSO READ:

- Creating Dynamic F4 (Value On Request) Help.

- Express Select-Options Values In SY-LANGU.

- F4 (Value On Request) For Files On Presentation Or Application Server.

- Sample Program On Use Of Selection Screen.

- Creating Tab-Strip Selection Screen tab-strip Without Using SE51.

No comments:

Post a Comment