Skip to Content
Author's profile photo Former Member

HCM Processes & Forms. How to get approval data.

In the first line of this post I want to warn you — this is my first blog post on SCN, and ask you to forgive me for my terrible English. My native language is C#. 🙂

So okay, recently I had a problem to get approval data for HCM Processes & Forms. It means, I needed data about who, when and what activity on the form was done. In the end, I needed a kind of such data:

From: Arthur Dent, Hitchhiker [process initiator]

To: Slartibartfast, Earth Mk. II Lead Designer [current processor]

Name Position Activity Date
Arthur Dent Hitchhiker PROCESSED 31.08.2012
Zaphod Beeblebrox Galactic President APPROVED 01.09.2012
Vogon Jeltz Prostetnic APPROVED 01.09.2012
Questular Rontok Vice President of the Galaxy APPROVED 02.09.2012

So I want to share with you ABAP code, that processes HCM P&F by refernece ID number and processes this data.

Actual data is stored in variables app_name — current approvers name, app_pos — current approver position and table t_approval — the processing data. Process ref. id must be assigned to variable in_refid.

I hope it would help you.



* Kawabanga!

TABLES: t5asrprocesses, t5asrscenarios, t5asrsteps.


BEGIN OF struct_approval_data,

   name TYPE char255,

   position TYPE char255,

   date TYPE d,

   reaction TYPE char255,

END OF struct_approval_data.

DATA: t_t5asrpocesses LIKE t5asrprocesses,

       t_t5asrscenarios LIKE t5asrscenarios OCCURS 0,

       w_t5asrscenarios LIKE LINE OF t_t5asrscenarios,

       w_t5asrsteps LIKE t5asrsteps,

       in_refid LIKE t5asrprocessesreference_number,

       t_approval TYPE struct_approval_data OCCURS 0,

       w_approval TYPE struct_approval_data,

       app_name TYPE char255,

       app_pos TYPE char255,

       gt_return TYPE bapireturn,

       gt_org LIKE bapip0001b OCCURS 0 WITH HEADER LINE,

       lv_userid TYPE bapiemplbuserid.

* in_refid = ‘000000000035’.

* Dirty hack

SELECT SINGLE * INTO t_t5asrpocesses FROM t5asrprocesses WHERE reference_number = in_refid.

SELECT * INTO w_t5asrscenarios FROM t5asrscenarios WHERE parent_process = t_t5asrpocessescase_guid.

   APPEND w_t5asrscenarios TO t_t5asrscenarios.


SORT t_t5asrscenarios DESCENDING.

* A kind of magic

LOOP AT t_t5asrscenarios INTO w_t5asrscenarios.

  SELECT * FROM t5asrsteps INTO w_t5asrsteps WHERE parent_scenario = w_t5asrscenarioscase_guid.

    MOVE w_t5asrstepsprocessed_by TO lv_userid.



        userid = lv_userid


        return = gt_return


        org_assignment = gt_org.

    IF ( w_t5asrstepsproc_status ne ).

      w_approvalname = gt_orgname.

      w_approvalposition = gt_orgpostxt.

      w_approvaldate = w_t5asrstepscompletion_date.

      w_approvalreaction = w_t5asrstepsproc_status.

      APPEND w_approval TO t_approval.


      app_name = gt_orgname.

      app_pos = gt_orgpostxt.




Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Christopher Solomon
      Christopher Solomon

      Nice work! I knew you'd get it figured out. Thanks for sharing. Maybe edit the blog to explain a bit more of what you were trying to do and why you needed that information (to display on the form instead of "people involved" section). Keep blogging!