Pages

Wednesday, 17 July 2013

How solve SAP modification warning editing on customized development object?

If your object directory entry of your development object , SAP will treat your changes is a modification although it is a customized development object.
To solve this, we need to change the object directory object manually.
Go to transaction code SE03, key in your development object



 Execute it.
In the next screen highlight click on on the "Object Directory" button.
 Change the Original System to the current system.
Whenever you edit on ZHR_REPORT, SAP should not prompt you modification warning again.

Attachment in HCM Processes and Forms


You can add attachment through the configuration below.

By default there is some attachment types setup in SAP. You can reuse them or you can setup your own Z attachment type.


You will need to configure in design time, to set what attribute/action user can do on different step of each attachment(s) .

Example, you might want to set creation mandatory for the attachment during user first request on the leave request, and during approval step manager can only read / open the attachment only.

Tuesday, 16 July 2013

How to configure on


For E-Recruiting using BSP application.

For E-Recruiting using Web Dynpro application.


For example, by default all the questions will have "Not Specified" option; you might want to remove by adding 'X" to parameter type HIDE_NO_ENTRY_RDB under table V77RCF_MDL_PRMC if you are using E-Recruiting on BSP applications; or for WebDynpro versions you can configure parameter = 'X' for HIDE_NO_ENTRY_RDB entry in table V77RCF_PRMC_PL.

Easy way to trigger ALE data transfer from E-Recruiting manually.

Normal steps to perform hiring from E-recuring portal is:-
1. Create a requisition
2. Create job posting for the requisition
3. Setup external / internal candidate
4. Assign the job ID to the candidate
5. Do data transfer for the job application
6. Run RCF_PERIODICAL_SERVICES manually ; this should be scheduled to run at certain hours.

There is a rather faster way to create new hiring request in ECC without go through the tedious steps above. The general idea on how this works as below.
1. Download the XML field from transaction code SXMB_MONI (provided you have ran at least one round of hiring process from E-recuring to ECC. )
2. Run the interface service manually using the XML file downloaded in transaction code SPROXY


Download the XML field from transaction code SXMB_MONI
- Open SXMB_MONI > Integration Engine > Monitoring > Monitor for Processed XML Messages > Double click on desired XML message > XML Message > Inbound Message ( SENDER ) > Payloads > MainDocument( application/xml ) > Use Window 1 or Window 2 to download the XML message


Run the interface service manually 
- Run the outbound service manually, upload XML file and execute the service. Remember to trigger COMMIT WORK after you have executed.

Monday, 15 July 2013

Useful class to retrieve or maintain your E-Recruiting candidate

If you have a development to display/ maintain your candidate in E-recruting, you might want to consider to use this handy class to serve your purpose.


Sample coding on how to retrieve telephone number from the using the BP number:
  DATA: lo_bas                    TYPE REF TO cl_hrrcf_candidate_bupa_bl.
  DATA: lo_exception              TYPE REF TO cx_hrrcf.
  DATA: lt_candidates             TYPE  rcf_t_hrobject,
        ls_candidates             LIKE LINE OF lt_candidates,
        lt_telefondata            TYPE rcf_t_telefondata_bp,
        ls_telefondata            TYPE rcf_s_telefondata_bp.

              CALL METHOD cl_hrrcf_candidate_bupa_bl=>get_instance
                RECEIVING
                  return = lo_bas.

*             Get candidates contact data and email address.
              ls_candidates-objid = candidate_number.
              ls_candidates-otype = 'NE'.
              ls_candidates-plvar = '01'.

              TRY.
                  CALL METHOD lo_bas->get_contact_data
                    EXPORTING
                      ps_cand_hrobject = ls_candidates
                    IMPORTING
                      pt_telefondata   = lt_telefondata.
                  IF sy-subrc IS INITIAL.
                    READ TABLE lt_telefondata INTO ls_telefondata WITH KEY channel = '03'" mobile number
                    IF sy-subrc IS INITIAL.
                      mobile_number = ls_telefondata-telephone.
                    ENDIF.
                  ENDIF.
                CATCH cx_hrrcf INTO lo_exception.
                  CALL METHOD cl_hrrcf_exception_handler=>write_exception_log
                    EXPORTING
                      ex = lo_exception.
              ENDTRY.

Relationship between various object in e-Recruitment

If you are implementing hiring scenario through e-recruitment portal.
You might interested to know what is the relationship between the infotypes involved and the relationship between them.



One example on how to make use of relationship table above in your development.

Say you would like to retrieve and pass the candidate profile(title, first name, last name and etc), and these info are being stored as a business partner in the system.

Thus, first you will need to get the Candidate ID ( Object Type = 'NA' ). If you have others information on hand, such as NE Candidacy, you will need to carry out a read using relationship B656 to get Candidate ID with object type NA.

