Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
pepl
Active Participant

Hola,

Today I'm going to share with you some tiny class that can save up much time when you develop something rapidly.

For those guys who accepts generic programming it will be a good present as well.

So with the help of the class CL_CI_QUERY_ATTRIBUTES we can raise a screen like this:

with the code like this:


report ztest_generic_screen.
start-of-selection.
  perform main.
form main.
  data: lv_bukrs type bukrs,
        " select-options: type range of.. (must be dictionary type)
        lrg_werks type ckf_werks_table,
        " select-options: table, separate values
        lt_werks TYPE plants ,
        " checkbox + radiobutton ( must be DDIC types )
        lv_simulate type xfeld,
        lv_mode_open type xfeld,
        lv_mode_close type xfeld,
        lv_language TYPE spras.
  lv_language = sy-langu.
  " Generic screen call
  cl_ci_query_attributes=>generic(
    exporting
      " unique screen ID
      p_name       = conv #( sy-repid )
      " Screen title
      p_title      = 'Generic screen for input'
      " Screen fields
      p_attributes = value #(
        " parameter field
       ( kind = 'S'
         obligatory = abap_true
         text = 'Company code'(001)
         ref = ref #( lv_bukrs ) )
       " select-option
       ( kind = 'S'
         text = 'Plant'(002)
         ref = ref #( lrg_werks ) )
       " selec-option no intervals
       ( kind = 'T'
         text = 'Additional plants'(008)
         ref = ref #( lt_werks ) )
       " Screen groupd
       ( kind = 'G'
         text = 'Mode'(006)
         ref = ref #( SY-INDEX ) )
       " radiobuttons
       ( kind = 'R'
         text = 'Open'(004)
         button_group = 'MOD'
         ref = ref #( lv_mode_open ) )
       ( kind = 'R'
         text = 'Close'(005)
         button_group = 'MOD'
         ref = ref #( lv_mode_close ) )
       " checkbox field
       ( kind = 'C'
         text = 'Simulate'(003)
         ref = ref #( lv_simulate ) )
       " listbox field
       ( kind = 'L'
         text = 'Language'(007)
         ref = ref #( lv_language ) )
       )    " Table of Attribute Entries
      p_display    = abap_false    " General Flag
  ).
endform.

As you see we can use checkboxes, radiobuttons, listboxes, screen groups, obligatory option.

I don't pretend this class to be used in serious programs, as of course only screens provide all the necessary stuff.

But if we speak about some simple screen to be raised from the class - this is kind of a fast solution avoiding screen and GUI status creation.

Good Luck,

I hope you liked it!

Adios.

18 Comments