Application Development 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: 

list box

Former Member
0 Kudos
307

HOW TO DECLARE LIST BOX??

AND HOW CAN I ADD OPTIONS TO THAT LIST BOX

??

6 REPLIES 6

Former Member
0 Kudos
143

PARAMETERS - screen_options

Syntax

... { {[OBLIGATORY|NO-DISPLAY] [VISIBLE LENGTH vlen]}

| {AS CHECKBOX [USER-COMMAND fcode]}

| {RADIOBUTTON GROUP group [USER-COMMAND fcode]}

| {AS LISTBOX VISIBLE LENGTH vlen [USER-COMMAND fcode]

[OBLIGATORY]} }

[MODIF ID modid] ... .

Extras:

1. ... OBLIGATORY

2. ... NO-DISPLAY

3. ... VISIBLE LENGTH vlen

4. ... AS CHECKBOX [USER-COMMAND fcode]

5. ... RADIOBUTTON GROUP group [USER-COMMAND fcode]

6. ... AS LISTBOX VISIBLE LENGTH vlen [USER-COMMAND fcode]

7. ... MODIF ID modid

Effect:

These additions can be used to declare the input field as a required field, hide the input field on the selection screen, and determine the visible length of the field. The input field can be displayed as a checkbox, radio button, or dropdown list box. All screen elements of the parameter can be assigned to a modification group.

Note:

The additions cannot be combined in just any combinations. The syntax above shows the permitted combinations.

Addition 1

... OBLIGATORY

Effect:

This addition defines the input field of the parameter on the selection screen as a required field. If no entry is made in this field, the user cannot use the Execute function (F8) to exit the selection screen, the user can only use the functions Back, Exit, or Cancel.

Addition 2

... NO-DISPLAY

Effect:

This addition means that no screen elements are generated for the parameter on the selection screen. In an executable program, a parameter of this type is exclusively a part of the interface defined by the selection screen. It can be supplied with a value by the calling program when called with SUBMIT.

If the addition NO-DISPLAY is specified, a parameter can have any data types except for reference types. These parameters can only be populated using the WITH addition to the SUBMIT statement. In this case, in contrast to the general conversion rule for deep types, the same rules apply as when importing data from a data cluster.

Note:

The length of a value transferred to a parameter for which there is no input field, is not subject to the 132 character restriction that applies for parameters with input fields.

Addition 3

... VISIBLE LENGTH vlen

Effect:

This addition defines the visible length of the input field as vlen, whereby vlen is entered directly as a positive number. If vlen is smaller than the length of the parameter and smaller than the maximum visible length, the input field is displayed in the length defined in vlen, with movable content. Otherwise, the addition is ignored.

Addition 4

... AS CHECKBOX [USER-COMMAND fcode]

Effect:

This addition specifies that the input field in the first position of the selection screen is displayed as a checkbox with the corresponding description next to it on the right. The checkbox is selected if the value of para is "X" or r "x". Otherwise, it is not selected.

The parameter must be created with the type c and length 1. An explicit length len is not permitted. If the addition TYPE is used, this can only be followed by the generic type c or a non-generic data type of type c and length 1.

The addition USER-COMMAND can be used to assign a function code fcode to the parameter. The function code fcode must be directly specified and may have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects the checkbox on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields. If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.

Notes

If the TYPE addition is used to make a reference to a data type in the ABAP Dictionary of type CHAR and length 1, and for which t the valid values in the domain are defined as "X" and " ", the parameter is automatically displayed as a checkbox on the selection screen.

If the addition USER-COMMAND is specified without the addition AS CHECKBOX, and the parameter is of type c with length 1, it is also displayed as a checkbox.

The addition USER-COMMAND can, for example, be used for screen modifications with the addition MODIF ID (see example).

Addition 5

... RADIOBUTTON GROUP group [USER-COMMAND fcode]

Effect:

This addition specifies that the input field is displayed as a radio button in the first position on the selection screen, and the output field is displayed next to it on the right. The radio button is selected if the value of para is "X" or "x". Otherwise, it is not selected.

