2011-06-02

WD Screen Variants – Assistance Class

overview

<< previous | next >>

The concept of a selection screen variant is something that most SAP users have come to expect, yet this feature is unavailable in standard Web Dynpro. Below is the next in a series of posts detailing how to bring this necessary feature back to Web Dynpro. Start here to see the full requirements.

Start a new ABAP class ZCL_WDR_SELOPT_VARIANT.  It should inherit from CL_WD_COMPONENT_ASSISTANCE in order to be a true Web Dynpro assistance class (however, this isn’t a requirement).  An Assistance Class is assigned to a Web Dynpro component for two reasons: text elements and class-based coding.

SNAGHTML1e5aeada

Text Elements

I use this class to hold a list of language-dependent label captions that can be translated as needed.

SNAGHTML1e60972f

Classic ABAP Class-based Code

I’ve made the assistance class very important to this project by placing the list of assigned select options in this class.  It also stores a list of dynamic-date functions from RS_VARI_V_INIT.
SNAGHTML1e64b29b

You’ll see later where these methods are called.  The GET_TEXT method is simply a call to Web Dynpro assistance class GET_TEXT.  This makes for a more simple method call inside my Web Dynpro component.  The INIT_VARIVAR_TABLE is called at initialization to populate the MT_VARIVAR variant variables function list.

SNAGHTML1e66f4c9

This method gets a list of the various dynamic date possibilities:

   1: METHOD init_varivar_table.
   2:  
   3:   CALL FUNCTION 'RS_VARI_V_INIT'
   4:     TABLES
   5:       p_varivar = me->mt_varivar[].
   6:  
   7: **********************************************************************
   8: * Hide these dynamic date possibilities.
   9: * We don't have factory calendars configured in D15.
  10: **********************************************************************
  11:  
  12:   DATA: ls_varivar                    TYPE rsvarivar.
  13:   LOOP AT me->mt_varivar[] INTO ls_varivar.
  14:     CASE ls_varivar-runt_fb.
  15:       WHEN 'RS_VARI_V_TODAY_XWD' OR
  16:            'RS_VARI_V_WDAYS_UP_TO_NOW' OR
  17:            'RS_VARI_V_XWD_ACTUAL_MONTH'.
  18:  
  19:         DELETE TABLE me->mt_varivar[] FROM ls_varivar.
  20:  
  21:       WHEN OTHERS.
  22:     ENDCASE.
  23:   ENDLOOP.
  24:  
  25: ENDMETHOD.

Next, let’s dive into the Web Dynpro component itself.







overview

<< previous | next >>

5 comments:

  1. I don't see an type TT_RSVARIVAR in my system. Did you create that?

    ReplyDelete
    Replies
    1. Bill - looks like i created a Class Type (Public) in my assistance class for that.

      types:
      TT_RSVARIVAR type TABLE OF RSVARIVAR .

      Delete
  2. hi can you please tell me what is 'SELOPT_SCREENS' type is ?

    ReplyDelete
  3. Found it from your previous section ..thanks

    ReplyDelete
  4. hi can you please tell me what is 'SELOPT_SCREENS' type is ?

    ReplyDelete