SAP Tutorials Blog

 

 


REPORT ZLISTBOXPROGRAM.



TYPE-POOLS: VRM.


DATA: NAME  TYPE VRM_ID,

      LIST  TYPE VRM_VALUES,

      VALUE LIKE LINE OF LIST,

      c(20) type 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(20) AS 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.


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com