Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
justin_santhanam
Active Contributor

I have recently got a requirement from the Business users to get some additional fields in UAR Workflow. For example they wanted to get Valid From and Valid To in the Review list which will be of great helpful for them to review the access items. Since I wasn't much familiar with the data in GRC , I was going against SAP ERP to see how I can bring the Valid From and Valid To data into GRC, but alessandr0 and m.lee helped me in the right direction to fetch the data from GRC instead of the satellite tables. Alright enough of the story I guess :smile: ..

The below Enhancement is done in GRC 10.

1) Append your custom fields into GRAC_S_UI_REVDATA

2) Go to SE80 and choose the Web Dynpro Comp. / Intf. - GRAC_UIBB_USER_ACC_REVIEW

  (This is the Webdynpro component we are going to enhance it to show it on the screen)

3) Double click on V_UAR_ITEMS from Views and choose Enhance from the Menu (Ctrl + F4) and create Enhance Implementation

4) Double click on the COMPONENTCONTROLLER and choose N_UAR_ITEM_DATA from the Context.

5) Right click on N_UAR_ITEM_DATA and choose Create Using the Wizard - Attributes from Components of Structure.

6) Choose the custom fields from the pop-up to add them into the context.

7) Now double click on V_UAR_ITEMS from Views and select N_ITEM_DATA from Context.

😎 Now right click on N_ITEM_DATA and choose Update Mapping and select Yes from the pop-up.

Okay , now we are moving on to place those fields on the screen.

9) Make sure you are still on the V_UAR_ITEMS view and go to the Layout

10) Right Click on the TABLE and choose Insert Columns (Repeat the same for all the custom fields you have)

11) After creating the Columns, Insert Text View and Header to those Columns. I have copied the same parameters from TC_ITEM_DESC to my new custom columns (Except ID's which has to be unique)

12) After creating those properties, don't forget to do the binding.

That's it. Now the fun part (Coding) :smile: .. Since my requirement is pretty simple, I handled the coding on the WDDOINIT Post-Exit part.

13) Now go to the Methods tab (make sure still you are in V_UAR_ITEMS view) , click to create Post-Exit on WDDOINIT.

14). Write your coding on this exit.

15). Code to populate ZZ_VALID_FROM and ZZ_VALID_TO Contexts.


DATA lo_nd_n_item_data TYPE REF TO if_wd_context_node.
   DATA lt_n_item_data TYPE wd_this->elements_n_item_data.
   DATA lo_el_n_item_data TYPE REF TO if_wd_context_element.
   DATA ls_n_item_data TYPE wd_this->element_n_item_data.
   DATA lv_validfrm TYPE GRFN_TIMESTAMP.
   DATA lv_validto  TYPE GRFN_TIMESTAMP.
   DATA: lv_item_ty_desc TYPE string,
         lv_validfrm_s type string,
         lv_validto_s type string.
   DATA: lv_roleid type  GRFN_GUID.
   lo_nd_n_item_data = wd_context->get_child_node( name = wd_this->wdctx_n_item_data ).
   lo_nd_n_item_data->get_static_attributes_table( IMPORTING table = lt_n_item_data ).
   LOOP AT lt_n_item_data INTO ls_n_item_data.
     lv_item_ty_desc = ls_n_item_data-item_type_desc.
     TRANSLATE lv_item_ty_desc TO UPPER CASE.
   if  lv_item_ty_desc eq 'USER'.
     select single role_id into lv_roleid from gracrlconn
       where role_name eq ls_n_item_data-parent_key and
             connector = 'SAP_ERP'.
     select single valid_from valid_to from gracuserrole into (lv_validfrm,lv_validto)
        where role_id = lv_roleid and user_id = ls_n_item_data-user_name.
    else.
       "Nothing
    endif.
   lv_validfrm_s = lv_validfrm.
   lv_validto_s  = lv_validto.
   CONDENSE lv_validfrm_s.
   CONDENSE lv_validto_s.
    if lv_validfrm_s eq '0'.
      ls_n_item_data-zz_valid_from = ''.
    else.
      ls_n_item_data-zz_valid_from = lv_validfrm_s(8).
    endif.
   if lv_validto_s eq '0'.
      ls_n_item_data-zz_valid_to = ''.
    else.
      ls_n_item_data-zz_valid_to = lv_validto_s(8).
   endif.
    modify lt_n_item_data from ls_n_item_data.
    clear: lv_validfrm, lv_validto, lv_item_ty_desc.
  ENDLOOP.
  lo_nd_n_item_data->BIND_TABLE(
    exporting
      NEW_ITEMS            =    lt_n_item_data ).

16). The Final Result:

That's it . I guess one more thing on the last screenshot you might have noticed - Yes the Export button. It was also custom solution to export those values to Excel. If it's of anyone's interest then I'll write it up.

Thanks everyone for taking your time to look at this.Please go easy on me :wink: ,as this is my first ever blog in SCN after my 11 years with SCN. I always wanted to post blog on my PI/PO space, but apparently GRC space seems to be where my first blog landed :smile: .. Please feel free to add comments about if there are any mistakes in the way I have handled the design or if you find the blog is not  quality enough. I'll try to improvise.

7 Comments