Penggunaan Function Key pada Selection Screen

Terkadang aja spec yang meminta agar program di awal, saat selection screen, menampilkan pushbutton atau icon yg bisa ditekan. untuk itu digunakanlah yang namanya function key dalam selection screen.

Berikut ini adalah contoh penggunaan function key dalam program agar bisa menampilkan push button menu pada selection screen.

TABLES : marc, sscrfields.

*&---------------------------------------------------------------------*
* DATAS DECLARATION
*&---------------------------------------------------------------------*
DATA: ld_smp_dyntxt1 LIKE smp_dyntxt,
      ld_smp_dyntxt2 LIKE smp_dyntxt.

*&---------------------------------------------------------------------*
* SELECTION SCREEN
*&---------------------------------------------------------------------*
SELECTION-SCREEN: FUNCTION KEY 1,
                  FUNCTION KEY 2.
SELECTION-SCREEN BEGIN OF BLOCK blok_1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_matnr FOR marc-matnr.
SELECTION-SCREEN END OF BLOCK blok_1.

*&---------------------------------------------------------------------*
* EVENTS
*&---------------------------------------------------------------------*
INITIALIZATION.
  PERFORM f_init.

AT SELECTION-SCREEN.
  PERFORM f_screen.

*&---------------------------------------------------------------------*
*&      Form  F_INIT
*&---------------------------------------------------------------------*
FORM f_init .
  ld_smp_dyntxt1-text    = 'Change'.
  ld_smp_dyntxt1-icon_id = '@0Z@'.
  ld_smp_dyntxt2-text    = 'Save'.
  ld_smp_dyntxt2-icon_id = '@2L@'.
  sscrfields-functxt_01 = ld_smp_dyntxt1.
  sscrfields-functxt_02 = ld_smp_dyntxt2.
ENDFORM.                    " F_INIT

*&---------------------------------------------------------------------*
*&      Form  F_SCREEN
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  > do something
    WHEN 'FC02'.
*-------->> do something
  ENDCASE.

ENDFORM.                    " F_SCREEN

Hasil dari code ini adalah seperti gambar berikut ini :

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s