group is used to define the radio button group for the parameter. The name group is entered directly as a character string with a maximum of 4 characters. Within a selection screen, there must be a minimum of two parameters in the same radio button group. There cannot be more than one radio button group with the same name in one program, even if they are defined in different selection screens.

The parameter must be specified with the type c and length 1. Explicit length specification using len is not permitted. If the addition TYPE is used, it can only be followed by the generic type c or a non-generic data type of type

In a radio button group, only one parameter can be defined with the addition DEFAULT, and the specified value must be "X". By default, the first parameter in a radio button group is set to the value "X", and the rest are set to " ".

The addition USER-COMMAND can be used to assign a function code fcode to the first parameter in a radio button group. The function code fcode must be specified directly, and have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects any radio button of the radio button group on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields. If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.

Note:

It is recommended to define the radio buttons of a radio button group directly underneath each other. If the selection screen also contains other elements, it is recommended to define each radio button group within a block surrounded by a frame.

Addition 6

... AS LISTBOX VISIBLE LENGTH vlen [USER-COMMAND fcode]

Effect:

This addition generates a dropdown list box for an input field on the selection screen. If the parameter is created with a data type from the ABAP Dictionary, and the data type is linked to the input help in the Dictionary, the first column of the input help is displayed in the list box. Otherwise, a single-line list box is displayed containing the current value of the parameter.

The addition VISIBLE LENGTH must be used to specify the visible length of the input field. The explicit specification of the length is necessary as the length of the entries in the list box is usually different to the actual length of the parameter.

The addition USER-COMMAND can be used to assign a function code fcode to the dropdown list box. The function code fcode must be specified directly and can have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects a line of the list box on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields. If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.

Note:

Without the addition USER-COMMAND, selecting a line in the dropdown list box does not lead to the event AT SELECTION-SCREEN.

Example:

The parameter p_carrid is displayed with length 20 and with the name "Lufthansa" already entered. The user can select a different airline carrier, in which case a three-character abbreviation is assigned to the parameter. When assigning the function code onli which is assigned to the function Execute in the GUI status of the default selection screen, the events AT SELECTION-SCREEN and START-OF-SELECTION are triggered.

PARAMETERS p_carrid TYPE spfli-carrid

AS LISTBOX VISIBLE LENGTH 20

USER-COMMAND onli

DEFAULT 'LH'.

AT SELECTION-SCREEN.

...

START-OF-SELECTION.

...

Addition 7

... MODIF ID modid

Effect

The addition MODIF ID assigns all the screen elements of the parameter to the modification group modid, which is assigned to the column group1 of the system table screen. This enables them to be modified before the selection screen is displayed, using the statement MODIFY SCREEN. The name of the modification group modid must be directly specified and can have a maximum length of three characters.

Note

The modification groups that are assigned to columns group2 and group3 of the system table screen are set when the system generates a selection screen and are described in the screen elements of a selection screen.

Example:

The elements of block b2 are assigned to the modification group bl2. A checkbox show_all allows the user to select whether or not these elements are displayed. The display is changed immediately, as selecting the checkbox triggers the event AT SELECTION-SCREEN. The function code is not required. Instead, the content of show_all is evaluated during PBO.

PARAMETERS show_all AS CHECKBOX USER-COMMAND flag.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS: p1 TYPE c LENGTH 10,

p2 TYPE c LENGTH 10,

p3 TYPE c LENGTH 10.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

PARAMETERS: p4 TYPE c LENGTH 10 MODIF ID bl2,

p5 TYPE c LENGTH 10 MODIF ID bl2,

p6 TYPE c LENGTH 10 MODIF ID bl2.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF show_all <> 'X' AND

screen-group1 = 'BL2'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Former Member
0 Kudos
143

Hi,

a)PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.

b) Fm VRM_SET_VALUES

.

REPORT abc.

TYPE-POOLS : vrm.

DATA : v TYPE vrm_values.

DATA : vw LIKE LINE OF v.

PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.

INITIALIZATION.

vw-key = '1'.

vw-text = 'Jan'.

APPEND vw TO v.

vw-key = '2'.

vw-text = 'Feb'.

APPEND vw TO v.

vw-key = '3'.

vw-text = 'Mar'.

APPEND vw TO v.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'A'

values = v

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

Regards,

