cancel
Showing results for 
Search instead for 
Did you mean: 

HCM processes and forms: Advanced generic services: flush method: hr_infotype_operation

Former Member
0 Kudos

Hello Gentleman,

I am running in to this issue with updating Benefit plans using the FLUSH method of the Advanced Generic sevice in HCM Porcesses and Forms. Yes, I could use regular SAP_PA to update benefit plans, but client wants to mimic the old Delimit button behaviour during Termination ( where it purely delimits the record without making any changes to Changed on Date and changed by user). Anyways, my issue is ..

HCMPF framework already initializes a buffer calling static methods of the class "CL_HRPA_INFOTYPE_FACTORY" and sets the CONTEXT variable to DFLT (for Default). Now, when I use the standard "HR_BEN_TERMINATE_MISCEL_PLAN" fuction module. It in turn cals "HR_INFOTYPE_OPERATION" which then calls "HR_MAINTAIN_MASTERDATA". Now problem with this FM "HR_MAINTAIN_MASTERDATA" is that it has some statements

( like  PERFORM IMPORT_PLOG_TAB(SAPFP50P) ) which triggers buffer initialization again. Now this time the same class CL_HRPA_INFOTYPE_FACTORY is called again and the program tries to set the context value fo LGCY ( for legacy). At this point, an excpetion is thrown saying that context shouldn't be set twice.

Since there function modules are standard function modules i am left wondering whether this is allowed or not. Did anyone have had success using HR_INFOTYPE_OPERATION inside the FLUSH mehtod of the Advanced generic service. I understand that you should not try to do any COMMITS inside FLUSH method, but the above buffer conflict behavior is same irrespective of whether I use nocommit value of true or false.

As a workaround, I am calling my function module which has all Benefirt Termination FM Calls listed as CALL FUNCTION xxx STARTING NEW TASK task from inside the FLUSH method. This seem to do the job, but I hate to think that this my only option.

Your inputs and suggestions are appreciated.

Thank you,

Jeeva.

Accepted Solutions (1)

Accepted Solutions (1)

ChrisSolomon
Active Contributor
0 Kudos

You do not use the  HR_INFOTYPE_OPERATION function in a AGS. You can either use:

1. a lot of infotype factory classes that interact with the containers...

      cl_hrpa_masterdata_factory=>get_business_logic

      cl_hrpa_infotype_factory=>get_infotype_logic

      cl_hrpa_infotype_container=>get_instance

      new_infotype_container->modify_infotype_logic

      masterdata_bl->insert

or

2. use the updated version of you function HR_CONTROL_INFTY_OPERATION above  which will attempt to do method #1 but fallback to #2 if it has too. This function works for the decoupled/detached and "old" infotype framework. I used it a LOT when re-writing a lot of pre-WDA ESS services into custom WDA ones. (funny enough, you can see how to do #1 by looking at the same kinda calls in this function)

Personally, I hand code #1 so I know everything going on in my AGS.

Former Member
0 Kudos

Thanks for the response..Yes I came to the same conclusion. i.e "You do not use the  HR_INFOTYPE_OPERATION function in a AGS". I was trying to mimic the exact code that get's called behind Benefits workbench and that uses a lot of HR_BEN* function modules. This helps the Termination functionality to remain same when done via PA40 or through HCMPF and I also don't want to reinvent this logic with classes.

I am already using classes mentioned above in requirements where I don't need to mimic SAP code as is.

By the way, Good job on the blogs, that saved me a lot of time in the begining of the project.

0 Kudos

Hello sir,

I also need your help on hcm process and form. My requirement is to update the infotype fields which provided in form. I need to update in workflow manually after 3 approvals. I read your blog on 'Advanced generic service when all fails' and got an idea.

I created a custom class and added method and this method calls cl_hrasr00_process_runtime=>get_instance,

CALL METHOD lo_pobj_runtime->get_latest_data_container.

But here I am getting dumps CX_SY_NO_HANDLER, CX_SY_MOVE_CAST_ERROR. Please throw some light on it sir. below is my code,

  DATA: it_t5asrscenarios type table of t5asrscenarios, wa_t5asrscenarios type t5asrscenarios.

   DATA ref_form_data_container TYPE REF TO cl_hrasr00_data_container.

   DATA form_data_containers TYPE hrasr00_values_of_field_tab.

   DATA form_data_container LIKE LINE OF form_data_containers.

   DATA: lo_pobj_runtime TYPE REF TO if_hrasr00_process_runtime.

   DATA: l_authorized TYPE boole_d,

         l_ok TYPE boole_d.

   DATA: lo_message_list TYPE REF TO cl_hrbas_message_handler ,

         ls_xstring TYPE xstring ,

         ls_container TYPE xstring .

   DATA: lc_check TYPE c LENGTH 1 VALUE 'X' ,

         lc_r TYPE asr_activity VALUE 'R' .

   DATA message_dummy TYPE string.

   DATA message TYPE symsg.

   if guid is not initial.

     select * from t5asrscenarios into table it_t5asrscenarios where parent_process = guid.

   endif.

   CLEAR:l_authorized,l_ok.

   CREATE OBJECT lo_message_list.

   LOOP AT IT_T5ASRSCENARIOS INTO WA_T5ASRSCENARIOS.

   CALL METHOD cl_hrasr00_process_runtime=>get_instance

     EXPORTING

       scenario_guid = wa_t5asrscenarios-case_guid

       step_guid = guid

       activity = lc_r

       message_handler = lo_message_list

       no_auth_check = lc_check

     IMPORTING

       instance_pobj_runtime = lo_pobj_runtime

       is_authorized = l_authorized

       is_ok = l_ok.

    CLEAR ls_container.

     CALL METHOD lo_pobj_runtime->get_latest_data_container

       EXPORTING

         scenario_guid = wa_t5asrscenarios-case_guid

         message_handler = lo_message_list

         no_auth_check = lc_check

         activity = lc_r

       IMPORTING

         data_container = ls_container

         is_ok = l_ok

         is_authorized = l_authorized.

     CREATE OBJECT ref_form_data_container

     EXPORTING

       xml = ls_container.

     CALL METHOD ref_form_data_container->get_values_of_fields

       IMPORTING

values_of_fields = form_data_containers.

   ENDLOOP.


Regards,

Rajee

former_member184635
Participant
0 Kudos

Dear  Chris,

This is regarding the FM  HR_INFOTYPE_OPERATION , which gives dumps as 'exception 'CX_HRPA_INVALID_PARAMETER' using ABAP front end.

on debug found that a_context of class cl_hrpa_infotype_factory is setting twice hence the dump.

I had enhanced the method perform initialize_ps_adapter of program SAPFP50P and check whether a_context is already set, exit from the method. This will reamin the framework will has initialized once only. whether it is New infotype framework or old(legacy) infotype framework

I would just like to know whether this will effect any of other infotype updates/ transaction .

Thanks & Regards,

Dadarao

Answers (1)

Answers (1)

Former Member
0 Kudos

Just to give an update on the post, I moved the logic to Workflow task. It still nice to hear if anyone had success in using standard HR update funtion modules inside Advanced generic service.

Thank you,

Jeeva.