Secondly, use relationship A650 to retrieve the object ID with object type CP .
Then with this object ID , further retrieve object ID with object type BP(Business Partner)

Lastly, you can retrieve the business partner / candidate profile information from BUT related table.
Example, you can retrieve title, first name , last name, nationality and etc from BUT000 table.

image source:http://wiki.sdn.sap.com/wiki/download/attachments/32737564/e-rec.JPG

Friday, 12 July 2013

Retrieve form container data based on step GUID

Under certain circumstances, either in workflow you might want to read the form value at certain step and further decide which process flow to take; or  in generic service implementation control how the form should behave or what the back-end update should be carried out.

It would be good if you know a way on how to achieve form value that is already stored in SAP table.

One of the way to achieve this is using step GUID of the form.
Ok, you are smart and might already have this question in mind, "where can i get this step GUID?".
Here you go ..

1) If you are looking from step GUID during workflow processing, you can find it under step object structure, with element name GUID

As per workflow container view, it is under PROCESS_OBJECT 

2) Second way is to append this field as special field in the form scenario, so that you can use the value in INITIALIZE and DO_OPERATION method. 

If you want to use step GUID info during form update in FLUSH method, you will need to declare STEP_GUID attributes as global variable to hold the step GUID value, and to be used in FLUSH method later.

Sample coding on how to retrieve form values.
Sample coding on how to get attachment as demonstrated in advanced generic implement of SAP Standard requisition form, under class CL_IM_HRRCF_REQUI_REQUEST, IF_HRASR00GEN_SERVICE_ADVANCED~FLUSH method .


Sample coding on how to read attachment data

This sample coding is taken from class CL_IM_HRRCF_REQUI_REQUEST,
IF_HRASR00GEN_SERVICE_ADVANCED~FLUSH method. Demonstrated under SAP standard requisition form.

*   PDF as attachment
    SELECT SINGLE parent_scenario FROM t5asrsteps INTO scenario_guid WHERE case_guid = step_guid.
    CALL METHOD cl_hrasr00_pdf_generation=>generate_pdf
      EXPORTING
        scenario_guid   = scenario_guid
        step_guid       = step_guid_process
        message_handler = message_handler
      IMPORTING
        xstring         = xstring.

    CONCATENATE text-a01 '.pdf' INTO lv_request_form.                   "N1600701
    attachment-filename   = lv_request_form.                            "N1600701
    attachment-att_type   = att_type_request.
    attachment-language   = sy-langu.
    attachment-att_header = text-a01.
    attachment-content    = xstring.
    attachment-mimetype   = 'application/pdf'.
    APPEND attachment TO attachments.

*   Attachments of process
    CALL METHOD cl_hrasr00_container_utils=>get_attachments
      EXPORTING
        step_guid   = step_guid_process
      RECEIVING
        attachments = attachment_others.

    IF NOT att_type_others IS INITIAL.
      attachment-att_type   = att_type_others.
      LOOP AT attachment_others  INTO attachment_other.
        attachment-language   = sy-langu.
        attachment-att_header = attachment_other-attachment_type_text.
        attachment-content    = attachment_other-attachment_content.
        attachment-mimetype   = attachment_other-attachment_mimetype.
        attachment-filename   = attachment_other-attachment_filename.   "N1600701
        APPEND attachment TO attachments.
      ENDLOOP.
    ENDIF.

Sample program on how to read form container values

Sample program taken from class CL_HRASR00_WF_COMPONENTS, DATAMAPPING method.

*   search whether the form scenario and version has been used in this
*   process already. If not: dump.
        SELECT case_guid FROM t5asrscenarios INTO scenario_guid
        WHERE parent_process = pobj_guid AND
              scenario = form-form_scenario AND
              scenario_version = form-form_scenario_version.
          EXIT.
        ENDSELECT.

        IF sy-subrc IS NOT INITIAL OR scenario_guid IS INITIAL.
          MESSAGE e002(hrasr00_process) INTO dummy. " Datenmapping als erster Schritt eines neuen Formularszenarios
          RAISE EXCEPTION TYPE cx_hrasr00_process_modelling.
        ENDIF.


*   Get instance of POBJ_RUNTIME
        CALL METHOD cl_hrasr00_process_runtime=>get_instance
          EXPORTING
            scenario_guid         = scenario_guid
            activity              = activity
            message_handler       = message_list
            no_auth_check         = ''
          IMPORTING
            instance_pobj_runtime = ref_pobj_runtime
            is_authorized         = is_authorized
            is_ok                 = is_ok.

        IF is_authorized <> if_hrasr00_process_constants=>true .
          MESSAGE e024(hrasr00_process) INTO dummy." Keine Berechtigung zum Lesen einer Instanz eines Prozessobjekts
          RAISE EXCEPTION TYPE cx_hrasr00_process_modelling.
        ELSEIF is_ok <> if_hrasr00_process_constants=>true.
          MESSAGE e023(hrasr00_process) WITH pobj_guid INTO dummy." Laufzeitinstanz des Prozessobjekts ID &1 nicht gefunden
          RAISE EXCEPTION TYPE cx_hrasr00_process_modelling.
        ENDIF.


