Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
jrgkraus
Active Contributor
355

Collection of tools for the classic dynpro UI of SAP

The provided class ZCL_UITOOLS can be used via inheritance or as an instance.

Manipulate screen fields in PBO

Instead of using loop at screen., you can now use the following calls to influence on the screen behaviour. The following examples are based on a class that inheritates from ZCL_UITOOLS

" hide a field by group or name
group( 'GR1' )->hide( ).
field( 'MATNR' )->hide( ).
" hide a selection or a parameter of a report screen
selection( 'S_MATNR' )->hide( ).
" set fields to no-input
group( 'GR1' )->set_noinput( ).
field( 'MATNR' )->set_noinput( ).
" make a field obligatory
group( 'GR1' )->set_required( ).
field( 'MATNR' )->set_required( ).
 

Set dropdown values in PBO

Using the field( ) method, you can set dropdown values for a list box

  field( 'GROUPNR' )->set_dropdown_values(
    value #(
      ( key = '1' text = 'First group' )
      ( key = '2' text = 'Second group' )
      ( key = '3' text = 'Third group' )
      ( key = '4' text = 'Forth group' ) ) ).
 

Simple Yes/No (/Cancel) queries

The methods ask( ) and ask_with_cancel( ) provide a simple interface to POPUP_TO_CONFIRM

if ask( question = 'Is this OK?' ).
  message 'OK' type 'I'.
else.
  message 'not OK' type 'I'.
endif.
" version that displays also a cancel button
try.
    if ask_with_cancel( question = 'Is this OK?' ).
      message 'OK' type 'I'.
    else.
      message 'not OK' type 'I'.
    endif.
  catch zcx_uitools_user_cancelled into data(e).
    message e type 'I' display like 'E'.
endtry.
 

Both methods provide also an optional parameter LONGTEXT where you can pass a longtext object created with SE61

Demo report

Explore ZP_UITOOLS_DEMO to learn more

dependencies

The coding uses https://github.com/abapify/throw and https://github.com/abapify/assert

 

3 Comments
Jelena_Perfiljeva
Active Contributor
0 Kudos

Thanks for sharing, @jrgkraus ! I'd kill for this tool 10+ years ago but hey, it's better late than never. 🙂

marcfbe
Participant

Good one! Here’s the link to the repo:

https://github.com/jrgkraus/abap-ui-tools 

ChristianGünter
Contributor
0 Kudos

@jrgkraus it seems that the link to repo is missing. Or am I blind?

Edit: Thx @marcfbe 

Labels in this area