Wednesday, August 3, 2011

An Example of a ListBox Program

REPORT ZLISTBOXPROGRAM.


TYPE-POOLS: VRM.

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

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: option(20AS LISTBOX VISIBLE LENGTH 20
                          default 'SELECT'.

AT SELECTION-SCREEN OUTPUT.

NAME = 'option'.

VALUE-KEY = '1'.
VALUE-TEXT = 'Company'.
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 option.
WHEN '1'.
 LOOP AT itab.
  WRITE:/ itab-kunnr,itab-name1.
 ENDLOOP.

WHEN '2'.
 LOOP AT jtab.
  WRITE:/ jtab-kunnr,jtab-land1.
 ENDLOOP.
ENDCASE.

1 comment:

  1. Hi all,

    Iam taking a txt field txt50 which is containing many unwanted spaces between words in it. and i want to remove all unwanted spaces between words. Please tell me the solution it.

    ReplyDelete