*   Use  POBJ_RUNTIME to get latest form data container as XML.
        CALL METHOD ref_pobj_runtime->get_latest_data_container
          EXPORTING
*           SCENARIO_GUID   =
            message_handler = message_list
          IMPORTING
            data_container  = form_data_container_xml
            is_ok           = is_ok.

        IF is_ok <> if_hrasr00_process_constants=>true.
          MESSAGE e005(hrasr00_fbd) INTO dummy." Keine Berechtigung, Daten dieses Prozesses zu lesen
          RAISE EXCEPTION TYPE cx_hrasr00_process_modelling.
        ENDIF.


*   Get instance of form data container.
        CREATE OBJECT ref_form_data_container
         EXPORTING
*      FORM_SCENARIO =
*      FORM_SCENARIO_VERSION =
*      FORM_SCENARIO_STAGE =
           xml    = form_data_container_xml.


*   Use this data container to convert XML to table.
        CALL METHOD ref_form_data_container->get_values_of_fields
          IMPORTING
            values_of_fields = form_data_containers.

*   Now we have the form_data_container.
*   Do we have to import data?
        IF mapping_imports IS NOT INITIAL.

*     For each form field which should be imported
          LOOP AT mapping_imports INTO mapping_import.

*       Try to find a really same named form field
            LOOP AT form_data_containers INTO form_data_container
              WHERE fieldname = mapping_import-form_field_name.

*         We have found a matching form field name:
*         Import its value and update the container table.
              READ TABLE form_data_container-fieldvalues
                         INTO mapping_import-field_value INDEX 1.

*         Write the found value back into the mapping table.
              MODIFY mapping_imports FROM mapping_import.

              EXIT.  "If we have found one matching field, this is enough.
            ENDLOOP"form_data_containers

*           Could the wished Form field be found? If not: Exception, because the
*           given fieldname of form does not exist in this form scenario
            IF sy-subrc <> 0.
              MESSAGE e003 WITH mapping_import-form_field_name form-form_scenario INTO dummy." Feld &1 im Datencontainer des Formularszenarios &2 nicht gefunden
              RAISE EXCEPTION TYPE cx_hrasr00_process_modelling.
            ENDIF.

          ENDLOOP.  " mapping_imports

*     In case of Import: Return the values got from form
          READ TABLE mapping_imports WITH KEY
          form_field_name =   form_field_name_1 INTO mapping_import.
          IF sy-subrc IS INITIAL.
            field_value_1 = mapping_import-field_value.
          ENDIF.
          READ TABLE mapping_imports WITH KEY
          form_field_name =   form_field_name_2 INTO mapping_import.
          IF sy-subrc IS INITIAL.
            field_value_2 = mapping_import-field_value.
          ENDIF.
          READ TABLE mapping_imports WITH KEY
          form_field_name =   form_field_name_3 INTO mapping_import.
          IF sy-subrc IS INITIAL.
            field_value_3 = mapping_import-field_value.
          ENDIF.

        ENDIF"mapping_imports[] IS NOT INITIAL

Thursday, 11 July 2013

Transfer of field value between form scenario

If you have more than one form scenario in a process, you can transfer the fields between 2 form scenario using the Transfer of Fields mapping in design time.



To access to this Transfer of Fields screen,
1. use transaction code HRASR_DT to open design time screen
2. Choose process from dropdown
3. Enter your process, which has more than one form scenario,  hit enter to load your process
4. At the bottom of the process, double click on "Transfer of field Values"
5. A table screen will be loaded at the content area.
6. Start your configuration by do the mapping on which field from which form scenario you want to transfer from, and which field of which form scenario in the process you want the value to be transferred to.

Sample process by SAP that used transfer of field values feature in the process.
In this example it involved SXHR XI form scenario that value to be passed from others system, for example eRecruiting portal.



Monday, 8 July 2013

Usage of Special Fields in HCM P&F.



As explain in another post, you can add and read some value in backend by appending them into SPECIAL_FIELDS under method IF_HRASR00GEN_SERVICE~GET_SPECIAL_FIELDS.

You can append as much field as you like into SPECIAL_FIELDS table; rule of thumb is never append any service field. 

Reason being is that any fields that appear as SPECIAL_FIELDS, you will not be to change the fields' value in INITIALIZE or DO_OPERATION methods.

To edit your logic in generic service, use SE24 Class Builder or put in your generic service BAdI name in SE19 and use forward navigation to modify the logic.