Skip to Content

This blog applies to SAP Netweaver 7.0, SAP HR EHP3(EA-HR 603).  For more information, visit the link.

Summary

 

This blog clearly explains in displaying/saving the customers enhanced fields for the screen exit SAPMP56T using PTK99 structure and reuse it in Webdynpro ABAP without creating a new structure/table/cluster.

Introduction

In the earlier version of Travel Management, TRIP and PR05 transactions are used to create travel request/expense. After enabling the user data option using the transaction FITVFELD, all the custom fields are enhanced in the standard screen exit SAPMP56T (screen number 9999)  using the structure PTK99 and stored in the cluster using the same structure. In the travel management (EHP3) solution, there is no provision to neither enable those customer fields nor save the information in the cluster. Moreover SAP has clearly mentioned that “This user exit cannot be used with the SAP EP interface”, that made me try some solution that helps all the travel management consultants to easily make use of the existing travel data without creating new structure/table/cluster in the new version.

 

Screen enhancement in TRIP/PR05 Transaction

Following are the screen fields enhanced using the structure PTK99 in the screen exit  SAPMP56T (screen number 9999 ).

/wp-content/uploads/2012/05/14_99097.png

Screen enhancement in webdynpro ABAP

Create a node(USER_DATA) in the component controller of the Webdynpro Component FITE_VC_GENERAL_DATA.

/wp-content/uploads/2012/05/15_99128.png

Create the UI elements in the view and map the newly created node in the component controller node to the view node.

Newly created view elements are shown.

/wp-content/uploads/2012/05/16_99129.png

Now map the fields of structure user_data to the UI elements.

 

Enhancements

 

Enhancements are made under the following scenarios

  

  1. When modifying the travel request, retrieve the stored data in cluster and display it in the Webdynpro screen.
  2. When creating the new request, save these new fields in the Travel cluster.
  3. Pass these customer fields (USER_DATA) to the USER EXIT maintained for earlier version of travel management.

CASE 1:

When modifying the travel request, retrieve the stored data in cluster and display it in the Webdynpro screen.

    

In the post exit of the WDDOMODIFYVIEW method, make the following code changes,

 

IF first_time EQ abap_true.

    DATA: lt_user TYPE TABLE OF ptk99,

               ls_user TYPE ptk99.

    IF wd_assist->gs_common_rfc_input-trip_action EQ ‘MOD’.

      DATA:  l_te_key TYPE ptp00.

      l_te_key-pernr = wd_assist->gs_common_rfc_input-employee_number.

      l_te_key-reinr = wd_assist->gs_common_rfc_input-trip_number.

      l_te_key-perio = wd_assist->gs_common_rfc_input-period_number.

      l_te_key-pdvrs = ’99’.


     
SET EXTENDED CHECK OFF.

      IMPORT user TO lt_user

             FROM DATABASE pcl1(te) ID l_te_key.

      SET EXTENDED CHECK ON.

      READ TABLE lt_user INTO ls_user INDEX 1.

      IF sy-subrc EQ 0.

        DATA lo_nd_user_data TYPE REF TO if_wd_context_node.

        DATA lo_el_user_data TYPE REF TO if_wd_context_element.

        DATA ls_user_data TYPE wd_this->element_user_data.

*            navigate from <CONTEXT> to <USER_DATA> via lead selection

        lo_nd_user_data = wd_context->get_child_node( name = wd_this->wdctx_user_data ).

*            get element via lead selection

       lo_el_user_data = lo_nd_user_data->get_element(  ).

*            get all declared attributes

        lo_el_user_data->set_static_attributes(

          EXPORTING

            static_attributes = ls_user ).

      ENDIF.

    ENDIF.

  ENDIF.

CASE 2:   When creating the new request, save these new fields in the Travel cluster.

  1. In the pre-exit of the ON_NAVIGATE method in the component controller, make the below code changes.

  DATA lo_nd_user_data TYPE REF TO if_wd_context_node.
 
DATA lo_el_user_data  TYPE REF TO if_wd_context_element.
 
DATA ls_user_data       TYPE wd_this->element_user_data.
 
DATA lt_user                TYPE ptrv_util_ptk99_t.
 
DATA l_te_key              TYPE ptp00.


* navigate from <CONTEXT> to <USER_DATA> via lead selection

  lo_nd_user_data = wd_context->get_child_node( name = wd_this->wdctx_user_data ).

* get element via lead selection

  lo_el_user_data = lo_nd_user_data->get_element(  ).

* get all declared attributes

  lo_el_user_data->get_static_attributes(

    IMPORTING

      static_attributes = ls_user_data ).

  APPEND ls_user_data TO lt_user.

  l_te_key-pernr = wd_assist->gs_common_rfc_input-employee_number.

  l_te_key-reinr = wd_assist->gs_common_rfc_input-trip_number.

  l_te_key-perio = wd_assist->gs_common_rfc_input-period_number.

  l_te_key-pdvrs = wd_assist->gs_common_rfc_input-period_version.

  EXPORT user FROM lt_user TO DATABASE pcl1(te) ID l_te_key.

Screen shot for the above code,

/wp-content/uploads/2012/05/17_99130.png

ii) Create Function module enhancement for ‘PTRA_UTIL_EXPENSE_REPORT_SAVE’.

  DATA:  l_te_key TYPE ptp00.

  l_te_key-pernr = i_employeenumber.

  l_te_key-reinr = i_tripnumber.

  l_te_key-perio = i_periodnumber.

  l_te_key-pdvrs = i_periodversion.

  SET EXTENDED CHECK OFF.

  IMPORT user TO et_user

         FROM DATABASE pcl1(te) ID l_te_key.

     SET EXTENDED CHECK ON.

Screen shot for the same.

/wp-content/uploads/2012/05/18_99131.png

iii) Create enhancement for the include LPTRA_UTIL_MAINF01 and start making the changes from line number 4419.

/wp-content/uploads/2012/05/19_99132.png

 

CASE 3: Pass these customer fields (USER_DATA) tothe USER EXIT maintained for earlier version of travel management.

               For the user Exit FITR0003, it’s necessary to capture the custom information also.

/wp-content/uploads/2012/05/20_99133.png

  /wp-content/uploads/2012/05/21_99134.png

In the Include, just make the code changes using the IMPORT statement to retrieve the cluster information as I did for CASE 2.

Thanks,

S.Rajkumar.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply