Custom MetaNet creation using Function Modules – HRFORMS_METADATA
Initially our client was using the pay slips designed in Sap Script to display the results in the off-cycle workbench of payroll. However a new requirement was raised, where the client wanted to replace the Sap Script pay slip format (that looks like an sap script) with PDF forms. After much research, I have suggested the solution to be implemented with the use of HRFORMS which allows us to implement the solution by providing an interface that provides the payroll data to design the forms using Adobe forms or Smartforms platforms.
HRFORMS uses the default SAP_DEFAULT (SAP standard MetaNet) which fetches all the possible data of SAP standard HR master data, personnel time data, and payroll results. However, as our client has some project specific customizations in place, not all data could be retrieved using the standard SAP_DEFAULT MetaNet. Hence I had to proceed with using a custom MetaNet which can inherited all the properties of the default MetaNet along with providing a way to implement solution to retrieve customer specific data.
Using the custom MetaNet I was able to accommodate the basis to fetch the data from customer specific Infotypes directly. However there were certain scenarios where the data was not stored directly in the Infotypes but the data was supposed to be displayed on the pay slip on the basis of some calculations/manipulations. Therefore I have come up with the idea of creating custom MetaNet using Funtion Module. This FM will contain all the necessary logic to perform the calculation/manipulatios and return the data to the MetaNet.
In this blog post, I have given all the information required to create a Custom MetaNet which uses the customer specific FM to retrieve all the required data.
Step 01: Go to TCODE HRFORMS_METADATA. Give the custom MetaNet name and choose the Country for which you would like to create the MetaNet and click on create.
Alternatively, you can also create a custom MetaNet by copying the standard SAP_DEFAULT by clicking on the copy button.
Step 02: In the maintenance screen of the MetaNet, we see there are three columns in left side MetaFigures, MetaDimensions, MetaStars and in the right side work-place for MetaNet.
Step 03: A custom meta dimension must be created. Click on the create button on the Meta Dimensions Column. Provide the name and description as per the requirement.
Step 04: Once the Meta Dimension has been created, each field you would like to use should be created under this meta Dimension node. These fields are called as Meta Fields. Right Click on the custom Meta Dimension and choose create field. Maintain the required name and description for the metafield.
In this way create all the fields you would like to include in the meta dimension. The structure of the Meta Dimension after creating the meta fields will look as follows.
Step 05: Now create a custom FM using SE37 which contains all the logic to fetch the data relevant to these meta fields. These Meta Fields will be used as the Import, Changing or Tables parameters of this FM.
While creating the Tables parameter, create a structure and table type in SE11 including all the meta fields that you would like to use and this table type should be used in the Tables declaration.
Include all the respective code in the Source Code tab.
In the MetaFields tab, maintain the field types. And to make a field as Key field just click on the squares left to the MetaField.
Step 07: Now create a MetaStar to map this Meta Dimension by clicking on create. Maintain the desired name and description.
Now drag and drop all MetaDimensions from the MetaDimensions column to the custom MetaStar.
Step 08: When all required MetaDimensions are inserted under then custom MetaStar then map the fields, on the right hand side of the screen. In the first MetaStar give type as Special Type A, Read Function as your FM name and Line structure as the structure you have created in SE11.
Step 09: Finally click on the work place of the MetaNet , Information about the MetaNet will display at the bottom of the window. Give the details as shown in the screen shot.
Step 10: Just drag and drop custom metaStar form the metaStar column to metaNet workplace.
Step 11: Save and exit form the MetaNet. This custom MetaNet can be now used in HRFORMS.
In conclusion, HRFORMS is a great and easy way to design payslips when you learn the ways to create custom MetaNets to accommodate the client specific customizations or logics. And this blog post will help you to give start on this topic.