Here is the simple for creating listbox with macros.
Please check it first and let me know if there is any thing needed .
REPORT Zmac_listbox.
TYPE-POOLS: VRM.
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'.
*&---------------------------------------------------------------------*
* Fill the values in dropdownlistbox
*----------------------------------------------------------------------*
FORM ADD_VALUES_TO_KOART .
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:
- Restrict Values For The F4 (Value On Request) Help.
- Screen Field Validation Using Chain Endchain.
- Drop Down List Box In The Selection Screen.
- Creating Dynamic F4 (Value On Request) Help.
- Express Select-Options Values In SY-LANGU.
No comments:
Post a Comment