cancel
Showing results for 
Search instead for 
Did you mean: 

E-Recruiting - workflow created activity does not attach questionnaire

mh97
Contributor
0 Kudos

Hi,

I am wondering if this is "as-designed" behavior or if I have an error somewhere.

I have a custom workflow that runs when the recruiter creates an interview activity. The workflow creates an "Interview Feedback" activity for the hiring manager. This is working fine except the questionnaire is not assigned to the activity. But if the recruiter creates an interview feedback activity manually, then the questionnaire is automatically assigned.

The requisition does have a process template assigned, that assigns the questionnaire for the activity type. In the workflow I am passing the candidacy object as HROBJECT to the tandard "erc_activ.createfromdata" task.

Has anyone else encountered this issue?

Thanks,

Margaret

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I would suggest you take the questionnaire object (QA_TPL_OBJID) from T77RCF_ACTTY2RP for the activity type. You will then have the object assigned to the activity on creation.

You can try to use the below:

-


qa_test TYPE hrp5141-qa_tpl_objid.

IF NOT qa_test IS INITIAL.

ASSIGN ('<record>-qa_tpl_objid') TO <qa_tpl_objid>.

<qa_tpl_objid> = qa_test.

qa_update_flag = 'X'.

ENDIF.

-


You can then use qa_update_flag (if not initial) to set_record and update_record.

mh97
Contributor
0 Kudos

SAP HCM Consultant,

Thanks for your reply. But I confess I don't completely understand.

To create the activity, I am using the standard task TS51807961 in the workflow. This task uses the business object type ERC_ACTIV and the method CREATEACTFROMDATA. The binding looks like:

Binding Workflow -> Step 'Create Activity'

-


Workflow

Step 'Create Activity'

-


9032

&ACTIVITYTYPE&

&ERC_ACTIV.ACTGUID&

&REFERENCEACTIVITY&

US

&RESPONSIBLEOBJECTTYPE&

&HIRINGMANAGER&

&RESPONSIBLEOBJECTID&

03

&PROCESS&

&HROBJECT&

&HROBJECT&

&EVENTDATE&

&DUEDATE&

-


'9032' is an activity type for a questionnaire type of activity.

&ERC_ACTIV.ACTGUID& is the GUID of the interview activity.

&HROBJECT is the PLVAR, OTYPE, and OBJID for the candidacy. The candidacy is assigned to a requisition which has the process template assigned. The process template assigns a questionnaire to the activity type 9032.

When an activity of type 9032 is created for the same candidacy manually, in HRP5141 the field QA_TPL_OBJID is assigned the value 50004988. However when the workflow creates the 9032 activity as described above, HRP5141-QA_TPL_OBJID is blank, and so when the user accesses the activity they find there is no questionnaire attached.

I am not sure how to use your suggestion to solve this problem. Can you clarify?

Thanks,

Margaret

Former Member
0 Kudos

What you need to do first is to create a new object type as a subtype of the object type ERC_ACTIVE (delegation type). In this new object you will create a new method for the new task to change and update the activity created under Step 'Create Activity' - so you may call the method CREATEACTFROMDATA. In our case we get activity by activity guid.

You will have a program to get the QA_TPL_OBJID from T77RCF_ACTTY2RP passing the activity type. After getting the object, you can use the above code to assign the questionnaire to the activity.

Answers (1)

Answers (1)

mh97
Contributor
0 Kudos

SAP HCM Consultant,

Thanks for your clarification. It is similar to what I was expecting but instead of using your code above, here is what I did:

1. Subtyped ERC_ACTIV to ZERC_QUEST. I did not delegate because I only need to override the create method.

2. In the subtype I created a method CreateQuestFromData, using most of the code from the ERC_ACTIV.createActFromData, but first the new method gets the questionnaire object id from T77RCF_ACTTY2RP, querying by process template, process, and activity type. (The process template GUID is passed in the Reference Activity import parameter.) Then I build the pt_overwrite import parameter for the factory method.

I found the method used in the manual creation by debugging: CL_HRRCF_ACT_PROC_CREATE_V -on_create_sproc. Here is the relevant code, that shows the use of the pt_overwrite parameter (which is not used in the ERC_ACTIV create method):

IF ls_act_type-qa_tpl_objid IS NOT INITIAL.
          ls_overwrite-fieldname = 'QA_TPL_OBJID'.
          ls_overwrite-fieldvalue = ls_act_type-qa_tpl_objid.
          APPEND ls_overwrite TO lt_overwrite.
        ENDIF.
*
*       Create activity
        CALL METHOD cl_hrrcf_activity_factory=>create_activity_by_type
          EXPORTING
            act_type     = ls_act_type-act_type
            act_proc     = me->selected_act_proc
            hrobject     = ls_hrobject
            pt_overwrite = lt_overwrite
          IMPORTING
            activity     = lo_activity
            return       = lt_return.

Using the pt_overwrite parameter means it is not needed to update the questionnaire object id in a subsequent step.

Thanks again for your help.

Margaret