Parameter as LIST BOX
Dropdown list is a user interface element which displays a list of values from which a user can select one value. Follow the below steps to create a dropdown list in SAP ABAP selection screen.
- First build the list in the INITIALIZATION event.
- Capture the value selected by the user from the list in the AT SELECTION-SCREEN event or keep all selected value in the INITIALIZATION event.
- Use the selected value for further processing.
TYPE-POOLS: VRM.
DATA: GV_PLIST TYPE VRM_ID,
GT_PLIST TYPE VRM_VALUES,
GS_PLIST LIKE LINE OF GT_PLIST.
DATA: GV_PLIST TYPE VRM_ID,
GT_PLIST TYPE VRM_VALUES,
GS_PLIST LIKE LINE OF GT_PLIST.
PARAMETERS: P_STATUS AS LISTBOX VISIBLE LENGTH 25 OBLIGATORY.
INITIALIZATION.
* Built Status Parameter
GV_PLIST = 'P_STATUS'.
BUILT_STATUS_PARAMETER 'A' 'PO Cancelled'.
BUILT_STATUS_PARAMETER 'B' 'Document Cancelled'.
BUILT_STATUS_PARAMETER 'C' 'Waiting for GR'.
BUILT_STATUS_PARAMETER 'D' 'Waiting for Invoice'.
BUILT_STATUS_PARAMETER 'E' 'Paid'.
BUILT_STATUS_PARAMETER 'F' 'Waiting for Payment'.
BUILT_STATUS_PARAMETER 'G' 'Return Delivery Document'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = GV_PLIST
VALUES = GT_PLIST
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
GV_PLIST = 'P_STATUS'.
BUILT_STATUS_PARAMETER 'A' 'PO Cancelled'.
BUILT_STATUS_PARAMETER 'B' 'Document Cancelled'.
BUILT_STATUS_PARAMETER 'C' 'Waiting for GR'.
BUILT_STATUS_PARAMETER 'D' 'Waiting for Invoice'.
BUILT_STATUS_PARAMETER 'E' 'Paid'.
BUILT_STATUS_PARAMETER 'F' 'Waiting for Payment'.
BUILT_STATUS_PARAMETER 'G' 'Return Delivery Document'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = GV_PLIST
VALUES = GT_PLIST
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
START-OF-SELECTION.
....................................................
END-OF-SELECTION.
DEFINE BUILT_STATUS_PARAMETER.
CLEAR GS_PLIST.
GS_PLIST-KEY = &1.
GS_PLIST-TEXT = &2.
APPEND GS_PLIST TO GT_PLIST.
END-OF-DEFINITION.
CLEAR GS_PLIST.
GS_PLIST-KEY = &1.
GS_PLIST-TEXT = &2.
APPEND GS_PLIST TO GT_PLIST.
END-OF-DEFINITION.
Comments
Post a Comment