An Example of a ListBox Program

REPORT ZARJUN_LISTBOX .

TYPE-POOLS: VRM.

DATA: NAME  TYPE VRM_ID,
      LIST  TYPE VRM_VALUES,
      VALUE LIKE LINE OF LIST,
      c(20) type c.

*      c = 'select any'.

data:begin of itab occurs 0,
      kunnr like kna1-kunnr,
      name1 like kna1-name1,
     end of itab.

data:begin of jtab occurs 0,
      kunnr like kna1-kunnr,
      land1 like kna1-land1,
     end of jtab.

PARAMETERS: p_list(20) AS LISTBOX VISIBLE LENGTH 20
                          default 'SELECT'.

AT SELECTION-SCREEN OUTPUT.

NAME = 'p_list'.

VALUE-KEY = '1'.
VALUE-TEXT = 'Name'.
APPEND VALUE TO LIST.

VALUE-KEY = '2'.
VALUE-TEXT = 'Country'.
APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.

start-of-selection.
select kunnr name1 up to 20 rows from kna1 into table itab. select kunnr land1 up to 20 rows from kna1 into table jtab.

case p_list.
when '1'.
loop at itab.
write:/ itab-kunnr,itab-name1.
endloop.

when '2'.
loop at jtab.
write:/ jtab-kunnr,jtab-land1.
endloop.
endcase.

More Abapers Questions:

ABAP Books List
ABAP/4 Certification, Programming and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.