Skip to Content
Author's profile photo Christopher Solomon

HCM Processes & Forms: More Fun with Attachments

I wrote a blog a long while back that talked about attachments and all the “neat” things you can do with them with HCM P&F configuration (making them required/optional, showing they exist but not allowing the user to open/download, show/hide, etc). The idea for this blog is a bit different though and came from an interesting requirement from a previous client.

The client’s requirement was simple, but had me scratching my head at first.  As part of a “Hiring” process, the initiator can (optional) attach a “Sign On Reimbursement Letter” (ie. sign on bonus).


Likewise, there are fields on the form to enter Sign On Bonus information.


After the initiator sends this on to the next person, the client wanted us to put logic in place that would see if the initiator entered a Sign On Bonus amount, and if so, it should check to see if a “Sign On Reimbursement Letter” was attached. After checking for the attachment, it should display a message on the form about whether an attachment was found or not and what this meant. For example, if an attachment was found, it appears as (displays icon and message “Sign On Agreement is attached.”):


If the attachment was not found, it appears as (displays icon and message “Sign On Agreement is NOT attached. This payment will be locked until the Sign on Agreement is received.”) :


So that was that. Sounds easy enough, right? Maybe? No? Well, for me, this one was quite new. I had to come up with a way for the form to check “outside” of itself in a manner of speaking….and this actually turned out to be much simpler than I expected.

On the HCM P&F side, I set up a single field, “FLAG_SIGNON_ATTACH” defined as CHAR1 (one character data type).  Then I wrote a very simple generic service with and operation “CHECK_SIGNON”  that mapped over the FLAG_SIGNON_ATTACH field and the PROCESS_REFERENCE_NUMBER field (the standard, reserved field that the framework handles for us to hold our process reference number for our process). I wrote a private method generic enough to handle any attachment type that was configured in HCM P&F (in that way, this generic service could be reused for any attachments). The call to the method appears as:

*== Call our method for actual Business Logic and data collection
*       Check for sigon agreement

        CALL METHOD me->check_attachment_exists
            proc_ref_num    = w_proc_refnum
            attach_type     = c_signon_agreement
            flag_attached   = w_flag_signon
message         = message_dummy.


Where C_SIGNON_AGREEMENT  is a constant (attribute of our class) defined with our attachment type “code” as configured in our process. In our case, it was “ZH_SIGNON” . The method would then return back to us a value of “X” if the attachment was found or empty/blank if it was not. The internals of the method were pretty simple….much more so than I first thought. I actually poked around in the “Start Application” WDA to figure out how it was reading/detecting attachments. I figured that somehow it knows for my process what the previous users have attached so certainly that was a good place to start. It was fairly easy to find and I  “borrowed” similar logic. The method became:


(* This is where I make life miserable for the “cut-and-paste coders” hahahahahaha)



The last part was over on the form side. I used a hidden field to bind my FLAG_SIGNON_ATTACH field to and then checked its value in the  “form ready” event script. Based on the value (rawValue = “X”?), I would either show (set presence to “visible”) a hidden success(attached) or fail (not found) message.

I had this “operation” set up to be called when the initiator did a “check and send” if the sign-on amount was greater than zero (i.e. had a value) via a “rule”. Then the “flag” was set and would show them the message. That gave them a chance to go back and attach the letter if they needed to.  After that, I set up my configuration to pass (transfer of fields) the “flag” value to the next form scenario. Because it was set correctly from the initiator, the form handled everything for me (ie. no need for another check or initialization to be configured in the backend).


I learned some interesting things with this one and added another “trick” to my HCM P&F toolbox. With  a little thought, you can probably come up with some more ideas of how to do some similar things….and yes, I later got to do some much more “interesting” than this, but this lesson sure helped out! Hope you like this one . As always…till next time….

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Chris,

      nice article.

      one question for HR P&F ... can there be mass maintainance of employee data using HR P&F ?... I found this link ...

      however wanted to get your feedback/guidance on mass employee changes?



      Author's profile photo Christopher Solomon
      Christopher Solomon
      Blog Post Author

      With EhP4 and higher, there is *some* mass change functionality well as "Fast Entry" also.

      Author's profile photo Tal Tzafriri-Adi
      Tal Tzafriri-Adi

      Great blog post!!!

      I have a similar requirement to what you mentioned, but I need to retreive attachment information and present an error message on FPM form at the first step of the process, when a process reference number still doesn't exist (there is no info in all tables starting with T5ASR* before the user "send" first step of the process).

      Where the attachment is stored at the first step (before the user send it? and how can I retreive info about it in my generic service?

      Author's profile photo Christopher Solomon
      Christopher Solomon
      Blog Post Author

      Things have changed a little since this blog. If you have an attachment that is REQUIRED, simply set it in your configuration that for that form scenario step, it is required. It will throw an error for you.

      Is that what you mean?

      Author's profile photo Tal Tzafriri-Adi
      Tal Tzafriri-Adi


      I can't use standard customization since my requirement is that whether an attachment is mandatory or not depends on the data the user enters at the form (and it's not constant to a specific step of the process).

      So, I should calculate based on the info the user entered (using a simple generic service) the "UI-Attribue" of an attachment (Mandatory, Can be edited and so on).

      Since I don't know how to do that at the attachmet area on a FPM form, I thought to check (somehow 🙁 ) whether the user attached a file and compare it to values the user enter on the form and show an error message from my simple GS.

      Author's profile photo Christopher Solomon
      Christopher Solomon
      Blog Post Author

      It is can check/use the same classes SAP does when checking when it is marked as "required" just need to follow the same method/logic. You would have your own generic service that could check your "rules" and then check that same way if needed. Let me see if I can find it.

      Author's profile photo Tal Tzafriri-Adi
      Tal Tzafriri-Adi

      Found out! 🙂

      I used class CL_HRASR00_PROCESS_EXECUTE with method IF_HRASR00_PROCESS_EXECUTE~GET_ATTACHMENTS and it works!

      Author's profile photo Christopher Solomon
      Christopher Solomon
      Blog Post Author

      Cool!!! now go BLOG how YOU did it!!!! 😉

      Author's profile photo Former Member
      Former Member

      Can you elaborate on the Solution .