Omkar.

Former Member
0 Kudos
143

refer this program...

--


list box for p_pernr--

type-pools : VRM.

tables : pa0000.

parameters : p_pernr like pa0000-pernr as listbox visible length 10 obligatory.

initialization.

data: v_id type vrm_id,

i_list type vrm_values,

wa_list like line of i_list.

v_id = 'P_PERNR'.

wa_list-key = '1'.

wa_list-text = '10000174'.

append wa_list to i_list.

wa_list-key = '2'.

wa_list-text = '10000175'.

append wa_list to i_list.

wa_list-key = '3'.

wa_list-text = '10000176'.

append wa_list to i_list.

p_pernr = '2'. "to set default value 10000175

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = v_id

values = i_list

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.

----


----


populating list box for second field -

---based on value selected in listbox for first field--


type-pools : vrm.

tables : pa0000,pa0001,sscrfields.

data : begin of it_0000 occurs 0,

pernr like pa0000-pernr,

end of it_0000.

data : begin of it_0001 occurs 0,

pernr like pa0000-pernr,

bukrs like pa0001-bukrs,

end of it_0001.

data : itab type VRM_VALUE.

data : vid type vrm_id.

data : itab1 type VRM_VALUEs ,

itab2 type VRM_VALUEs .

data : flag.

parameters : p_pernr like pa0000-pernr as listbox visible length 10 user-command ucom,

p_bukrs like pa0001-bukrs as listbox visible length 18.

initialization.

select pernr from pa0000 up to 10 rows into table it_0000 WHERE pernr LIKE '%173%'. “similar to CS ‘173’

loop at it_0000.

itab-key = it_0000-pernr.

itab-text = it_0000-pernr.

append itab to itab1.

endloop.

vid = 'P_PERNR'.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = vid

values = itab1

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.

at selection-screen output.

if flag = 'X'.

REFRESH ITAB2.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = P_PERNR

IMPORTING

OUTPUT = P_PERNR

.

select pernr bukrs from pa0001 into table it_0001 where pernr = p_pernr.

loop at it_0001.

itab-key = it_0001-bukrs.

itab-text = it_0001-bukrs.

append itab to itab2.

endloop.

vid = 'P_BUKRS'.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = vid

values = itab2

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.

clear flag.

endif.

at selection-screen.

case sy-ucomm.

when 'UCOM'.

flag = 'X'.

endcase.

Former Member
0 Kudos
143

DATA: name TYPE vrm_id,
      list TYPE vrm_values,
      value LIKE LINE OF list.

AT SELECTION-SCREEN OUTPUT.
  name = 'P_FRWD'.
  value-key = '07'.
  value-text = '7 weeks'.
  APPEND value TO list.
  value-key = '06'.
  value-text = '6 weeks'.
  APPEND value TO list.
  value-key = '05'.
  value-text = '5 weeks'.
  APPEND value TO list.
  value-key = '04'.
  value-text = '4 weeks'.
  APPEND value TO list.
  value-key = '03'.
  value-text = '3 weeks'.
  APPEND value TO list.
  value-key = '02'.
  value-text = '2 weeks'.
  APPEND value TO list.
  value-key = '01'.
  value-text = '1 week'.
  APPEND value TO list.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = name
      values = list.

Former Member
0 Kudos
143

Hi Madan Mohan,

After answered to your question, you just have to give reward points , to give reward points left side there are three rdio buttons are there just click appropriate one. By giving points your are going to encouraging the people, so they will help more.

paruchuri_nagesh
Active Contributor
0 Kudos
143

hi

REPORT ZLIST.

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 = 'JAI'.

APPEND VALUE TO LIST.

VALUE-KEY = '2'.

VALUE-TEXT = 'SRI'.

APPEND VALUE TO LIST.

NAME = 'PS_PARM'.

VALUE-KEY = '3'.

VALUE-TEXT = 'SAI'.

APPEND VALUE TO LIST.

NAME = 'PS_PARM'.

VALUE-KEY = '4'.

VALUE-TEXT = 'RAM'.

APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

START-OF-SELECTION.

WRITE: / 'Parameter:', PS_PARM.

regards

Nagesh.Paruchuri