Skip to Content
0
Former Member
Jul 26, 2010 at 10:15 AM

Use of BADI PT_BLP_USER to modify P2002 values

411 Views

Good Day Ladies and Gentle,men,

I am endeavouring to make a change to a BADI method attached to HR transaction PTMW. I need to modify a field in structure p2002. Because the p2002 data is only accessible via the interface attached to, in this case, the object I_RECORD, I can only read it by dereferencing (is that the right term?) the object a couple of times.

Once I've done this I can read the p2002 structure data into my work area ls_p2002, and modify the data I need to. My question is, how do I write this information back to either a) the i_record object or b) to a new object copying the i_record data but with my new p2002 data for passing out via the e_time_data structure.

   
method process_it2002.
**************************************************************** 
*  Import I_RECORD    TYPE REF TO  IF_PT_TD_CONTROL
*         I_TIME_DATA TYPE         TIM_BLP_REQUEST_TAB
*  Export E_MESSAGES  TYPE         BAPIRET2_T
*         E_TIME_DATA TYPE         TIM_BLP_REQUEST_TAB
**************************************************************** 
 
  data:
        ls_it2002 type p2002,
        ls_data   type ref to cl_pt_td_it2002,
        ls_time   type ref to CL_PT_TD_CONTROL,
        ls_p2002  type p2002.

  field-symbols: <fs1> type any.

  ls_time ?= i_record.
  ls_data ?= i_record->data.
  ls_p2002 = ls_data->if_pt_td_it2002~p2002.

  if ls_p2002-subty = 'TRNG'.
    ls_p2002-stdaz = ( ls_p2002-enduz - ls_p2002-beguz ) / 3600.           "My Code Change
   
* need to get ls_p2002 back into i_record or a copy of this object so I can
* update e_time_data.   
  endif.

*  append i_time_data to e_time_data.

endmethod. 

Any help would be greatly appreciated.

Thanks, Stephen